:root {
  --ink: #4d3b2b;
  --soft-ink: #765d42;
  --paper: #fff8e8;
  --paper-deep: #f4dfb8;
  --mint: #bfe6d6;
  --aqua: #dff7f0;
  --rose: #f5d7c8;
  --gold: #b78733;
  --blue: #497bb0;
  --shadow: rgba(75, 50, 22, 0.18);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family:
    "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", Georgia, serif;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.92) 0 5%, transparent 13%),
    linear-gradient(135deg, #f9d9c6 0%, #fff8e8 38%, #d8f3eb 100%);
}

button,
input,
select {
  font: inherit;
}

.storybook-shell {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0;
}

.hero-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(220px, 36%) 1fr;
  gap: 28px;
  min-height: min(760px, calc(100vh - 56px));
  padding: clamp(18px, 4vw, 42px);
  overflow: hidden;
  border: 2px solid rgba(183, 135, 51, 0.55);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 248, 232, 0.9), rgba(223, 247, 240, 0.82)),
    repeating-linear-gradient(45deg, rgba(183, 135, 51, 0.06) 0 1px, transparent 1px 16px);
  box-shadow: 0 20px 60px var(--shadow);
}

.hero-panel::before,
.hero-panel::after {
  position: absolute;
  z-index: 0;
  color: rgba(183, 135, 51, 0.72);
  font-size: clamp(58px, 10vw, 110px);
  line-height: 1;
}

.hero-panel::before {
  content: "✦";
  top: 16px;
  right: 34px;
}

.hero-panel::after {
  content: "☾";
  right: 56px;
  bottom: 24px;
}

.portrait-wrap,
.reading-panel,
.results {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.portrait-wrap {
  display: grid;
  place-items: center;
  align-self: center;
}

.prince-portrait {
  width: min(100%, 380px);
  aspect-ratio: 1;
  object-fit: cover;
  border: 2px solid rgba(183, 135, 51, 0.62);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 18px 42px rgba(91, 58, 26, 0.18);
}

.reading-panel {
  align-self: center;
  padding: clamp(8px, 2vw, 18px);
}

.kicker {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

h1 {
  max-width: 12em;
  margin: 0;
  font-size: clamp(2.05rem, 5.2vw, 4.25rem);
  line-height: 1.12;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.lead {
  max-width: 34rem;
  margin: 22px 0 30px;
  color: var(--soft-ink);
  font-size: clamp(1rem, 2.2vw, 1.22rem);
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.birth-form {
  display: grid;
  gap: 14px;
  max-width: 560px;
  min-width: 0;
}

.birth-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.birth-fieldset legend {
  display: block;
  margin: 0 0 9px;
  color: var(--soft-ink);
  font-size: 0.95rem;
  font-weight: 700;
}

.date-row {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 0.9fr;
  gap: 10px;
  align-items: end;
}

.time-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.select-label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--soft-ink);
  font-size: 0.82rem;
  font-weight: 700;
}

select {
  min-width: 0;
  height: 54px;
  width: 100%;
  padding: 0 34px 0 14px;
  color: var(--ink);
  border: 1px solid rgba(183, 135, 51, 0.58);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  outline: none;
  cursor: pointer;
}

select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(73, 123, 176, 0.18);
}

select:disabled {
  color: rgba(77, 59, 43, 0.48);
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.42);
}

select:invalid {
  color: rgba(77, 59, 43, 0.55);
}

.time-help {
  margin: 11px 0 7px;
  color: var(--soft-ink);
  font-size: 0.82rem;
  font-weight: 700;
}

.approx-time-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.time-chip {
  min-width: 0;
}

.time-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.time-chip span {
  display: grid;
  min-height: 42px;
  place-items: center;
  padding: 8px 10px;
  color: var(--soft-ink);
  border: 1px solid rgba(183, 135, 51, 0.48);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.54);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
}

.time-chip input:focus-visible + span {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(73, 123, 176, 0.18);
}

