/* AstroChart 星盤 — deep night sky, champagne gold */

:root {
  --bg: #0a0d19;
  --panel: rgba(19, 23, 42, 0.72);
  --field: #0d1122;
  --line: #242b49;
  --line-soft: rgba(36, 43, 73, 0.55);
  --ink: #e9e4d5;
  --muted: #8d93ad;
  --gold: #d3b877;
  --gold-soft: #a8925a;
  --serif: "Songti TC", "Noto Serif TC", Georgia, "Times New Roman", serif;
  --sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 90% 55% at 50% -12%, rgba(64, 72, 122, 0.38), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='480' height='480'%3E%3Cg fill='%23ccd4f0'%3E%3Ccircle cx='24' cy='68' r='1' fill-opacity='.5'/%3E%3Ccircle cx='118' cy='22' r='.8' fill-opacity='.35'/%3E%3Ccircle cx='210' cy='96' r='1.2' fill-opacity='.55'/%3E%3Ccircle cx='305' cy='40' r='.7' fill-opacity='.3'/%3E%3Ccircle cx='398' cy='120' r='1' fill-opacity='.45'/%3E%3Ccircle cx='70' cy='190' r='.9' fill-opacity='.4'/%3E%3Ccircle cx='168' cy='250' r='1.1' fill-opacity='.5'/%3E%3Ccircle cx='260' cy='188' r='.7' fill-opacity='.3'/%3E%3Ccircle cx='352' cy='262' r='1' fill-opacity='.45'/%3E%3Ccircle cx='440' cy='210' r='.8' fill-opacity='.35'/%3E%3Ccircle cx='40' cy='330' r='1.1' fill-opacity='.5'/%3E%3Ccircle cx='140' cy='400' r='.8' fill-opacity='.35'/%3E%3Ccircle cx='238' cy='340' r='1' fill-opacity='.45'/%3E%3Ccircle cx='330' cy='420' r='.9' fill-opacity='.4'/%3E%3Ccircle cx='426' cy='352' r='1.2' fill-opacity='.55'/%3E%3Ccircle cx='470' cy='452' r='.7' fill-opacity='.3'/%3E%3Ccircle cx='88' cy='452' r='1' fill-opacity='.45'/%3E%3C/g%3E%3C/svg%3E");
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- 版面 ---------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 0.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  font-family: var(--serif);
  font-size: 1.35rem;
  letter-spacing: 0.08em;
}

.brand-mark {
  display: inline-flex;
  margin-right: 0.5rem;
}

.brand-mark svg {
  width: 1.35em;
  height: 1.35em;
  display: block;
}

.brand-sub {
  color: var(--muted);
  font-size: 0.95rem;
  margin-left: 0.6rem;
  letter-spacing: 0.3em;
}

.site-nav {
  display: inline-flex;
  align-items: center;
  gap: 1.1rem;
}

.site-nav a {
  color: var(--muted);
  font-size: 0.9rem;
  letter-spacing: 0.1em;
}
.site-nav a:hover { color: var(--gold); }

/* ---------- 首頁導言與特色 ---------- */

.hero {
  text-align: center;
  max-width: 720px;
  margin: 1.75rem auto 0;
  padding: 0 0.5rem;
}

.hero-sub {
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.75;
  letter-spacing: 0.02em;
  margin: 0;
}

.feature-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem 0.75rem;
  list-style: none;
  margin: 1.15rem 0 0;
  padding: 0;
}

.feature-strip li {
  color: var(--gold);
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  padding: 0.28rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(211, 184, 119, 0.05);
}

.footer-cta {
  margin: 0 0 0.45rem;
  color: var(--ink);
}
.footer-cta a { letter-spacing: 0.08em; }

.site-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1.1rem;
}

/* ---------- 語言切換 ---------- */

.lang-select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.lang-select {
  appearance: none;
  min-width: 7.6rem;
  background:
    linear-gradient(45deg, transparent 50%, var(--gold-soft) 50%) calc(100% - 13px) 50% / 5px 5px no-repeat,
    linear-gradient(135deg, var(--gold-soft) 50%, transparent 50%) calc(100% - 8px) 50% / 5px 5px no-repeat,
    rgba(13, 17, 34, 0.72);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  line-height: 1.4;
  padding: 0.34rem 1.7rem 0.34rem 0.75rem;
  transition: border-color 0.2s, background-color 0.2s;
}

.lang-select:hover,
.lang-select:focus { border-color: var(--gold-soft); }

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 1.5rem 1rem 2.5rem;
}

/* ---------- 分頁 ---------- */

.tabs {
  display: flex;
  justify-content: center;
  justify-content: safe center;
  gap: 1.9rem;
  margin: 2rem 0 1.75rem;
  overflow-x: auto;
  padding-bottom: 0.4rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.tab {
  appearance: none;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--serif);
  font-size: 1.2rem;
  letter-spacing: 0.35em;
  text-indent: 0.35em;
  padding: 0.4rem 0.25rem;
  transition: color 0.2s, border-color 0.2s;
  flex: 0 0 auto;
  white-space: nowrap;
}

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

.tab.active {
  color: var(--ink);
  border-bottom-color: var(--gold);
}

/* ---------- 卡片與表單 ---------- */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.4rem 1.6rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.1rem 1.25rem;
  align-items: end;
}

.field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.field label {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.3;
  letter-spacing: 0.08em;
  margin-bottom: 0.35rem;
  min-height: calc(0.8rem * 1.3);
}

.field.is-required > label::after {
  content: " *";
  color: var(--gold);
}

.field > input,
.field > select,
.field > .city-wrap,
.field > .birth-input-wrap {
  margin-top: auto;
}

.field input,
.field select {
  width: 100%;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  color-scheme: dark;
  font-family: var(--sans);
  font-size: 0.95rem;
  padding: 0.5rem 0.65rem;
  transition: border-color 0.2s;
}

.field input:focus,
.field select:focus {
  border-color: var(--gold-soft);
  outline: none;
}

.field.field-invalid label {
  color: #e8b7b3;
}

.field.field-invalid input,
.field.field-invalid select {
  border-color: rgba(232, 121, 113, 0.9);
  box-shadow: 0 0 0 3px rgba(232, 121, 113, 0.1);
}

.saved-profile-tools {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line-soft);
  margin-top: 0.15rem;
  padding-top: 0.85rem;
}

.saved-profile-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto auto;
  gap: 0.5rem;
}

.saved-profile-row .saved-profile-select {
  min-width: 0;
}

.profile-action {
  appearance: none;
  min-height: 38px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 0.78rem;
  padding: 0.45rem 0.7rem;
}

.profile-action:hover,
.profile-action:focus-visible {
  color: var(--gold);
  border-color: var(--gold-soft);
}

.profile-delete {
  color: #dba09c;
}

.profile-privacy,
.profile-status {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.5;
  margin-top: 0.4rem;
}

.profile-status {
  color: #77c9aa;
}

.profile-status.is-error {
  color: #e8b7b3;
}

.birth-input-wrap {
  position: relative;
}

