:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: rgba(255, 255, 255, 0.075);
  --panel-strong: rgba(255, 255, 255, 0.12);
  --text: #f7f1e5;
  --muted: #b9b2a7;
  --line: rgba(255, 255, 255, 0.16);
  --gold: #d9b46f;
  --coral: #e2775f;
  --teal: #76c8bd;
  --ink: #17191d;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  overflow: hidden;
}

body {
  display: grid;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  padding: 1rem;
  color: var(--text);
  font-family: Inter, "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 18% 16%, rgba(226, 119, 95, 0.16), transparent 28rem),
    radial-gradient(circle at 76% 20%, rgba(118, 200, 189, 0.16), transparent 30rem),
    linear-gradient(135deg, #111217 0%, #202027 52%, #161718 100%);
}

.starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

button,
input {
  font: inherit;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 42rem);
  justify-content: center;
  gap: 1.25rem;
  width: min(1160px, 100%);
  height: calc(100dvh - 2rem);
  min-height: 0;
  margin: auto;
}

.app-shell.has-reading {
  grid-template-columns: minmax(0, 1.02fr) minmax(22rem, 0.98fr);
  justify-content: stretch;
}

.hero,
.result-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.hero {
  display: flex;
  align-items: center;
  min-height: 0;
  padding: clamp(1.5rem, 4vw, 4rem);
}

.app-shell:not(.has-reading) .hero {
  min-height: min(42rem, calc(100dvh - 2rem));
}