.time-chip input:checked + span {
  color: #fffaf0;
  border-color: rgba(154, 109, 37, 0.82);
  background: linear-gradient(180deg, #c7994b, #9a6d25);
  box-shadow: 0 8px 18px rgba(154, 109, 37, 0.15);
}

.approx-time-row.is-disabled {
  opacity: 0.46;
}

.approx-time-row.is-disabled .time-chip span {
  cursor: not-allowed;
}

.place-note {
  margin: 10px 0 0;
  color: #80694d;
  font-size: 0.88rem;
  line-height: 1.6;
}

.primary-action,
.secondary-action {
  height: 54px;
  padding: 0 22px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.primary-action {
  color: rgba(255, 250, 240, 0.68);
  background: linear-gradient(180deg, #cdbd9b, #ab9873);
  box-shadow: none;
  cursor: not-allowed;
}

.primary-action.is-ready {
  color: #fffaf0;
  background: linear-gradient(180deg, #e4b75c, #a87522);
  box-shadow:
    0 0 0 4px rgba(228, 183, 92, 0.18),
    0 12px 28px rgba(154, 109, 37, 0.28);
  cursor: pointer;
  animation: readyGlow 1.8s ease-in-out infinite;
}

.primary-action.is-ready:hover {
  filter: brightness(1.04);
}

.secondary-action {
  color: var(--soft-ink);
  border: 1px solid rgba(183, 135, 51, 0.5);
  background: rgba(255, 255, 255, 0.58);
}

@keyframes readyGlow {
  0%,
  100% {
    box-shadow:
      0 0 0 4px rgba(228, 183, 92, 0.14),
      0 12px 28px rgba(154, 109, 37, 0.24);
  }

  50% {
    box-shadow:
      0 0 0 7px rgba(228, 183, 92, 0.24),
      0 16px 34px rgba(154, 109, 37, 0.34);
  }
}

.tiny-note {
  max-width: 560px;
  margin: 14px 0 0;
  color: #80694d;
  font-size: 0.88rem;
  line-height: 1.65;
}

.results {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.result-screen {
  min-height: calc(100vh - 56px);
  padding: clamp(18px, 4vw, 42px);
  border: 2px solid rgba(183, 135, 51, 0.55);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 248, 232, 0.92), rgba(223, 247, 240, 0.86)),
    repeating-linear-gradient(45deg, rgba(183, 135, 51, 0.06) 0 1px, transparent 1px 16px);
  box-shadow: 0 20px 60px var(--shadow);
}

.result-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.result-header h2 {
  margin: 0;
  font-size: clamp(2.3rem, 5vw, 4.2rem);
  line-height: 1.08;
}

.result-summary {
  margin: 12px 0 0;
  color: var(--soft-ink);
  line-height: 1.7;
}

.empty-state,
.star-card {
  min-height: 190px;
  border: 1px solid rgba(183, 135, 51, 0.45);
  border-radius: 8px;
  background: rgba(255, 248, 232, 0.88);
  box-shadow: 0 12px 28px rgba(91, 58, 26, 0.11);
}

.empty-state {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  padding: 32px;
  text-align: center;
  color: var(--soft-ink);
}

.empty-moon {
  color: var(--gold);
  font-size: 2.8rem;
}

.star-card {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 10px;
  padding: 20px;
  overflow: hidden;
}

.star-card[data-body="sun"] {
  background: linear-gradient(160deg, rgba(255, 248, 232, 0.94), rgba(245, 215, 200, 0.78));
}

.star-card[data-body="moon"] {
  background: linear-gradient(160deg, rgba(255, 248, 232, 0.94), rgba(223, 247, 240, 0.82));
}

.star-card[data-body="venus"] {
  background: linear-gradient(160deg, rgba(255, 248, 232, 0.94), rgba(212, 225, 247, 0.76));
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.planet-name {
  margin: 0;
  color: var(--soft-ink);
  font-size: 0.92rem;
  font-weight: 700;
}

.planet-mark {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  place-items: center;
  color: var(--blue);
  border: 1px solid rgba(183, 135, 51, 0.42);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  font-size: 1.45rem;
}

.sign-name {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  line-height: 1.15;
}

.degree {
  margin: -2px 0 0;
  color: var(--gold);
  font-size: 0.92rem;
  font-weight: 700;
}

.card-copy {
  margin: 0;
  color: var(--soft-ink);
  font-size: 0.98rem;
  line-height: 1.75;
}

@media (max-width: 820px) {
  .hero-panel {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .portrait-wrap {
    order: -1;
  }

  .prince-portrait {
    width: min(64vw, 300px);
  }

  h1 {
    max-width: 10em;
  }

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

  .result-header {
    align-items: start;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .storybook-shell {
    width: min(100% - 18px, 1120px);
    padding: 9px 0;
  }

  .hero-panel {
    padding: 16px;
  }

  .prince-portrait {
    width: min(100%, 250px);
  }

  h1 {
    max-width: 9em;
    font-size: clamp(1.65rem, 7vw, 2rem);
    line-height: 1.08;
  }

  .lead {
    max-width: 300px;
    font-size: 0.98rem;
    word-break: break-all;
  }

  .tiny-note {
    max-width: 300px;
    word-break: break-all;
  }

  .place-note {
    max-width: 300px;
  }

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

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

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

  .date-row .select-label:first-child,
  .primary-action,
  .secondary-action {
    grid-column: 1 / -1;
  }

  .primary-action,
  .secondary-action,
  select {
    width: 100%;
  }
}