.birth-input-wrap input {
  padding-right: 2.5rem;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}

.birth-input-icon {
  position: absolute;
  top: 50%;
  right: 0.72rem;
  width: 1.08rem;
  height: 1.08rem;
  color: var(--gold-soft);
  pointer-events: none;
  transform: translateY(-50%);
}

.birth-input-icon svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

body.birth-picker-open { overflow: hidden; }

.birth-picker-overlay {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.birth-picker-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 5, 14, 0.78);
  backdrop-filter: blur(5px);
}

.birth-picker-dialog {
  position: relative;
  width: min(390px, 100%);
  height: min(600px, calc(100dvh - 2rem));
  overflow-y: auto;
  color: var(--ink);
  background: #10152a;
  border: 1px solid rgba(211, 184, 119, 0.42);
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.58);
  padding: 1rem;
  animation: none;
  transform: none;
  transition: none;
}

.birth-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.birth-picker-title {
  color: #f1e7ca;
  font-family: var(--serif);
  font-size: 1rem;
  letter-spacing: 0.08em;
  margin: 0;
}

.birth-picker-close {
  appearance: none;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
}

.birth-picker-year-nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.birth-picker-year-input {
  appearance: none;
  width: 100%;
  color: var(--gold);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--serif);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
  padding: 0.55rem 0.7rem;
  text-align: center;
}

.birth-picker-year-input:focus {
  border-color: var(--gold-soft);
  outline: none;
}

.birth-picker-year-apply {
  min-width: 4.5rem;
  padding-inline: 0.65rem;
}

.birth-picker-year-choose {
  min-width: 4.5rem;
  padding-inline: 0.65rem;
}

.birth-picker-years {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-height: 11.5rem;
  overflow-y: auto;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  margin: -0.25rem 0 0.75rem;
  padding: 0.45rem;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.birth-picker-grid {
  display: grid;
  gap: 0.35rem;
}

.birth-picker-months,
.birth-picker-hours,
.birth-picker-minutes {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.birth-picker-periods {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 0.3rem;
}

.birth-picker-weekdays,
.birth-picker-days {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.birth-picker-weekdays {
  color: var(--muted);
  font-size: 0.7rem;
  margin: 0.9rem 0 0.35rem;
  text-align: center;
}

.birth-picker-weekdays span {
  padding: 0.25rem 0;
}

.birth-picker-button {
  appearance: none;
  min-height: 2.35rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  padding: 0.35rem 0.2rem;
}

.birth-picker-button:hover,
.birth-picker-button:focus-visible {
  color: #fff4d2;
  border-color: var(--gold-soft);
}

.birth-picker-button.is-selected {
  color: #101326;
  background: var(--gold);
  border-color: var(--gold);
  font-weight: 700;
}

.birth-picker-button.is-today:not(.is-selected) {
  color: var(--gold);
  border-color: rgba(211, 184, 119, 0.5);
}

.birth-picker-empty {
  min-height: 2.35rem;
}

.birth-picker-section-title {
  color: var(--gold-soft);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  margin: 1rem 0 0.45rem;
}

.birth-picker-time-value {
  color: #f3e7c3;
  font-family: var(--serif);
  font-size: 2rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  margin: 0.2rem 0 0.6rem;
  text-align: center;
}

.birth-picker-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  border-top: 1px solid var(--line-soft);
  margin-top: 1rem;
  padding-top: 0.85rem;
}

.birth-picker-action {
  appearance: none;
  min-width: 5.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--sans);
  padding: 0.55rem 0.9rem;
}

.birth-picker-cancel {
  color: var(--muted);
  background: transparent;
}

.birth-picker-done {
  color: #111425;
  background: var(--gold);
  border-color: var(--gold);
  font-weight: 700;
}

@media (max-width: 520px) {
  .birth-picker-overlay {
    align-items: end;
    padding: 0;
  }

  .birth-picker-dialog {
    width: 100%;
    height: min(600px, 88dvh);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 18px 18px 0 0;
    padding: 1rem max(1rem, env(safe-area-inset-right))
      calc(1rem + env(safe-area-inset-bottom))
      max(1rem, env(safe-area-inset-left));
  }
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

.unknown-time-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.82rem;
  margin-top: 1rem;
}

.unknown-time-toggle input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--gold);
}

.field-disabled {
  opacity: .48;
}

.field-disabled input,
.field-disabled select {
  cursor: not-allowed;
}

.unknown-time-notice {
  color: #e3c979;
  background: rgba(211, 184, 119, 0.08);
  border: 1px solid rgba(211, 184, 119, 0.32);
  border-radius: 10px;
  line-height: 1.65;
  margin: 1rem 0;
  padding: 0.75rem 0.9rem;
}

.interpretation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.result-highlights {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 92% 10%, rgba(211, 184, 119, 0.12), transparent 30%),
    var(--panel);
  border-color: rgba(211, 184, 119, 0.34);
}

.result-highlights::after {
  content: "✦";
  position: absolute;
  top: 1.05rem;
  right: 1.25rem;
  color: rgba(211, 184, 119, 0.3);
  font-size: 1.25rem;
}

.section-kicker {
  color: var(--gold);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  margin: 0 0 0.35rem;
  text-transform: uppercase;
}

.result-highlights > h2 {
  margin-bottom: 0.45rem;
}

.result-intro {
  max-width: 720px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.7;
  margin: 0 0 1rem;
}

.interpretation-card {
  background: rgba(255, 255, 255, 0.018);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 0.85rem;
}

.interpretation-card h3 {
  color: #f1e7c7;
  font-family: var(--serif);
  font-size: 0.92rem;
  margin: 0 0 0.4rem;
}

.interpretation-card p {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.65;
  margin: 0;
}

.result-highlight-card {
  min-height: 138px;
  padding: 1rem;
  transition: border-color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.result-highlight-card:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(211, 184, 119, 0.42);
  transform: translateY(-2px);
}

.result-highlight-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.result-highlight-head h3 {
  margin: 0;
}

.result-highlight-orb {
  flex: 0 0 auto;
  color: var(--gold);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.timeline-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.timeline-ranges {
  display: flex;
  gap: 8px;
}

.timeline-range {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 7px 14px;
  cursor: pointer;
}

.timeline-range:hover,
.timeline-range:focus-visible,
.timeline-range.active {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(211, 184, 119, .08);
}

.timeline-status {
  color: var(--muted);
  margin: 14px 0 0;
}

.timeline-hint {
  color: var(--muted);
  font-size: 0.76rem;
  margin: 12px 0 0;
}

.transit-orbit-explorer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: center;
  gap: clamp(28px, 6vw, 72px);
  min-height: 420px;
  margin-top: 22px;
  padding: clamp(24px, 5vw, 52px);
  background:
    radial-gradient(circle at 84% 50%, rgba(211, 184, 119, .09), transparent 35%),
    linear-gradient(125deg, rgba(22, 27, 51, .92), rgba(10, 13, 28, .92));
  border: 1px solid rgba(211, 184, 119, .24);
}

.transit-orbit-copy {
  min-width: 0;
}

