.bio-page {
  width: min(100% - 40px, var(--max));
  margin: 0 auto;
}

.bio-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  padding: 52px 0 34px;
}

.bio-hero > div {
  min-width: 0;
}

.bio-hero h1 {
  max-width: 12ch;
  margin-bottom: 18px;
  font-size: clamp(3.2rem, 8vw, 6.6rem);
  font-weight: 760;
  line-height: 0.9;
}

.bio-hero .lede {
  max-width: 720px;
  margin-bottom: 0;
}

.back-link {
  flex: 0 0 auto;
  margin-bottom: 24px;
  color: var(--mint-dark);
  font-weight: 800;
  border-bottom: 1px solid rgba(14, 114, 95, 0.35);
}

.bio-workbench {
  display: grid;
  grid-template-columns: minmax(290px, 0.68fr) minmax(0, 1.55fr);
  gap: 20px;
  align-items: start;
  padding: 18px 0 84px;
}

.bio-panel,
.cycle-card,
.reading-guide,
.bio-notice {
  border: 1px solid rgba(14, 114, 95, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.48);
  box-shadow: 0 14px 36px rgba(29, 42, 38, 0.08);
}

.bio-panel {
  padding: clamp(20px, 2.7vw, 30px);
}

.bio-controls {
  position: sticky;
  top: 18px;
}

.panel-heading {
  margin-bottom: 28px;
}

.panel-heading h2,
.chart-heading h2,
.bio-information h2 {
  margin-bottom: 10px;
  font-size: clamp(1.45rem, 2.3vw, 2.05rem);
  line-height: 1.05;
}

.panel-heading > p:last-child,
.chart-heading > p,
.chart-note,
.section-heading > p:last-child,
.cycle-card p,
.reading-guide p,
.bio-notice p,
.license-note {
  color: var(--muted);
}

.panel-heading > p:last-child,
.chart-heading > p,
.chart-note {
  margin-bottom: 0;
  font-size: 0.94rem;
}

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

.bio-controls legend,
.bio-controls label > span,
.control-caption {
  display: block;
  margin-bottom: 9px;
  color: var(--mint-dark);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

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

.bio-controls label {
  min-width: 0;
}

.bio-controls select {
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1.25 7 7.25 13 1.25' fill='none' stroke='%230e725f' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  width: 100%;
  min-height: 48px;
  appearance: none;
  border: 1px solid rgba(14, 114, 95, 0.24);
  border-radius: 7px;
  padding: 10px 48px 10px 12px;
  background-color: rgba(255, 255, 255, 0.62);
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right 20px center;
  background-size: 14px 9px;
  color: #183c34;
  font: inherit;
  font-weight: 700;
}

.bio-controls select:focus,
.bio-controls button:focus-visible,
.share-block a:focus-visible {
  outline: 3px solid rgba(82, 189, 168, 0.45);
  outline-offset: 3px;
}

.span-control {
  display: block;
  margin-top: 22px;
}

.base-date,
.share-block {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid rgba(14, 114, 95, 0.16);
}

.base-date {
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.base-date .control-caption {
  margin-bottom: 3px;
}

.base-date strong {
  color: #183c34;
}

.base-date button {
  min-height: 40px;
  flex: 0 0 auto;
  border: 1px solid rgba(14, 114, 95, 0.3);
  border-radius: 6px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--mint-dark);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.base-date button:hover {
  border-color: var(--mint-dark);
}

.share-block a {
  display: block;
  color: var(--mint-dark);
  font-weight: 720;
}

#shared {
  overflow-wrap: anywhere;
  font-size: 0.87rem;
}

.share-open {
  width: fit-content;
  margin-top: 12px;
  border-bottom: 1px solid rgba(14, 114, 95, 0.28);
  font-size: 0.92rem;
}

.chart-panel {
  min-width: 0;
}

.chart-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.chart-heading > p {
  flex: 0 0 auto;
  margin-bottom: 12px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 18px;
  margin: 24px 0 16px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #365b52;
  font-size: 0.82rem;
  font-weight: 780;
}

.legend-item i {
  width: 20px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
}

.legend-item.physical {
  color: #0d8b70;
}

.legend-item.emotional {
  color: #b6544c;
}

.legend-item.intellectual {
  color: #526ccf;
}

.legend-item.total {
  color: #a96711;
}

.legend-item.astral {
  color: #8f6b25;
}

.legend-item.astral i {
  height: 8px;
  background: rgba(168, 121, 42, 0.28);
}

.graph-frame {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(14, 114, 95, 0.2);
  border-radius: 8px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.78), rgba(249, 253, 251, 0.78)),
    linear-gradient(135deg, rgba(82, 189, 168, 0.08), transparent 55%);
}

#graph {
  width: 100%;
  min-height: 320px;
}

.chart-note {
  margin-top: 14px;
  text-align: center;
}

.cycle-section {
  padding: 0 0 84px;
}

.section-heading {
  max-width: 760px;
  margin: 0 auto 30px;
  text-align: center;
}

.section-heading h2 {
  margin-bottom: 14px;
  font-size: clamp(2.2rem, 5vw, 4.4rem);
  font-weight: 760;
  line-height: 0.96;
}