.sky {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.star,
.orbit {
  position: absolute;
  display: block;
}

.star {
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 0 22px rgba(255, 244, 214, 0.8);
}

.star-a {
  top: 18%;
  left: 18%;
}

.star-b {
  top: 28%;
  right: 20%;
  background: var(--gold);
}

.star-c {
  right: 34%;
  bottom: 22%;
  background: var(--teal);
}

.star-d {
  left: 25%;
  bottom: 18%;
  background: var(--coral);
}

.orbit {
  width: 32rem;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 50%;
  transform: rotate(-18deg);
}

.orbit-one {
  top: 12%;
  right: -14rem;
}

.orbit-two {
  left: -17rem;
  bottom: -11rem;
}

.hero-content {
  position: relative;
  width: min(100%, 34rem);
}

.eyebrow,
.sign-date {
  margin: 0 0 0.7rem;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

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

h1,
h2 {
  font-family: "Noto Serif SC", "Microsoft YaHei", serif;
}

h1 {
  margin-bottom: 1rem;
  font-size: clamp(3rem, 8vw, 6.6rem);
  line-height: 0.98;
}

.lead {
  max-width: 31rem;
  margin-bottom: 2.25rem;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.85;
}

.birth-form {
  width: min(100%, 34rem);
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: rgba(16, 17, 20, 0.46);
}

.birth-form label {
  display: block;
  margin-bottom: 0.7rem;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
}

.calendar-switch {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
  margin: 0 0 0.9rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.calendar-switch legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.calendar-switch label {
  margin: 0;
  color: var(--muted);
  cursor: pointer;
}

.calendar-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.calendar-switch span {
  display: grid;
  min-width: 4.6rem;
  min-height: 2.2rem;
  place-items: center;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 800;
}

.calendar-switch input:checked + span {
  color: var(--ink);
  background: linear-gradient(135deg, var(--gold), #f1d59d);
}

.calendar-switch input:focus-visible + span {
  outline: 2px solid rgba(217, 180, 111, 0.9);
  outline-offset: 2px;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.7rem;
}

input[type="date"] {
  min-width: 0;
  height: 3.1rem;
  padding: 0 0.9rem;
  border: 1px solid var(--line);
  border-radius: 0.42rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

input[type="date"]:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(217, 180, 111, 0.16);
}

button {
  min-height: 3.1rem;
  padding: 0 1.2rem;
  border: 0;
  border-radius: 0.42rem;
  color: var(--ink);
  font-weight: 800;
  background: linear-gradient(135deg, var(--gold), #f1d59d);
  cursor: pointer;
}

button:hover {
  filter: brightness(1.05);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  filter: none;
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

.icon-button {
  display: grid;
  width: 2.5rem;
  min-height: 2.5rem;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 1.55rem;
  line-height: 1;
  background: rgba(255, 255, 255, 0.07);
}

.form-note {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.wide-action {
  width: 100%;
  margin-top: 0.7rem;
}

.form-note.is-error {
  color: #ffb0a0;
}

.result-panel {
  display: flex;
  min-height: 0;
  padding: clamp(1.25rem, 3vw, 2rem);
}

.reading {
  width: 100%;
  align-self: center;
}

.reading.is-summary .reading-header,
.reading.is-summary .keywords,
.reading.is-summary .reading-actions {
  display: none;
}

.reading.is-summary {
  align-self: stretch;
  display: flex;
  align-items: center;
}

.reading.is-summary .summary-grid {
  width: 100%;
  gap: 0.55rem;
}

.reading.is-summary .summary-grid section {
  padding: 0.68rem 0.85rem;
}

.reading.is-summary .summary-grid h3 {
  margin-bottom: 0.3rem;
  font-size: 0.88rem;
}

.reading.is-summary .summary-grid p {
  font-size: 0.92rem;
  line-height: 1.48;
}

.reading.is-summary .summary-grid > button {
  min-height: 2.35rem;
}

.hidden {
  display: none !important;
}

.reading-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.4rem;
}

.reading-header h2 {
  margin-bottom: 0;
  font-size: clamp(2.2rem, 5vw, 4rem);
  line-height: 1.08;
}

.sign-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: clamp(4.5rem, 12vw, 6.5rem);
  aspect-ratio: 1;
  border: 1px solid rgba(217, 180, 111, 0.55);
  border-radius: 50%;
  color: var(--gold);
  font-size: clamp(2.3rem, 6vw, 3.8rem);
  background: rgba(217, 180, 111, 0.08);
}

.keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.keywords span {
  padding: 0.46rem 0.68rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #f7e7bf;
  background: rgba(255, 255, 255, 0.07);
  font-size: 0.88rem;
  font-weight: 700;
}

.reading-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.45rem;
  margin-bottom: 0.9rem;
}

.reading-actions button {
  min-height: 2.35rem;
  padding-inline: 0.4rem;
  font-size: 0.86rem;
}

.mobile-more-button {
  display: none;
}

.reading-story {
  display: grid;
  min-height: 23rem;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 0.85rem;
}

.story-count {
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.story-card {
  display: flex;
  min-height: 15rem;
  flex-direction: column;
  justify-content: center;
  padding: clamp(1.1rem, 3vw, 1.7rem);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background:
    radial-gradient(circle at 88% 14%, rgba(217, 180, 111, 0.13), transparent 11rem),
    rgba(255, 255, 255, 0.055);
}

.story-card.is-changing {
  animation: story-in 360ms ease both;
}

.story-kicker {
  margin-bottom: 0.7rem;
  color: var(--gold);
  font-size: 0.86rem;
  font-weight: 900;
}

.story-card h3 {
  margin-bottom: 0.9rem;
  color: var(--text);
  font-family: "Noto Serif SC", "Microsoft YaHei", serif;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.1;
}

.story-card p:last-child {
  margin-bottom: 0;
  color: #ddd6ca;
  font-size: 1.06rem;
  line-height: 1.85;
}

.story-dots {
  display: flex;
  gap: 0.45rem;
}

.story-dots span {
  display: block;
  width: 100%;
  height: 0.28rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
}

.story-dots span.is-active {
  background: var(--gold);
}

.story-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.story-nav button {
  min-height: 2.55rem;
}

.summary-grid {
  display: grid;
  gap: 0.85rem;
}

.summary-grid section {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.055);
}

.summary-grid h3 {
  margin-bottom: 0.52rem;
  color: var(--gold);
  font-size: 0.96rem;
}

.summary-grid p {
  margin-bottom: 0;
  color: #ddd6ca;
  line-height: 1.78;
}

.summary-grid > button {
  width: 100%;
  min-height: 2.55rem;
}

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

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

.share-modal {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(10, 11, 14, 0.72);
  backdrop-filter: blur(18px);
}

.share-dialog {
  width: min(24rem, 100%);
  max-height: calc(100dvh - 2rem);
  overflow: auto;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: rgba(28, 30, 35, 0.96);
  box-shadow: var(--shadow);
}

.share-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.share-dialog-header h2 {
  margin: 0;
  font-size: 1.75rem;
}

.share-preview {
  display: block;
  width: 100%;
  max-height: min(58dvh, 34rem);
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: #15171b;
  object-fit: contain;
}

.share-dialog > button {
  width: 100%;
}

.share-modal.hidden {
  display: none;
}

.mobile-action-list {
  display: grid;
  gap: 0.7rem;
}

.mobile-action-list button {
  width: 100%;
}

.energy-dialog {
  width: min(25rem, 100%);
}

.energy-card {
  position: relative;
  overflow: hidden;
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background:
    radial-gradient(circle at 80% 16%, rgba(217, 180, 111, 0.18), transparent 9rem),
    linear-gradient(145deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.035));
}

.energy-date {
  margin-bottom: 0.7rem;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.energy-symbol {
  display: grid;
  width: 4.2rem;
  aspect-ratio: 1;
  margin-bottom: 1rem;
  place-items: center;
  border: 1px solid rgba(217, 180, 111, 0.55);
  border-radius: 50%;
  color: var(--gold);
  font-size: 2.4rem;
  background: rgba(217, 180, 111, 0.08);
}

.energy-card h3 {
  margin-bottom: 0.75rem;
  color: var(--text);
  font-family: "Noto Serif SC", "Microsoft YaHei", serif;
  font-size: 2.2rem;
  line-height: 1.1;
}

.energy-message {
  margin-bottom: 1rem;
  color: #ddd6ca;
  line-height: 1.8;
}

.energy-grid {
  display: grid;
  gap: 0.7rem;
}

.energy-grid div {
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.055);
}

.energy-grid span {
  display: block;
  margin-bottom: 0.28rem;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 800;
}

.energy-grid strong {
  color: var(--text);
  font-size: 1rem;
}

.relationship-dialog {
  width: min(31rem, 100%);
}

.relationship-form {
  display: grid;
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.relationship-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.relationship-fields label {
  display: grid;
  gap: 0.45rem;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 800;
}

.compact-switch {
  margin-bottom: 0;
}

.relationship-form button {
  width: 100%;
}

.relationship-result {
  padding-top: 0.2rem;
}

.relationship-pair {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.7rem;
  color: var(--gold);
  font-weight: 900;
}

.relationship-pair strong {
  color: var(--text);
}

.relationship-result h3 {
  margin-bottom: 1.1rem;
  color: var(--text);
  font-family: "Noto Serif SC", "Microsoft YaHei", serif;
  font-size: 2rem;
  line-height: 1.12;
}

.relationship-result .energy-grid {
  gap: 0.95rem;
}

.relationship-result .energy-grid div {
  padding: 0 0 0.95rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.relationship-result .energy-grid div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.relationship-result .energy-grid strong {
  display: block;
  color: #ddd6ca;
  font-weight: 700;
  line-height: 1.65;
}

.monthly-dialog {
  width: min(34rem, 100%);
}

.monthly-report {
  display: grid;
  gap: 1rem;
}

.monthly-hero {
  position: relative;
  overflow: hidden;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background:
    radial-gradient(circle at 85% 20%, rgba(118, 200, 189, 0.16), transparent 9rem),
    rgba(255, 255, 255, 0.055);
}

.monthly-hero p {
  margin-bottom: 0.7rem;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.monthly-symbol {
  display: grid;
  width: 4rem;
  aspect-ratio: 1;
  margin-bottom: 0.9rem;
  place-items: center;
  border: 1px solid rgba(217, 180, 111, 0.55);
  border-radius: 50%;
  color: var(--gold);
  font-size: 2.2rem;
  background: rgba(217, 180, 111, 0.08);
}

.monthly-hero h3 {
  margin-bottom: 0.45rem;
  color: var(--text);
  font-family: "Noto Serif SC", "Microsoft YaHei", serif;
  font-size: 2.35rem;
  line-height: 1.08;
}

.monthly-hero strong {
  color: #f7e7bf;
  font-size: 1rem;
}

.monthly-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.monthly-grid section {
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.055);
}

.monthly-grid span {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--gold);
  font-size: 0.84rem;
  font-weight: 900;
}

.monthly-grid p {
  margin-bottom: 0;
  color: #ddd6ca;
  line-height: 1.65;
}

@media (max-width: 860px) {
  html,
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100dvh - 2rem);
  }

  .app-shell.has-reading {
    grid-template-columns: 1fr;
  }

  .hero,
  .result-panel {
    min-height: auto;
  }

  .hero {
    padding-top: 4rem;
    padding-bottom: 4rem;
  }

  .app-shell.has-reading .hero {
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  .app-shell.has-reading .result-panel {
    order: -1;
  }

  .app-shell.has-reading .eyebrow,
  .app-shell.has-reading .lead {
    display: none;
  }

  .app-shell.has-reading h1 {
    margin-bottom: 1rem;
    font-size: 2.25rem;
    line-height: 1.05;
  }
}

@media (max-width: 560px) {
  body {
    padding: 0.5rem;
  }

  .app-shell {
    width: 100%;
    min-height: calc(100dvh - 1rem);
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  button {
    width: 100%;
  }

  .reading-header {
    align-items: flex-start;
  }

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

  .reading-actions #preview-card,
  .reading-actions #daily-energy,
  .reading-actions #open-relationship-result,
  .reading-actions #monthly-report {
    display: none;
  }

  .reading-actions #download-card,
  .reading-actions .mobile-more-button {
    display: block;
  }

  .share-modal {
    align-items: end;
    padding: 0;
  }

  .share-dialog {
    width: 100%;
    max-height: min(86dvh, 44rem);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 0.75rem 0.75rem 0 0;
  }

  .relationship-fields {
    grid-template-columns: 1fr;
  }

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