.transit-orbit-copy h3 {
  max-width: 560px;
  margin: 10px 0 18px;
  color: #f2e8c9;
  font-family: var(--serif);
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  font-weight: 500;
  letter-spacing: -.025em;
  line-height: 1.2;
  text-wrap: balance;
}

.transit-orbit-copy > time {
  display: block;
  color: var(--gold);
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.transit-selected-summary {
  min-height: 3.3em;
  max-width: 590px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.75;
}

.transit-selected-aspects {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.transit-orbit-note {
  margin: 18px 0 0;
  color: #747b98;
  font-size: .68rem;
  line-height: 1.55;
}

.transit-selected-aspect {
  max-width: 100%;
  overflow: hidden;
  color: #e9e4d5;
  background: rgba(255, 255, 255, .025);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  font: 600 .72rem/1.3 var(--sans);
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease, background-color .2s ease;
}

.transit-selected-aspect:hover,
.transit-selected-aspect:focus-visible {
  color: var(--gold);
  background: rgba(211, 184, 119, .06);
  border-color: var(--gold);
}

.transit-orbit-sky {
  position: relative;
  aspect-ratio: 1;
  width: min(100%, 360px);
  border: 1px solid rgba(211, 184, 119, .3);
  border-radius: 50%;
  background:
    linear-gradient(rgba(126, 138, 187, .12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126, 138, 187, .12) 1px, transparent 1px),
    radial-gradient(circle, rgba(211, 184, 119, .09), transparent 58%);
  background-position: center;
  background-size: 100% 1px, 1px 100%, auto;
  box-shadow: inset 0 0 72px rgba(0, 0, 0, .26), 0 0 50px rgba(58, 68, 117, .08);
}

.transit-orbit-ring {
  position: absolute;
  border: 1px solid rgba(126, 138, 187, .2);
  border-radius: 50%;
  pointer-events: none;
}

.transit-orbit-ring-a { inset: 16%; }
.transit-orbit-ring-b { inset: 31%; }
.transit-orbit-ring-c { inset: 43%; }

.transit-orbit-earth {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: #e9e4d5;
  background: #11162b;
  border: 1px solid var(--gold);
  border-radius: 50%;
  font-size: 1.15rem;
  line-height: 1;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 28px rgba(211, 184, 119, .18);
}

.transit-zodiac-marker {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  color: var(--gold-soft);
  background: #0d1124;
  font-family: var(--serif);
  font-size: .88rem;
}

.transit-zodiac-aries {
  left: 50%;
  top: 0;
  transform: translate(-50%, -50%);
}

.transit-zodiac-cancer {
  left: 0;
  top: 50%;
  transform: translate(-50%, -50%);
}

.transit-zodiac-libra {
  bottom: 0;
  left: 50%;
  transform: translate(-50%, 50%);
}

.transit-zodiac-capricorn {
  right: 0;
  top: 50%;
  transform: translate(50%, -50%);
}

.transit-orbit-planets {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.transit-orbit-planet {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  transition: transform .52s cubic-bezier(.22, 1, .36, 1);
  will-change: transform;
}

.transit-orbit-glyph {
  position: absolute;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  color: var(--gold);
  background: #0d1124;
  border: 1px solid rgba(211, 184, 119, .36);
  border-radius: 50%;
  font-family: var(--serif);
  font-size: .9rem;
  line-height: 1;
  transform: translate(-50%, -50%);
  transition: transform .52s cubic-bezier(.22, 1, .36, 1), color .2s ease, border-color .2s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .3);
}

.transit-orbit-planet:hover {
  z-index: 8;
}

.transit-orbit-planet:hover .transit-orbit-glyph {
  color: #fff1c5;
  border-color: var(--gold);
}

.transit-scrubber {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: start;
  gap: 14px;
  margin: 20px 0 4px;
}

.transit-step-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: var(--gold);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease, background-color .2s ease;
}

.transit-step-button:hover:not(:disabled),
.transit-step-button:focus-visible {
  color: #f6e7bc;
  background: rgba(211, 184, 119, .07);
  border-color: var(--gold);
}

.transit-step-button:disabled {
  opacity: .3;
  cursor: default;
}

.transit-slider-column {
  min-width: 0;
  padding-top: 2px;
}

#transit-day-slider {
  width: 100%;
  height: 22px;
  margin: 0;
  padding: 0;
  accent-color: var(--gold);
  cursor: grab;
}

#transit-day-slider:active {
  cursor: grabbing;
}

.transit-slider-labels {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  margin-top: 3px;
  color: var(--muted);
  font-size: .66rem;
  font-variant-numeric: tabular-nums;
}

.transit-slider-labels span {
  text-align: center;
}

.transit-slider-labels time:last-child {
  text-align: right;
}

.transit-timeline {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  margin-top: 18px;
  padding: 2px 2px 12px;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
  scrollbar-color: var(--gold-soft) transparent;
}

.timeline-day {
  flex: 0 0 220px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: rgba(13, 17, 36, .65);
  transition: border-color .18s ease, transform .18s ease;
  scroll-snap-align: center;
}

.timeline-day:hover,
.timeline-day.is-active {
  border-color: var(--gold);
  transform: translateY(-2px);
}

.timeline-date-button {
  width: 100%;
  color: var(--gold);
  background: transparent;
  border: 0;
  font: 700 .88rem/1.4 var(--sans);
  text-align: left;
  cursor: pointer;
}

.timeline-date-button:hover,
.timeline-date-button:focus-visible {
  color: #f6e7bc;
}

.timeline-date-button time {
  color: var(--gold);
  font-weight: 700;
}

.timeline-day ul {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}

.timeline-day li {
  border-top: 1px solid rgba(255, 255, 255, .06);
}

.timeline-aspect {
  width: 100%;
  display: grid;
  gap: 5px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  padding: 9px 2px;
  cursor: pointer;
}

.timeline-aspect:hover .timeline-aspect-name,
.timeline-aspect:focus-visible .timeline-aspect-name {
  color: var(--gold);
}

.timeline-aspect-detail {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: .75rem;
}

.timeline-phase {
  color: #77c9aa;
}

.timeline-day .empty {
  margin: 10px 0 0;
}

@media (max-width: 820px) {
  .transit-orbit-explorer {
    grid-template-columns: 1fr;
  }

  .transit-orbit-sky {
    grid-row: 1;
    width: min(88vw, 350px);
    margin-inline: auto;
  }
}

@media (max-width: 560px) {
  .transit-orbit-explorer {
    margin-inline: -1.2rem;
    padding: 28px 18px;
  }

  .transit-orbit-sky {
    width: min(82vw, 310px);
  }

  .transit-orbit-glyph {
    width: 23px;
    height: 23px;
    font-size: .82rem;
  }

  .transit-scrubber {
    grid-template-columns: 38px minmax(0, 1fr) 38px;
    gap: 9px;
  }

  .transit-step-button {
    width: 38px;
    height: 38px;
  }

  .transit-slider-labels {
    grid-template-columns: 1fr 1fr;
  }

  .transit-slider-labels span {
    display: none;
  }

  .timeline-day {
    flex-basis: min(78vw, 240px);
  }
}