.section-heading > p:last-child {
  max-width: 660px;
  margin-right: auto;
  margin-bottom: 0;
  margin-left: auto;
}

.cycle-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.cycle-card {
  position: relative;
  min-height: 240px;
  overflow: hidden;
  padding: 24px;
}

.cycle-card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: var(--cycle-color);
}

.physical-card {
  --cycle-color: #0d8b70;
}

.emotional-card {
  --cycle-color: #b6544c;
}

.intellectual-card {
  --cycle-color: #526ccf;
}

.total-card {
  --cycle-color: #a96711;
}

.cycle-number {
  color: var(--cycle-color);
  font-size: 0.8rem;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.cycle-card h3 {
  margin: 42px 0 12px;
  font-size: clamp(1.5rem, 2.5vw, 2.15rem);
  line-height: 1;
}

.cycle-card p {
  margin-bottom: 0;
  font-size: 0.96rem;
}

.bio-information {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 18px;
  align-items: stretch;
}

.reading-guide,
.bio-notice {
  padding: clamp(24px, 4vw, 42px);
}

.reading-guide {
  display: flex;
  flex-direction: column;
}

.reading-guide h2,
.bio-notice h2 {
  margin-bottom: 22px;
}

.reading-guide p:last-child,
.bio-notice p:last-child {
  margin-bottom: 0;
}

.reading-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: space-between;
  gap: 22px;
}

.reading-copy > p {
  font-size: clamp(1.12rem, 1.55vw, 1.25rem);
  line-height: 1.75;
}

.reading-copy > p:last-child {
  margin-bottom: 0;
}

.reading-guide strong {
  color: var(--mint-dark);
}

.notice-stack {
  display: grid;
  gap: 18px;
}

.privacy-notice {
  background: rgba(194, 239, 223, 0.48);
}

.license-note {
  margin: 26px auto 72px;
  text-align: center;
  font-size: 0.9rem;
}

html[data-theme="dark"] .bio-panel,
html[data-theme="dark"] .cycle-card,
html[data-theme="dark"] .reading-guide,
html[data-theme="dark"] .bio-notice {
  border-color: rgba(82, 189, 168, 0.22);
  background: rgba(42, 48, 46, 0.52);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.2);
}

html[data-theme="dark"] .bio-controls select,
html[data-theme="dark"] .base-date button {
  border-color: rgba(82, 189, 168, 0.26);
  background: rgba(23, 31, 28, 0.76);
  color: var(--ink);
}

html[data-theme="dark"] .bio-controls select {
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1.25 7 7.25 13 1.25' fill='none' stroke='%23d9fff5' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right 20px center;
  background-size: 14px 9px;
}

html[data-theme="dark"] .base-date,
html[data-theme="dark"] .share-block {
  border-top-color: rgba(82, 189, 168, 0.18);
}

html[data-theme="dark"] .base-date strong,
html[data-theme="dark"] .legend-item {
  color: var(--ink);
}

html[data-theme="dark"] .legend-item.physical {
  color: #54c7a8;
}

html[data-theme="dark"] .legend-item.emotional {
  color: #e38c82;
}

html[data-theme="dark"] .legend-item.intellectual {
  color: #8aa9ff;
}

html[data-theme="dark"] .legend-item.total {
  color: #d4ad58;
}

html[data-theme="dark"] .legend-item.astral {
  color: #e0c178;
}

html[data-theme="dark"] .legend-item.astral i {
  background: rgba(212, 179, 109, 0.3);
}

html[data-theme="dark"] .graph-frame {
  border-color: rgba(82, 189, 168, 0.22);
  background:
    linear-gradient(rgba(27, 34, 32, 0.94), rgba(27, 34, 32, 0.94)),
    linear-gradient(135deg, rgba(82, 189, 168, 0.12), transparent 55%);
}

html[data-theme="dark"] .privacy-notice {
  background: rgba(15, 58, 49, 0.42);
}

@media (max-width: 980px) {
  .bio-workbench,
  .bio-information {
    grid-template-columns: 1fr;
  }

  .bio-controls {
    position: static;
  }

  .cycle-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 561px) and (max-width: 1024px) {
  .bio-hero {
    align-items: center;
    flex-direction: column;
    text-align: center;
  }

  .bio-hero > div {
    display: grid;
    justify-items: center;
  }

  .bio-hero .lede {
    margin-right: auto;
    margin-left: auto;
  }

  .back-link {
    margin-bottom: 0;
  }
}

@media (max-width: 620px) {
  .bio-page {
    width: min(100% - 28px, var(--max));
  }

  .bio-hero {
    align-items: flex-start;
    flex-direction: column;
    padding-top: 38px;
  }

  .bio-hero h1 {
    font-size: clamp(3rem, 16vw, 5rem);
  }

  .back-link {
    margin-bottom: 0;
  }

  .birth-grid,
  .cycle-grid {
    grid-template-columns: 1fr;
  }

  .chart-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 0;
  }

  .chart-heading > p {
    margin-bottom: 0;
  }

  .chart-legend {
    gap: 9px 14px;
  }

  #graph {
    min-height: 260px;
  }

  .cycle-card {
    min-height: 210px;
  }
}