body.transit-detail-open {
  overflow: hidden;
}

.transit-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 20px;
}

.transit-detail-overlay[hidden] {
  display: none;
}

.transit-detail-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(3, 5, 14, .78);
  backdrop-filter: blur(5px);
  cursor: default;
}

.transit-detail-dialog {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: min(720px, 88dvh);
  overflow-y: auto;
  border: 1px solid var(--gold-soft);
  border-radius: 18px;
  background: #11162b;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .5);
  padding: 28px;
}

.transit-detail-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1.35rem;
  cursor: pointer;
}

.transit-detail-close:hover,
.transit-detail-close:focus-visible {
  border-color: var(--gold);
  color: var(--gold);
}

.transit-detail-phase {
  display: inline-flex;
  border: 1px solid rgba(119, 201, 170, .35);
  border-radius: 999px;
  background: rgba(119, 201, 170, .08);
  color: #77c9aa;
  font-size: .75rem;
  padding: 5px 10px;
}

.transit-detail-dialog > h2 {
  margin: 16px 42px 8px 0;
  color: #f1e7c7;
  font-family: var(--serif);
  font-size: clamp(1.35rem, 4vw, 1.9rem);
}

.transit-detail-meta {
  color: var(--muted);
  font-size: .82rem;
}

.transit-detail-section {
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 18px;
}

.transit-detail-section h3 {
  color: var(--gold);
  font-size: .82rem;
  letter-spacing: .08em;
  margin: 0 0 8px;
}

.transit-detail-section p {
  color: var(--ink);
  line-height: 1.8;
  margin: 0;
}

.transit-reminder-button {
  width: 100%;
  margin-top: 24px;
}

body.profile-dialog-open {
  overflow: hidden;
}

.profile-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: grid;
  place-items: center;
  padding: 20px;
}

.profile-dialog-overlay[hidden] {
  display: none;
}

.profile-dialog-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(3, 5, 14, .8);
  backdrop-filter: blur(5px);
}

.profile-dialog {
  position: relative;
  z-index: 1;
  width: min(460px, 100%);
  color: var(--ink);
  background: #11162b;
  border: 1px solid rgba(211, 184, 119, .42);
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .55);
  padding: 26px;
}

.profile-dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.25rem;
}

.profile-dialog h2 {
  color: #f1e7c7;
  font-family: var(--serif);
  font-size: 1.45rem;
  margin: 8px 40px 10px 0;
}

.profile-dialog > p:not(.section-kicker):not(.profile-dialog-error) {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.65;
}

.profile-dialog label {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  margin: 20px 0 6px;
}

.profile-dialog input {
  width: 100%;
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: 16px var(--sans);
  padding: 0.7rem 0.8rem;
}

.profile-dialog input:focus {
  border-color: var(--gold-soft);
  outline: none;
}

.profile-dialog-error {
  color: #e8b7b3;
  font-size: 0.76rem;
  margin: 8px 0 0;
}

.profile-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line-soft);
  margin-top: 22px;
  padding-top: 18px;
}

@media (max-width: 600px) {
  .saved-profile-row {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .saved-profile-row .saved-profile-select {
    grid-column: 1 / -1;
  }

  .transit-detail-overlay {
    place-items: end center;
    padding: 0;
  }

  .transit-detail-dialog {
    width: 100%;
    max-height: 84dvh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 20px 20px 0 0;
    padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  }

  .profile-dialog-overlay {
    align-items: end;
    padding: 0;
  }

  .profile-dialog {
    width: 100%;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 20px 20px 0 0;
    padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  }
}

.form-actions-syn {
  align-items: flex-end;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.field-orb { max-width: 300px; }

.btn {
  appearance: none;
  background: var(--gold);
  border: none;
  border-radius: 8px;
  color: #16121f;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-indent: 0.15em;
  padding: 0.6rem 2rem;
  transition: filter 0.2s;
}

.btn:hover:not(:disabled) { filter: brightness(1.1); }
.btn:disabled { opacity: 0.6; cursor: wait; }

fieldset {
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 0;
  padding: 0.9rem 1.2rem 1.2rem;
  min-inline-size: 0;
}

legend {
  font-family: var(--serif);
  color: var(--gold);
  letter-spacing: 0.2em;
  padding: 0 0.5rem;
}

.syn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

/* ---------- 訊息 ---------- */

.error {
  background: rgba(120, 45, 45, 0.18);
  border: 1px solid rgba(217, 138, 134, 0.5);
  border-radius: 8px;
  color: #e8b7b3;
  margin-top: 1.25rem;
  padding: 0.75rem 1rem;
}

.error:focus {
  outline: 2px solid rgba(217, 138, 134, 0.75);
  outline-offset: 2px;
}

.empty { color: var(--muted); margin: 0.5rem 0; }

/* ---------- 星盤輪 ---------- */

.wheel-wrap {
  position: relative;
  max-width: 680px;
  margin: 2.25rem auto 0;
  isolation: isolate;
}

.wheel {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 0 38px rgba(211, 184, 119, 0.1));
  touch-action: manipulation;
}

.w-disc { fill: #0d1124; }
.w-ring-outer { fill: none; stroke: var(--gold); stroke-width: 2.5; }
.w-ring { fill: none; stroke: var(--gold-soft); stroke-width: 1; }
.w-ring-faint { fill: none; stroke: var(--line); stroke-width: 1; }
.w-sign-line { stroke: var(--gold-soft); stroke-width: 1; opacity: 0.55; }
.w-sign-glyph { fill: var(--gold); }
.w-cusp { stroke: #39406a; stroke-width: 1; }
.w-cusp-major { stroke: var(--gold-soft); stroke-width: 1.6; }
.w-house-num { fill: var(--muted); }
.w-planet { fill: var(--ink); }
.w-tick { stroke: var(--gold); stroke-width: 1.5; }
.w-link { stroke: #39406a; stroke-width: 0.75; }
.w-aspect { stroke-width: 1.3; opacity: 0.85; }

.wheel-target { cursor: pointer; }

.w-sign-sector,
.w-house-zone,
.w-aspect-node,
.w-planet-node,
.w-planet-halo,
.w-planet-glyph,
.w-planet-marker {
  transition:
    opacity 160ms ease,
    fill-opacity 160ms ease,
    stroke-width 160ms ease,
    stroke-opacity 160ms ease,
    font-size 160ms ease,
    filter 160ms ease;
}

.w-sign-node:hover .w-sign-sector,
.w-sign-node.is-active .w-sign-sector,
.w-sign-node:focus-visible .w-sign-sector {
  fill-opacity: 0.13;
}

.w-sign-node:hover .w-sign-glyph,
.w-sign-node.is-active .w-sign-glyph,
.w-sign-node:focus-visible .w-sign-glyph {
  fill: #f2d991;
  font-size: 24px;
  filter: drop-shadow(0 0 8px rgba(211, 184, 119, 0.45));
}

.w-house-node:hover .w-house-zone,
.w-house-node.is-active .w-house-zone,
.w-house-node:focus-visible .w-house-zone {
  fill-opacity: 0.1;
}

.w-aspect-hit { cursor: crosshair; }

.w-aspect-node.is-active .w-aspect-line,
.w-aspect-node:hover .w-aspect-line,
.w-aspect-node:focus-visible .w-aspect-line {
  opacity: 1;
  stroke-width: 3.2;
  filter: drop-shadow(0 0 4px rgba(242, 217, 145, 0.55));
}

.w-planet-node:hover .w-planet-halo,
.w-planet-node.is-active .w-planet-halo,
.w-planet-node:focus-visible .w-planet-halo {
  stroke-width: 1.8;
  stroke-opacity: 1;
  filter: drop-shadow(0 0 8px rgba(211, 184, 119, 0.55));
}

.w-planet-node:hover .w-planet-glyph,
.w-planet-node.is-active .w-planet-glyph,
.w-planet-node:focus-visible .w-planet-glyph {
  fill: #fff4cf;
  font-size: 24px;
}

.w-planet-node.is-related .w-planet-halo {
  stroke-width: 1.5;
  stroke-opacity: 0.86;
}

.w-planet-node.is-related .w-planet-glyph { fill: #fff1c8; }
.w-planet-node.is-related .w-planet-marker { r: 4.2px; }

.wheel.has-wheel-selection .w-aspect-node.is-muted { opacity: 0.08; }
.wheel.has-wheel-selection .w-planet-node.is-muted { opacity: 0.22; }

.wheel-tooltip {
  position: absolute;
  z-index: 5;
  width: min(292px, calc(100% - 16px));
  color: var(--ink);
  background: rgba(12, 16, 33, 0.94);
  border: 1px solid rgba(211, 184, 119, 0.5);
  border-radius: 12px;
  box-shadow:
    0 16px 42px rgba(0, 0, 0, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  padding: 0.78rem 0.85rem;
  pointer-events: none;
  backdrop-filter: blur(12px);
}

.wheel-tooltip[hidden] { display: none; }

.wheel-tooltip-head {
  display: flex;
  align-items: center;
  gap: 0.72rem;
}

.wheel-tooltip-icon {
  display: grid;
  place-items: center;
  min-width: 2.1rem;
  min-height: 2.1rem;
  color: var(--gold);
  background: rgba(211, 184, 119, 0.08);
  border: 1px solid rgba(211, 184, 119, 0.22);
  border-radius: 50%;
  font-family: var(--serif);
  font-size: 1.18rem;
  line-height: 1;
  white-space: nowrap;
}

.wheel-tooltip-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.wheel-tooltip-title {
  color: #f4e9c8;
  font-family: var(--serif);
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.wheel-tooltip-meta {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
  margin-top: 0.08rem;
}

.wheel-tooltip-section {
  color: var(--gold-soft);
  border-top: 1px solid var(--line-soft);
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  margin-top: 0.68rem;
  padding-top: 0.55rem;
}

.wheel-tooltip-row {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.42rem;
  color: #d7d5d0;
  font-size: 0.75rem;
  line-height: 1.35;
  margin-top: 0.4rem;
}

.wheel-tooltip-swatch {
  width: 12px;
  height: 3px;
  background: var(--gold-soft);
  border-radius: 999px;
}

.wheel-tooltip-row-copy {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wheel-tooltip-value {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.wheel-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  color: #777f9e;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  margin: 0.55rem 0 0;
  text-align: center;
}

.wheel-hint::before {
  content: "✦";
  color: var(--gold-soft);
  font-size: 0.72em;
}

.asc-line {
  font-family: var(--serif);
  color: var(--gold);
  letter-spacing: 0.15em;
  text-align: center;
  margin: 0.65rem 0 0;
}

.legend {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.6rem;
}

.legend-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.3rem 0.9rem;
}

.legend-title {
  color: var(--gold-soft, #a8925a);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  margin-right: 0.2rem;
}

.legend-glyph {
  color: var(--gold);
  font-size: 1.05em;
  min-width: 1.1em;
  text-align: center;
}

.legend-item { display: inline-flex; align-items: center; gap: 0.3rem; }

.legend-swatch {
  display: inline-block;
  width: 16px;
  height: 3px;
  border-radius: 2px;
}

/* ---------- 資料表 ---------- */

.tables {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-top: 2rem;
}

.tables .wide { grid-column: 1 / -1; }

h2 {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  margin: 0 0 0.8rem;
}

h2::before {
  content: "✦";
  color: var(--gold);
  font-size: 0.75em;
  margin-right: 0.55rem;
  vertical-align: 0.1em;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  white-space: nowrap;
}

th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--line);
}

td {
  padding: 0.48rem 0.75rem;
  border-bottom: 1px solid var(--line-soft);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(211, 184, 119, 0.04); }

/* ---------- 城市搜尋 ---------- */

.city-wrap { position: relative; }

.city-drop {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30;
  margin: 0;
  padding: 0.3rem;
  list-style: none;
  background: #12162c;
  border: 1px solid var(--line);
  border-radius: 8px;
  max-height: 250px;
  overflow-y: auto;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.city-drop li {
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
}

.city-drop li:hover,
.city-drop li.active { background: rgba(211, 184, 119, 0.14); }

.city-meta {
  color: var(--muted);
  font-size: 0.78rem;
  margin-left: 0.45rem;
}

/* ---------- 逆行標記 ---------- */

.retro-badge {
  display: inline-block;
  color: var(--gold);
  font-size: 0.72em;
  line-height: 1.35;
  margin-left: 0.4rem;
  padding: 0 0.3em;
  border: 1px solid var(--gold-soft);
  border-radius: 4px;
  vertical-align: 0.12em;
}

/* ---------- 結果操作列 ---------- */

.result-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.btn-ghost {
  background: none;
  border: 1px solid var(--gold-soft);
  color: var(--gold);
  font-weight: 500;
  padding: 0.45rem 1.3rem;
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(211, 184, 119, 0.1);
  filter: none;
}

/* ---------- 相位圖形卡片 ---------- */

.patterns {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.9rem;
}

.patterns .empty { grid-column: 1 / -1; }

.pattern-card {
  background: rgba(13, 17, 34, 0.6);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.85rem 1rem;
}

.pattern-name {
  font-family: var(--serif);
  color: var(--gold);
  letter-spacing: 0.12em;
  margin-bottom: 0.3rem;
}

.pattern-planets { font-size: 0.95rem; }

.pattern-extra {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 0.3rem;
}

/* ---------- 元素／三方統計 ---------- */

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem 2rem;
}

.stat-group h3 {
  margin: 0 0 0.6rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.2em;
}

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.donut {
  width: 108px;
  height: 108px;
  flex: none;
}

.donut-total {
  fill: var(--ink);
  font-size: 26px;
  font-weight: 600;
  font-family: var(--serif);
}

.stat-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
  font-size: 0.88rem;
}

.stat-legend li {
  display: grid;
  grid-template-columns: 0.9em 1fr auto;
  align-items: center;
  gap: 0.55rem;
}

.stat-legend .swatch {
  width: 0.85em;
  height: 0.85em;
  border-radius: 3px;
  display: inline-block;
}

.stat-legend .lg-count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- 附註文字 ---------- */

.meta-line {
  color: var(--muted);
  font-size: 0.92rem;
  letter-spacing: 0.08em;
  text-align: center;
  margin: 1.5rem 0 0;
}

.hint {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0.3rem 0 0.75rem;
}

/* ---------- 響應式 ---------- */

@media (max-width: 860px) {
  .tables { grid-template-columns: 1fr; }
  .syn-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
  .tabs {
    justify-content: flex-start;
    gap: 0.6rem;
    overflow-x: auto;
    padding-bottom: 0.4rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .tab {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 1.02rem;
    letter-spacing: 0.18em;
    text-indent: 0.18em;
    padding: 0.35rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: 999px;
  }
  .tab.active {
    border-color: var(--gold);
    border-bottom-color: var(--gold);
  }
  .form-actions { justify-content: stretch; }
  .form-actions .btn { width: 100%; }
  .form-actions-syn { flex-direction: column; align-items: stretch; }
  .field-orb { max-width: none; }
  .result-actions { justify-content: stretch; }
  .result-actions .btn { flex: 1 1 0; }
}

@media (max-width: 640px), (hover: none) {
  .wheel-wrap { margin-top: 1.6rem; }

  .wheel-tooltip {
    position: relative;
    left: auto !important;
    top: auto !important;
    width: 100%;
    margin-top: 0.65rem;
    pointer-events: auto;
  }

  .wheel-hint { font-size: 0.7rem; }
}

/* ---------- 各語言字型與字距 ---------- */

/* 中文標題的大字距在拉丁／韓文字上會過度鬆散，逐語言收斂 */
html[lang="en"] .tab,
html[lang="ko"] .tab {
  letter-spacing: 0.08em;
  text-indent: 0.08em;
}

html[lang="ja"] .tab {
  letter-spacing: 0.12em;
  text-indent: 0.12em;
}

html[lang="en"] .btn,
html[lang="ko"] .btn {
  letter-spacing: 0.04em;
  text-indent: 0.04em;
}

html[lang="en"] legend,
html[lang="ko"] legend { letter-spacing: 0.08em; }

html[lang="en"] h2,
html[lang="ko"] h2 { letter-spacing: 0.06em; }

html[lang="en"] {
  --serif: Georgia, "Times New Roman", "Songti TC", serif;
}

html[lang="ja"] {
  --sans: "Hiragino Kaku Gothic ProN", "Yu Gothic Medium", "Noto Sans JP", Meiryo, system-ui, sans-serif;
  --serif: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", Georgia, serif;
}

html[lang="ko"] {
  --sans: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  --serif: "Apple SD Gothic Neo", "Nanum Myeongjo", "Noto Serif KR", Georgia, serif;
}

/* ---------- 2026 editorial celestial direction ---------- */

:root {
  --bg: #090c17;
  --panel: rgba(15, 20, 37, 0.9);
  --field: rgba(8, 12, 25, 0.78);
  --line: #29304d;
  --line-soft: rgba(87, 96, 137, 0.24);
  --ink: #eee9da;
  --muted: #9299b1;
  --gold: #d8bd79;
  --gold-soft: #a99560;
  --pointer-x: 0;
  --pointer-y: 0;
}

body {
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(122, 132, 177, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(122, 132, 177, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 16% 18%, rgba(216, 189, 121, 0.055), transparent 24%),
    radial-gradient(circle at 82% 32%, rgba(80, 94, 150, 0.09), transparent 27%);
  background-size: 88px 88px, 88px 88px, auto, auto;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: -12%;
  content: "";
  pointer-events: none;
  opacity: 0.38;
  transform: translate(
    calc(var(--pointer-x) * -13px),
    calc(var(--pointer-y) * -10px)
  );
  transition: transform 1.2s cubic-bezier(.2, .7, .2, 1);
  background-image:
    radial-gradient(circle at 13% 26%, #cdd5ee 0 1px, transparent 1.5px),
    radial-gradient(circle at 28% 74%, #d8bd79 0 1px, transparent 1.6px),
    radial-gradient(circle at 51% 16%, #cdd5ee 0 1px, transparent 1.5px),
    radial-gradient(circle at 72% 67%, #cdd5ee 0 1px, transparent 1.5px),
    radial-gradient(circle at 89% 35%, #d8bd79 0 1px, transparent 1.5px);
}

.site-header {
  max-width: 1180px;
  padding-top: 1.8rem;
  padding-bottom: 1.15rem;
  border-bottom: 1px solid rgba(87, 96, 137, 0.22);
}

.brand {
  position: relative;
  color: var(--ink);
  font-size: 1.25rem;
}

.brand::after {
  position: absolute;
  right: -0.85rem;
  top: 0.1rem;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  content: "";
  background: var(--gold);
}

.brand-mark {
  animation: brand-turn 18s linear infinite;
}

.site-nav a {
  position: relative;
  padding: 0.3rem 0;
  text-decoration: none;
}

.site-nav a::after {
  position: absolute;
  left: 0;
  right: 100%;
  bottom: 0;
  height: 1px;
  content: "";
  background: var(--gold);
  transition: right .3s cubic-bezier(.22, 1, .36, 1);
}

.site-nav a:hover {
  color: var(--ink);
  text-decoration: none;
}

.site-nav a:hover::after { right: 0; }

main {
  max-width: 1180px;
  padding-bottom: 5rem;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr);
  align-items: center;
  gap: clamp(2rem, 7vw, 7rem);
  max-width: none;
  min-height: 440px;
  margin-top: 0;
  padding: clamp(4rem, 9vw, 7.5rem) 0 clamp(3rem, 7vw, 5.5rem);
  text-align: left;
}

.hero::after {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, var(--gold) 0 9%, var(--line) 9% 100%);
  transform: scaleX(0);
  transform-origin: left;
}

.is-ready .hero::after {
  animation: line-write 1.1s .62s cubic-bezier(.22, 1, .36, 1) forwards;
}

.hero-copy {
  position: relative;
  z-index: 2;
}

.motion-enabled .hero-copy {
  opacity: 0;
  transform: translateY(18px);
}

.is-ready .hero-copy {
  animation: editorial-in .9s .08s cubic-bezier(.22, 1, .36, 1) forwards;
}

.hero-kicker {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: var(--gold);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .24em;
  margin: 0 0 1.25rem;
}

.hero-kicker::before {
  width: 2.6rem;
  height: 1px;
  content: "";
  background: currentColor;
}

.hero h1 {
  max-width: 760px;
  margin: 0;
  color: #f2edde;
  font-family: var(--serif);
  font-size: clamp(2.55rem, 5.4vw, 5rem);
  font-weight: 500;
  letter-spacing: -.025em;
  line-height: 1.13;
  text-wrap: balance;
}

.hero-sub {
  max-width: 620px;
  margin-top: 1.65rem;
  font-size: 1rem;
  line-height: 1.85;
  text-align: left;
}

.feature-strip {
  justify-content: flex-start;
  gap: 0;
  margin-top: 2.4rem;
}

.feature-strip li {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: .45rem;
  min-width: 9.5rem;
  color: var(--muted);
  background: none;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  padding: 0 1.2rem;
  letter-spacing: .06em;
}

.feature-strip li:first-child { padding-left: 0; }
.feature-strip li:last-child { border-right: 0; }

.feature-strip strong {
  color: var(--gold);
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 500;
  letter-spacing: 0;
}

.hero-orbit {
  position: relative;
  z-index: 1;
  width: min(34vw, 360px);
  aspect-ratio: 1;
  justify-self: end;
  opacity: .92;
  transform:
    translate(
      calc(var(--pointer-x) * 12px),
      calc(var(--pointer-y) * 9px)
    )
    rotate(-8deg);
  transition: transform 1s cubic-bezier(.2, .7, .2, 1);
}

.motion-enabled .hero-orbit { opacity: 0; }

.is-ready .hero-orbit {
  animation: orbit-enter 1.15s .18s cubic-bezier(.22, 1, .36, 1) forwards;
}

.orbit,
.orbit-axis {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(216, 189, 121, .36);
  border-radius: 50%;
}

.orbit-outer {
  border-style: solid dashed;
  animation: orbit-turn 42s linear infinite;
}

.orbit-middle {
  inset: 15%;
  border-color: rgba(126, 138, 187, .42);
  animation: orbit-turn 28s linear infinite reverse;
}

.orbit-inner {
  inset: 34%;
  border-color: rgba(216, 189, 121, .5);
  border-style: dashed;
  animation: orbit-turn 18s linear infinite;
}

.orbit-axis {
  inset: 4% 47%;
  border-radius: 0;
  border-width: 0 0 0 1px;
  border-color: rgba(126, 138, 187, .22);
}

.orbit-axis-a { transform: rotate(32deg); }
.orbit-axis-b { transform: rotate(118deg); }

.orbit-planet,
.orbit-core {
  position: absolute;
  display: grid;
  place-items: center;
  color: var(--gold);
  font-family: var(--serif);
  line-height: 1;
}

.orbit-planet {
  width: 2rem;
  height: 2rem;
  background: var(--bg);
  font-size: 1.3rem;
  animation: planet-breathe 4.6s ease-in-out infinite;
}

.orbit-planet-a { top: 7%; left: 23%; }
.orbit-planet-b { right: 1%; top: 48%; animation-delay: -1.4s; }
.orbit-planet-c { bottom: 8%; left: 29%; animation-delay: -2.6s; }

.orbit-core {
  inset: 42%;
  font-size: 1.9rem;
  text-shadow: 0 0 24px rgba(216, 189, 121, .5);
  animation: core-pulse 3.8s ease-in-out infinite;
}

.tabs {
  position: relative;
  justify-content: flex-start;
  gap: clamp(1.3rem, 4vw, 3.6rem);
  margin: 2.25rem 0 1.75rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0;
}

.tab {
  position: relative;
  border: 0;
  font-size: 1.05rem;
  padding: .65rem 0 1rem;
}

.tab::after {
  position: absolute;
  left: 50%;
  right: 50%;
  bottom: -1px;
  height: 2px;
  content: "";
  background: var(--gold);
  transition: left .32s cubic-bezier(.22, 1, .36, 1), right .32s cubic-bezier(.22, 1, .36, 1);
}

.tab.active { border: 0; }
.tab.active::after { left: 0; right: 0; }

.panel-active {
  animation: panel-in .52s cubic-bezier(.22, 1, .36, 1);
}

.card,
fieldset {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .018), transparent 42%),
    var(--panel);
  border-color: rgba(93, 103, 145, .38);
  border-radius: 2px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .12);
}

form.card::before,
.guide-cta::before {
  position: absolute;
  left: 0;
  top: 0;
  width: 7rem;
  height: 1px;
  content: "";
  background: var(--gold);
}

.field input,
.field select {
  border-width: 0 0 1px;
  border-radius: 0;
  padding: .72rem .15rem;
}

.field input:focus,
.field select:focus {
  background-color: rgba(216, 189, 121, .035);
  box-shadow: inset 0 -1px 0 var(--gold);
}

.btn {
  position: relative;
  overflow: hidden;
  border-radius: 2px;
  min-height: 2.7rem;
  transition: color .25s ease, background-color .25s ease, transform .25s ease;
}

.btn:hover:not(:disabled) {
  filter: none;
  transform: translateY(-2px);
  background: #e5ca88;
}

.btn:active:not(:disabled) { transform: translateY(0); }

.birth-picker-dialog,
.transit-detail-dialog {
  border-radius: 2px;
}

.result-enter .wheel {
  animation: wheel-reveal .95s cubic-bezier(.22, 1, .36, 1) both;
}

.result-enter .tables > .card {
  animation: editorial-in .65s cubic-bezier(.22, 1, .36, 1) both;
}

.result-enter .tables > .card:nth-child(2) { animation-delay: .06s; }
.result-enter .tables > .card:nth-child(3) { animation-delay: .12s; }
.result-enter .tables > .card:nth-child(4) { animation-delay: .18s; }
.result-enter .tables > .card:nth-child(5) { animation-delay: .24s; }
.result-enter .tables > .card:nth-child(6) { animation-delay: .3s; }

.wheel {
  filter: drop-shadow(0 25px 45px rgba(0, 0, 0, .28));
}

.wheel-wrap::before {
  position: absolute;
  z-index: -1;
  inset: 12%;
  border: 1px solid rgba(216, 189, 121, .08);
  border-radius: 50%;
  content: "";
  animation: core-pulse 5s ease-in-out infinite;
}

.motion-enabled [data-reveal] {
  opacity: 0;
  transform: translateY(24px);
}

[data-reveal].is-visible {
  animation: editorial-in .75s calc(var(--reveal-index, 0) * 70ms) cubic-bezier(.22, 1, .36, 1) forwards;
}

@keyframes brand-turn {
  to { transform: rotate(360deg); }
}

@keyframes line-write {
  to { transform: scaleX(1); }
}

@keyframes editorial-in {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes orbit-enter {
  from { opacity: 0; clip-path: circle(0 at 50% 50%); }
  to { opacity: .92; clip-path: circle(75% at 50% 50%); }
}

@keyframes orbit-turn {
  to { transform: rotate(360deg); }
}

@keyframes planet-breathe {
  0%, 100% { opacity: .72; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-5px); }
}

@keyframes core-pulse {
  0%, 100% { opacity: .58; }
  50% { opacity: 1; }
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes wheel-reveal {
  from { opacity: 0; transform: rotate(-3deg); clip-path: circle(8% at 50% 50%); }
  to { opacity: 1; transform: rotate(0); clip-path: circle(75% at 50% 50%); }
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 1.5rem;
    min-height: 380px;
  }

  .hero h1 { font-size: clamp(2.35rem, 7vw, 3.75rem); }
  .hero-orbit { width: 240px; }

  .tab {
    border: 0;
    border-radius: 0;
    padding-inline: .25rem;
  }

  .tab.active {
    border: 0;
    color: var(--ink);
  }
}

@media (max-width: 680px) {
  .site-header { padding-top: 1rem; }

  .hero {
    display: block;
    min-height: 0;
    padding: 4.2rem 0 3.2rem;
  }

  .hero-copy { position: relative; z-index: 2; }
  .hero h1 { max-width: 92%; font-size: clamp(2.35rem, 11vw, 3.45rem); }
  .hero-sub { font-size: .92rem; }

  .hero-orbit {
    position: absolute;
    z-index: 0;
    right: -6rem;
    top: 1.7rem;
    width: 250px;
    opacity: .34;
  }

  .is-ready .hero-orbit { animation-name: orbit-enter-mobile; }

  .feature-strip li {
    min-width: 0;
    padding: 0 .65rem;
    font-size: .68rem;
  }

  .feature-strip strong { font-size: 1.2rem; }

  .tabs {
    gap: 1.4rem;
    margin-top: 1.5rem;
  }

  .card { padding: 1.2rem; }
  .site-tools { width: 100%; justify-content: space-between; }
  .site-nav { gap: .85rem; overflow-x: auto; }
}

@keyframes orbit-enter-mobile {
  from { opacity: 0; clip-path: circle(0 at 50% 50%); }
  to { opacity: .34; clip-path: circle(75% at 50% 50%); }
}

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

  .hero-copy,
  .hero-orbit,
  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
    clip-path: none !important;
  }

  .hero::after { transform: scaleX(1); }
}

/* ---------- 產品使用路徑 ---------- */

.product-discovery {
  margin-top: clamp(5.5rem, 11vw, 10rem);
  padding-top: clamp(4rem, 8vw, 7rem);
  border-top: 1px solid var(--line);
}

.discovery-heading {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, .9fr);
  align-items: end;
  gap: clamp(2rem, 7vw, 6rem);
  margin-bottom: clamp(2.5rem, 5vw, 4.5rem);
}

.discovery-heading h2 {
  max-width: 700px;
  margin: .65rem 0 0;
  color: #f2edde;
  font-family: var(--serif);
  font-size: clamp(2.6rem, 6vw, 5.2rem);
  font-weight: 500;
  letter-spacing: -.04em;
  line-height: 1.08;
  text-wrap: balance;
}

.discovery-heading > p {
  margin: 0 0 .5rem;
  color: var(--muted);
  font-size: .96rem;
  line-height: 1.85;
}

.discovery-layout {
  display: grid;
  grid-template-columns: minmax(320px, .85fr) minmax(0, 1.15fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.discovery-feature,
.discovery-row,
.discovery-note {
  color: inherit;
  background-color: rgba(13, 17, 34, .93);
}

.discovery-feature {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 650px;
  padding: clamp(2rem, 5vw, 3.75rem);
  text-decoration: none;
  transition: background-color .3s ease;
}

.discovery-feature::before {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 90% 14%, rgba(211, 184, 119, .15), transparent 38%);
  content: "";
  pointer-events: none;
}

.discovery-feature:hover {
  background-color: #11162b;
  text-decoration: none;
}

.discovery-number {
  position: relative;
  color: var(--gold);
  font-family: var(--serif);
  font-size: .72rem;
  letter-spacing: .15em;
}

.discovery-feature > div {
  position: relative;
  align-self: center;
}

.discovery-card-kicker {
  margin: 0 0 1rem;
  color: var(--gold);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.discovery-feature h3,
.discovery-row h3,
.discovery-note h3 {
  color: #f1e7c7;
  font-family: var(--serif);
  font-weight: 500;
}

.discovery-feature h3 {
  max-width: 470px;
  margin: 0 0 1.2rem;
  font-size: clamp(2.35rem, 5vw, 4.25rem);
  line-height: 1.12;
}

.discovery-feature p:not(.discovery-card-kicker) {
  position: relative;
  max-width: 500px;
  margin: 0;
  color: var(--muted);
  line-height: 1.85;
}

.discovery-feature > strong {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.1rem;
  color: var(--gold);
  border-top: 1px solid rgba(211, 184, 119, .36);
  font-size: .78rem;
}

.discovery-feature > strong i {
  font-size: 1.1rem;
  font-style: normal;
}

.discovery-orbit {
  position: absolute;
  right: -90px;
  top: -75px;
  width: 260px;
  height: 260px;
  border: 1px solid rgba(211, 184, 119, .22);
  border-radius: 50%;
  pointer-events: none;
  transition: transform .9s cubic-bezier(.2, .7, .2, 1);
}

.discovery-feature:hover .discovery-orbit {
  transform: rotate(22deg);
}

.discovery-orbit::after {
  position: absolute;
  inset: 26%;
  border: 1px solid rgba(141, 147, 173, .22);
  border-radius: 50%;
  content: "";
}

.discovery-orbit i {
  position: absolute;
  color: var(--gold);
  font-style: normal;
}

.discovery-orbit i:first-child {
  left: 10%;
  top: 53%;
}

.discovery-orbit i:last-child {
  bottom: 12%;
  right: 28%;
}

.discovery-list {
  display: grid;
  gap: 1px;
  background: var(--line);
}

.discovery-row,
.discovery-note {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: start;
  gap: clamp(1rem, 3vw, 2rem);
  min-height: 184px;
  padding: clamp(1.7rem, 4vw, 2.6rem);
}

.discovery-row {
  text-decoration: none;
  transition: background-color .25s ease;
}

.discovery-row:hover {
  background-color: #11162b;
  text-decoration: none;
}

.discovery-row h3,
.discovery-note h3 {
  margin: 0 0 .55rem;
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  line-height: 1.3;
}

.discovery-row p,
.discovery-note p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: .85rem;
  line-height: 1.75;
}

.discovery-row strong {
  display: inline-block;
  margin-top: 1rem;
  color: var(--gold);
  font-size: .72rem;
}

.discovery-row > i {
  align-self: center;
  color: var(--gold);
  font-style: normal;
  transition: transform .25s ease;
}

.discovery-row:hover > i {
  transform: translateX(5px);
}

.discovery-note {
  grid-template-columns: 44px minmax(0, 1fr);
}

@media (max-width: 840px) {
  .discovery-heading,
  .discovery-layout {
    grid-template-columns: 1fr;
  }

  .discovery-heading {
    gap: 1.5rem;
  }

  .discovery-feature {
    min-height: 540px;
  }
}

@media (max-width: 560px) {
  .product-discovery {
    margin-top: 5rem;
    padding-top: 4rem;
  }

  .discovery-heading h2 {
    font-size: clamp(2.5rem, 12vw, 3.7rem);
  }

  .discovery-feature {
    min-height: 500px;
    padding: 1.65rem;
  }

  .discovery-row,
  .discovery-note {
    grid-template-columns: 32px minmax(0, 1fr);
    padding: 1.5rem;
  }

  .discovery-row > i {
    display: none;
  }
}
