@import url("https://fonts.googleapis.com/css2?family=Kiwi+Maru:wght@400;500&family=Noto+Sans+JP:wght@400;500;600&display=swap");

:root {
  /* Keep public SEO pages on the same semantic type scale as the React app. */
  --font-size-meta: 14px;
  --font-size-caption: 15px;
  --font-size-control: 16px;
  --font-size-body: 17px;
  --font-size-body-large: 18px;
  --font-size-card-title: 21px;
  --font-size-section-title: 25px;
  --font-size-page-title: clamp(29px, 7vw, 34px);
  --line-height-control: 1.35;
  --line-height-heading: 1.35;
  --line-height-body: 1.65;
  --ink: #44394e;
  --muted: #8d8294;
  --purple: #9c7caf;
  --deep-purple: #715981;
  --surface: rgba(255, 253, 255, 0.72);
  --line: rgba(112, 83, 126, 0.1);
  --shadow: 0 18px 50px rgba(91, 66, 103, 0.1);
  color: var(--ink);
  background: #eee8f1;
  font-family: "Noto Sans JP", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  position: relative;
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
  background:
    radial-gradient(circle at 86% 7%, rgba(220, 194, 232, 0.5), transparent 26rem),
    radial-gradient(circle at 7% 48%, rgba(244, 217, 199, 0.42), transparent 22rem),
    linear-gradient(160deg, #faf7fb 0%, #f5eff8 48%, #f9f6f4 100%);
  background-attachment: fixed;
}

a {
  color: inherit;
}

main {
  width: min(960px, calc(100% - 40px));
  margin-inline: auto;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-family: "Kiwi Maru", serif;
  text-decoration: none;
}

.site-brand span {
  color: #b28fc2;
}

main {
  padding-block: 42px 88px;
}

.page-hero {
  max-width: 820px;
  padding: clamp(44px, 9vw, 92px) 0;
}

.eyebrow {
  display: block;
  margin-bottom: 12px;
  color: #9573a5;
  font-size: var(--font-size-caption);
  font-weight: 700;
  letter-spacing: 0.17em;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  color: var(--ink);
  font-family: "Kiwi Maru", serif;
  font-size: var(--font-size-page-title);
  font-weight: 500;
  letter-spacing: 0.015em;
  line-height: var(--line-height-heading);
}

h2 {
  margin: 0 0 22px;
  color: var(--ink);
  font-family: "Kiwi Maru", serif;
  font-size: var(--font-size-section-title);
  font-weight: 500;
  line-height: var(--line-height-heading);
}

h3 {
  color: var(--ink);
  font-family: "Kiwi Maru", serif;
  font-size: var(--font-size-card-title);
  font-weight: 500;
  line-height: var(--line-height-heading);
}

.page-hero > p {
  max-width: 680px;
  margin: 26px 0 32px;
  color: #817486;
  font-family: "Kiwi Maru", serif;
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
}

.primary-link,
.secondary-link {
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  border-radius: 17px;
  font-size: var(--font-size-control);
  font-weight: 700;
  line-height: var(--line-height-control);
  text-decoration: none;
}

.primary-link {
  color: #fff;
  background: linear-gradient(135deg, #b89ac7, #876798);
  box-shadow: 0 14px 28px rgba(108, 77, 123, 0.22);
}

.secondary-link {
  border: 1px solid rgba(119, 89, 132, 0.13);
  color: #70577b;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 10px 28px rgba(91, 65, 102, 0.06);
}

.content-section {
  margin-top: 48px;
}

.prose p,
.prose li,
.profile-facts p {
  color: #6d616f;
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
}

.prose .lead {
  max-width: 850px;
  font-size: var(--font-size-body-large);
}

.profile-facts {
  display: grid;
  gap: 16px;
}

.profile-facts {
  grid-template-columns: repeat(3, 1fr);
  margin-top: 22px;
}

.profile-facts article {
  padding: 24px;
  border: 1px solid rgba(113, 85, 126, 0.1);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.7);
}

.profile-facts span {
  color: #9678a3;
  font-size: var(--font-size-caption);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.profile-facts strong {
  display: block;
  margin-top: 8px;
  color: #59495f;
  font-size: var(--font-size-card-title);
}

blockquote {
  margin: 32px 0 0;
  padding: 28px;
  border-left: 3px solid #a889b7;
  border-radius: 0 18px 18px 0;
  color: #604d68;
  background: rgba(255, 255, 255, 0.6);
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: var(--font-size-body-large);
  line-height: var(--line-height-body);
}

.cta-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-top: 72px;
  padding: clamp(28px, 5vw, 48px);
  border-radius: 28px;
  color: #fff;
  background: linear-gradient(135deg, #6e537a, #9674a5);
}

.cta-panel h2,
.cta-panel p,
.cta-panel .eyebrow {
  color: #fff;
}

.cta-panel h2 {
  margin-bottom: 8px;
  font-size: var(--font-size-section-title);
}

.cta-panel p {
  margin: 0;
  line-height: var(--line-height-body);
  opacity: 0.84;
}

.cta-panel .primary-link,
.cta-panel .secondary-link {
  flex: 0 0 auto;
  color: #624c6b;
  background: #fff;
}

.not-found {
  min-height: calc(100vh - 210px);
  display: grid;
  place-content: center;
  text-align: center;
}

.not-found p {
  color: #76697a;
  line-height: 1.8;
}

.not-found__links {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
}

.profile-facts {
  gap: 14px;
  margin-top: 18px;
}

.profile-facts article {
  position: relative;
  min-height: 172px;
  padding: 24px 22px;
  overflow: hidden;
  border-color: rgba(255, 255, 255, 0.7);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.56);
  box-shadow: 0 14px 34px rgba(94, 68, 107, 0.07);
}

.profile-facts article::after {
  content: "✦";
  position: absolute;
  right: 18px;
  top: 16px;
  color: rgba(174, 139, 190, 0.32);
}

.profile-facts span {
  color: #9a7daa;
}

.profile-facts strong {
  margin-top: 12px;
  font-family: "Kiwi Maru", serif;
  font-weight: 500;
}

.soft-panel {
  padding: clamp(28px, 5vw, 44px);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 28px;
  background:
    radial-gradient(circle at 92% 10%, rgba(225, 207, 234, 0.32), transparent 28%),
    rgba(255, 255, 255, 0.52);
  box-shadow: 0 16px 38px rgba(91, 65, 103, 0.07);
}

.soft-panel--warm {
  background:
    radial-gradient(circle at 8% 90%, rgba(244, 218, 200, 0.36), transparent 28%),
    rgba(255, 255, 255, 0.52);
}

.prose p,
.prose li,
.profile-facts p {
  color: #817486;
}

.prose .lead {
  font-family: "Kiwi Maru", serif;
  font-size: var(--font-size-body-large);
  line-height: var(--line-height-body);
}

.page-hero:not(.home-hero) {
  padding: 42px 38px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 30px;
  background:
    radial-gradient(circle at 82% 18%, rgba(222, 201, 233, 0.52), transparent 32%),
    rgba(255, 255, 255, 0.52);
  box-shadow: 0 18px 46px rgba(91, 65, 103, 0.08);
}

.profile-facts article {
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.56);
  box-shadow: 0 12px 28px rgba(91, 65, 103, 0.055);
}

blockquote {
  border-left-color: #b493c2;
  color: #6b586f;
  background: rgba(239, 229, 244, 0.58);
  font-family: "Kiwi Maru", serif;
}

.cta-panel {
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 28px;
  background:
    radial-gradient(circle at 82% 18%, rgba(255, 255, 255, 0.2), transparent 28%),
    linear-gradient(135deg, #b492c4, #876798);
  box-shadow: 0 18px 42px rgba(111, 77, 126, 0.18);
}

.cta-panel .eyebrow {
  opacity: 0.78;
}

@media (max-width: 760px) {

  main {
    padding-top: 20px;
  }

  .page-hero:not(.home-hero) {
    padding: 32px 22px;
    border-radius: 24px;
  }

  .profile-facts {
    grid-template-columns: 1fr;
  }

  .cta-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .not-found__links {
    flex-direction: column;
  }
}

/* Public diagnosis entrance. Keep these styles separate from the app shell. */
body.public-home-page {
  background: #eee8f1;
  color: var(--ink);
}

.public-home-shell {
  --home-accent: var(--deep-purple);
  --home-decoration: #a889b7;
  --home-line: var(--line);
  --home-heading-font: "Kiwi Maru", serif;
  --home-header-height: calc(68px + env(safe-area-inset-top));
  position: relative;
  isolation: isolate;
  width: 100%;
  min-height: 100dvh;
  margin-inline: auto;
  background: transparent;

  #home-background {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;

    .today-page-atmosphere {
      width: 100%;
    }
  }

  a:focus-visible,
  button:focus-visible,
  select:focus-visible {
    outline: 2px solid var(--home-accent);
    outline-offset: 5px;
  }

  .home-wordmark {
    gap: 12px;
    margin: 0 auto 36px;
    color: var(--deep-purple);
    font-family: var(--home-heading-font);
    font-size: var(--font-size-section-title);
    letter-spacing: 0.1em;
    line-height: 1.5;

    .home-wordmark__mark {
      color: var(--home-decoration);
      font-size: var(--font-size-card-title);
    }

    strong {
      font-weight: 500;
    }

    .home-wordmark__latin {
      margin-left: 0.12em;
      letter-spacing: 0.14em;
    }
  }

  .home-header {
    display: flex;
    min-height: var(--home-header-height);
    align-items: center;
    justify-content: flex-end;
    padding: calc(12px + env(safe-area-inset-top)) 28px 12px;
  }

  .home-login-link {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding-inline: 18px;
    border: 1px solid rgba(119, 89, 132, 0.16);
    border-radius: 17px;
    background: rgba(255, 255, 255, 0.55);
    color: #806f88;
    font-size: var(--font-size-control);
    text-decoration: none;

    &:hover {
      background: rgba(255, 255, 255, 0.85);
      border-color: var(--home-decoration);
    }
  }

  .home-main {
    width: min(720px, calc(100% - 56px));
    margin-inline: auto;
    padding: 0;
  }

  .home-info {
    max-width: 640px;
    margin: 0 auto;
    padding: 24px 0 8px;
    color: var(--ink);

    .home-info__section {
      padding: 0 0 24px;
      margin: 0 0 24px;
      border-bottom: 1px solid rgba(119, 89, 132, 0.16);
    }

    .home-info__section--card {
      padding: 24px;
      border: 1px solid rgba(255, 255, 255, 0.85);
      border-radius: 22px;
      background: rgba(255, 255, 255, 0.62);
      box-shadow: var(--shadow);
    }

    .home-info__section > :last-child {
      margin-bottom: 0;
    }

    h2 {
      margin: 0 0 16px;
      color: var(--deep-purple);
      font-family: var(--home-heading-font);
      font-size: var(--font-size-section-title);
      font-weight: 500;
      line-height: 1.65;
      letter-spacing: 0.02em;
      text-wrap: balance;
    }

    h3 {
      margin: 24px 0 8px;
      color: #66536f;
      font-size: var(--font-size-card-title);
      font-weight: 500;
      line-height: 1.65;
      text-wrap: pretty;
    }

    p,
    li {
      color: #655a69;
      font-size: var(--font-size-body);
      line-height: 1.9;
      overflow-wrap: anywhere;
    }

    p {
      margin: 0 0 16px;
    }

    a {
      color: #70537e;
      text-decoration: underline;
      text-underline-offset: 4px;
      overflow-wrap: anywhere;
    }

    .home-info__list {
      margin: 12px 0 20px;
      padding-left: 1.4em;
    }

    .home-info__sample,
    .home-info__faq-item {
      padding: 20px 22px;
      border: 1px solid rgba(255, 255, 255, 0.82);
      border-radius: 18px;
      background: rgba(255, 255, 255, 0.48);

      h3:first-child {
        margin-top: 0;
      }
    }

    .home-info__sample {
      .home-info__tagline {
        color: #70537e;
        font-family: var(--home-heading-font);
        font-size: var(--font-size-body-large);
      }

      .home-info__list {
        margin-bottom: 20px;
      }
    }

    .home-info__note {
      margin: 14px 0 0;
      color: #817486;
      font-size: var(--font-size-caption);
      line-height: 1.8;
    }

    .home-info__faq {
      display: grid;
      gap: 12px;
    }

    .home-info__faq-item > :last-child {
      margin-bottom: 0;
    }

    .home-info__links {
      display: flex;
      flex-wrap: wrap;
      gap: 8px 20px;
      margin: 20px 0;
      font-size: var(--font-size-control);
      line-height: 1.7;
    }

    .home-info__start {
      display: inline-block;
      margin-top: 8px;
      font-size: var(--font-size-control);
      font-weight: 600;
    }
  }

  .home-hero {
    max-width: 440px;
    min-height: calc(100vh - var(--home-header-height));
    min-height: calc(100svh - var(--home-header-height));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-inline: auto;
    padding: 24px 0 64px;
    text-align: center;
  }

  .home-hero__intro,
  .home-hero__form {
    width: 100%;
  }

  .home-hero__visual {
    display: flex;
    justify-content: center;
    margin-bottom: 32px;
  }

  .home-hero__emblem {
    display: block;
    width: 80px;
    height: 80px;
    overflow: visible;
    stroke: var(--home-decoration);
    stroke-width: 0.8;

    .home-hero__orbit {
      stroke-opacity: 0.35;
      stroke-dasharray: 1 6;
    }

    .home-hero__moon {
      fill: #e8e0ee;
      stroke: #897397;
      stroke-width: 1;
    }

    .home-hero__star {
      stroke-width: 1;
    }

    .home-hero__point {
      fill: var(--home-decoration);
      stroke: none;
    }
  }

  .home-hero__copy h1 {
    margin: 0;
    color: var(--ink);
    font-family: var(--home-heading-font);
    font-size: var(--font-size-section-title);
    font-weight: 500;
    letter-spacing: 0.04em;
    line-height: 1.7;
  }

  .content-section {
    margin: 0 0 40px;
    padding: 28px 24px;
    border: 1px solid rgba(255, 255, 255, 0.85);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.62);
    box-shadow: var(--shadow);

    h2 {
      margin: 0 0 24px;
      color: var(--ink);
      font-family: var(--home-heading-font);
      font-size: var(--font-size-card-title);
      font-weight: 500;
      line-height: 1.8;
      letter-spacing: 0.04em;
      text-wrap: balance;

      span {
        display: inline-block;
      }
    }

    .lead {
      margin: 0;
      color: #817486;
      font-family: "Noto Sans JP", sans-serif;
      font-size: var(--font-size-body);
      line-height: 2.1;
    }
  }

  .home-footer {
    width: calc(100% - 56px);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
    margin-inline: auto;
    padding: 32px 0 calc(32px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--home-line);

    strong {
      color: var(--ink);
      font-family: var(--home-heading-font);
      font-size: var(--font-size-body);
      font-weight: 500;
      letter-spacing: 0.08em;
    }

    p {
      margin: 10px 0 0;
      color: #817784;
      font-size: var(--font-size-meta);
    }

    nav {
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      gap: 4px 24px;
    }

    nav a {
      display: inline-flex;
      min-height: 44px;
      align-items: center;
      color: #817486;
      font-size: var(--font-size-meta);
      text-decoration: none;
      text-underline-offset: 5px;

      &:hover {
        text-decoration: underline;
      }
    }
  }

  @media (min-width: 960px) {
    .home-header,
    .home-main,
    .home-footer {
      width: min(1120px, calc(100% - 96px));
    }

    .home-header {
      margin-inline: auto;
      padding-inline: 0;
    }

    .home-hero {
      display: grid;
      grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
      gap: clamp(48px, 6vw, 88px);
      max-width: none;
      min-height: min(720px, calc(100svh - var(--home-header-height)));
      padding-block: 64px 88px;
      text-align: left;
    }

    .home-wordmark {
      margin: 0 0 32px;
    }

    .home-hero__visual {
      justify-content: flex-start;
      margin: 0 0 28px;
    }

    .home-hero__emblem {
      width: 112px;
      height: 112px;
    }

    .home-hero__copy {
      h1 {
        font-size: var(--font-size-page-title);
        line-height: 1.6;
      }

      p {
        max-width: 28em;
        margin: 20px 0 0;
        color: #655a69;
        line-height: 1.9;
        text-wrap: pretty;
      }
    }

    .home-hero__form {
      max-width: 480px;
      justify-self: end;
      padding: 36px;
      border: 1px solid rgba(255, 255, 255, 0.85);
      border-radius: 28px;
      background: rgba(255, 253, 255, 0.68);
      box-shadow: var(--shadow);

      .birthday-form {
        margin-top: 0;
      }
    }

    .home-info {
      max-width: none;
      padding-block: 32px 48px;

      .home-info__section {
        margin-bottom: 56px;
        padding-bottom: 40px;
      }

      .home-info__section--card {
        padding: 36px;
      }

      #home-about {
        padding-inline: max(0px, calc((100% - 720px) / 2));
        text-align: center;
      }

      #home-results .home-info__list {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 16px;
        margin-block: 24px;
        padding: 0;
        list-style: none;

        li {
          padding: 18px 16px;
          border-radius: 16px;
          background: rgba(235, 223, 242, 0.48);
        }

        strong {
          display: block;
          margin-bottom: 8px;
          color: var(--deep-purple);
        }
      }

      .home-info__sample {
        display: grid;
        grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
        gap: 40px;
        padding: 32px;
      }

      .home-info__sample-details {
        padding-left: 32px;
        border-left: 1px solid var(--home-line);

        > :last-child {
          margin-bottom: 0;
        }
      }

      #home-method {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0 40px;

        h2 {
          grid-column: 1 / -1;
        }

        p {
          margin-bottom: 0;
        }
      }

      .home-info__faq {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px;
      }

      .home-info__faq-item {
        padding: 28px;

        &:last-child {
          grid-column: 1 / -1;
        }
      }
    }

    .home-footer {
      flex-direction: row;
      align-items: flex-start;
      justify-content: space-between;
      gap: 48px;
      text-align: left;

      > div {
        flex-shrink: 0;
      }

      nav {
        max-width: 600px;
        justify-content: flex-end;
      }
    }
  }

  @media (max-width: 360px) {
    .home-main {
      width: calc(100% - 48px);
    }

    .home-hero__copy h1 {
      font-size: var(--font-size-section-title);
    }
  }
}

/* Only the public diagnosis form uses these controls. */
.start-birthday-form {
  max-width: 400px;
  margin-inline: auto;
  text-align: center;
  scroll-margin-top: 24px;

  .birthday-form {
    margin: 36px 0 18px;
    text-align: left;
  }

  .birthday-form__label {
    display: block;
    margin: 0 0 12px;
    color: #7f7086;
    font-size: var(--font-size-caption);
    letter-spacing: 0.06em;
  }

  .birthday-selects {
    display: grid;
    grid-template-columns: 1.45fr 1fr 1fr;
    gap: 10px;

    select {
      width: 100%;
      min-width: 0;
      min-height: 56px;
      appearance: none;
      border: 1px solid rgba(119, 89, 132, 0.16);
      border-radius: 17px;
      padding: 0 28px 0 14px;
      color: #55475c;
      background-color: rgba(255, 255, 255, 0.8);
      background-image:
        linear-gradient(45deg, transparent 50%, #897397 50%),
        linear-gradient(135deg, #897397 50%, transparent 50%);
      background-position: calc(100% - 16px) 26px, calc(100% - 12px) 26px;
      background-size: 4px 4px, 4px 4px;
      background-repeat: no-repeat;
      font: inherit;
      font-size: var(--font-size-control);
      transition: border-color 160ms ease;

      &:hover:not(:disabled) {
        border-color: #897397;
      }

      &:disabled {
        color: #938997;
        background-color: #f5f2f5;
        border-color: #e6e0e8;
        opacity: 1;
      }
    }
  }

  .start-birthday-form__name {
    margin: 0 0 18px;
    text-align: left;

    .birthday-form__label {
      margin-bottom: 9px;
      letter-spacing: 0;
    }

    .honorific-name-field {
      position: relative;
      display: flex;
      width: 100%;
      min-width: 0;
      min-height: 56px;
      align-items: center;
      gap: 2px;
      overflow: hidden;
      padding: 0 14px;
      border: 1px solid rgba(119, 89, 132, 0.16);
      border-radius: 17px;
      color: #55475c;
      background: #fff;
      text-align: left;
    }

    .honorific-name-field > input {
      flex: 0 1 auto;
      min-width: 16px;
      max-width: calc(100% - 2.5em);
      height: 54px;
      min-height: 0;
      padding: 0;
      overflow: hidden;
      border: 0;
      border-radius: 0;
      outline: 0;
      color: inherit;
      background: transparent;
      font: inherit;
      font-size: var(--font-size-control);
      box-shadow: none;
    }

    .honorific-name-field:focus-within {
      outline: 2px solid #897397;
      outline-offset: 2px;
    }

    .honorific-name-field__suffix {
      flex: 0 0 auto;
      white-space: nowrap;
    }

    .honorific-name-field__mirror {
      position: absolute;
      top: 0;
      left: 14px;
      height: 0;
      overflow: hidden;
      visibility: hidden;
      font: inherit;
      font-size: var(--font-size-control);
      white-space: pre;
    }
  }

  .onboarding-primary {
    width: 100%;
    min-height: 56px;
    padding: 14px 24px;
    border: 1px solid transparent;
    border-radius: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: #fff;
    background: linear-gradient(135deg, #b89ac7, #876798);
    box-shadow: 0 8px 20px rgba(108, 77, 123, 0.16);
    font: inherit;
    font-size: var(--font-size-control);
    font-weight: 500;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: box-shadow 160ms ease;

    &:hover:not(:disabled) {
      box-shadow: 0 10px 24px rgba(108, 77, 123, 0.26);
    }

    &:disabled {
      color: #fff;
      background: #b5a5bf;
      box-shadow: none;
      cursor: default;
    }

    svg {
      width: 17px;
      height: 17px;
    }
  }

  .onboarding-primary .loading-spinner {
    display: inline-grid;
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    place-items: center;
    color: #fff;

    > span {
      box-sizing: border-box;
      width: 100%;
      height: 100%;
      border: 2px solid rgba(255, 255, 255, 0.35);
      border-top-color: currentColor;
      border-radius: 50%;
      animation: loading-spinner-rotate 0.75s linear infinite;
    }
  }

  .form-error {
    color: #a04459;
    font-size: var(--font-size-caption);
  }

  @media (prefers-reduced-motion: reduce) {
    select,
    .onboarding-primary {
      transition: none;
    }
  }
}

@keyframes loading-spinner-rotate {
  to { transform: rotate(360deg); }
}

/* Public reading preview: visible headings with an obscured body. */
.reading-page {
  width: min(100%, 480px);
  min-height: 100vh;
  min-height: 100dvh;
  margin-inline: auto;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% 7%, rgba(224, 205, 235, 0.68), transparent 24rem),
    linear-gradient(165deg, #fbf8fc 0%, #f5eef8 52%, #faf6f3 100%);
  box-shadow: 0 0 60px rgba(62, 44, 68, 0.15);

  .reading-page__cover {
    margin: 24px 0 28px;
    padding: 48px 24px;
    border: 1px solid var(--line);
    border-radius: 26px;
    background: linear-gradient(155deg, #fffdf9, #f7eff9);
    box-shadow: var(--shadow);
    text-align: center;

    h1 { margin: 22px 0 18px; }
    p { margin: 0; color: #817486; line-height: 1.9; }
    .reading-page__cover-note { color: #715981; font-family: "Kiwi Maru", serif; font-size: var(--font-size-body-large); line-height: 2; }
  }

  .reading-page__cover-divider { margin: 28px 0; color: #b28fc2; }
  .reading-page__sample-note { padding: 18px 20px; margin: 0 0 28px; border-radius: 16px; color: #756b79; background: rgba(236, 224, 242, 0.6); font-size: var(--font-size-caption); line-height: 1.8; }

  .reading-page__toc {
    margin: 32px 0;
    h2 { font-size: var(--font-size-card-title); }
    ol { padding: 0; margin: 0; list-style: none; border-top: 1px solid var(--line); }
    li { border-bottom: 1px solid var(--line); }
    a { display: flex; align-items: center; gap: 16px; min-height: 56px; padding: 10px 4px; color: #715981; font-size: var(--font-size-control); text-decoration: none; }
    span:first-child { color: #9875a7; font-size: var(--font-size-caption); }
    span:last-child { margin-left: auto; }
  }

  .reading-page__chapters { display: grid; gap: 24px; }
  .reading-page__chapter {
    padding: 28px 24px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: rgba(255, 253, 249, 0.85);
    scroll-margin-top: 24px;
    h2 { font-size: var(--font-size-card-title); line-height: 1.7; }
    h3 { margin: 0 0 20px; color: #66536f; font-size: var(--font-size-body-large); line-height: 1.8; }
  }

  .reading-page__passage + .reading-page__passage { margin-top: 32px; }
  .reading-page__mosaic {
    display: grid;
    gap: 13px;
    overflow: hidden;
    padding: 4px 0;
    user-select: none;
    pointer-events: none;

    span {
      display: block;
      height: 15px;
      width: 100%;
      border-radius: 3px;
      background: repeating-linear-gradient(90deg, #9d91a2 0 9px, #c1b6c5 9px 17px, transparent 17px 21px, #ada0b3 21px 32px, transparent 32px 36px);
      filter: blur(5px);
      opacity: 0.6;
    }
    span:nth-child(3n) { width: 87%; }
    span:nth-child(4n) { width: 94%; }
    span:last-child { width: 62%; }
  }

  .reading-page__lock-label { margin: 28px 0 0; color: #9875a7; font-size: var(--font-size-caption); text-align: center; line-height: 1.8; }
  .reading-page__caption { margin: 24px 0 0; color: #817486; font-size: var(--font-size-caption); line-height: 1.8; }
  .reading-page__price {
    margin: 24px 0 12px;
    color: var(--ink);
    font-size: var(--font-size-page-title);
    font-weight: 600;
    span { margin-left: 6px; font-size: var(--font-size-caption); font-weight: 400; }
  }
  .reading-page__terms { margin: 0; color: #817486; font-size: var(--font-size-caption); line-height: 1.8; }

  .reading-page__availability {
    margin-top: 40px;
    padding: 28px 24px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: linear-gradient(150deg, rgba(234, 216, 242, 0.65), rgba(255, 246, 236, 0.8));
    h2 { line-height: 1.7; text-wrap: balance; }
    p { color: #756b79; line-height: 1.9; }
    .reading-page__terms { margin: 0; }
    .reading-page__caption { margin-bottom: 20px; }
    a { width: 100%; margin-top: 12px; text-align: center; }
  }
  .reading-page__receipt {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
    h3 { margin: 0 0 12px; font-size: var(--font-size-body-large); line-height: 1.8; }
    p { margin: 0; }
  }
  .reading-page__purchase { display: grid; place-items: center; width: 100%; min-height: 52px; padding: 14px 16px; border: 1px solid rgba(112, 83, 126, 0.16); border-radius: 17px; color: #fff; background: linear-gradient(135deg, #a687b6, #80618f); font: inherit; font-size: var(--font-size-control); line-height: 1.6; text-decoration: none; cursor: pointer; }
  .reading-page__footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 24px; margin-top: 40px; color: #817486; font-size: var(--font-size-caption); }
}

.reading-page main {
  width: min(436px, calc(100% - 44px));
  margin-inline: auto;
}

/* Shared public documents. Black KIN illustrations stay page-specific. */
body.public-document {
  width: auto;
  max-width: none;
  margin: 0;
  background: #faf7fb;
  color: #493e51;

  a:focus-visible {
    outline: 3px solid #9c7caf;
    outline-offset: 5px;
  }

  .public-skip {
    position: absolute;
    top: 8px;
    left: 16px;
    z-index: 2;
    padding: 12px;
    background: white;
    transform: translateY(-150%);
    &:focus { transform: translateY(0); }
  }

  .public-header,
  .public-footer {
    width: min(1120px, calc(100% - 48px));
    margin-inline: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding-block: 24px;
  }

  .public-header { border-bottom: 1px solid var(--line); }
  .public-header__action {
    font-size: var(--font-size-control);
    text-decoration: none;
    color: var(--deep-purple);
    span { margin-left: 6px; }
  }

  main {
    width: min(1120px, calc(100% - 48px));
    margin-inline: auto;
    padding: 20px 0 64px;
  }

  .public-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    color: #7b6b84;
    font-size: var(--font-size-meta);
    a { text-underline-offset: 4px; }
  }

  .public-hero {
    padding: 48px 0;
    border-bottom: 1px solid var(--line);
    h1 { line-height: 1.6; }
    .eyebrow { margin: 0 0 16px; }
    p { line-height: 1.9; }
  }
  .public-hero--compact { max-width: 720px; margin-inline: auto; }
  .public-lead { margin: 24px 0 0; color: #70527f; font-size: var(--font-size-body-large); }
  .public-legal-body {
    section { padding-top: 36px; }
    h2 { margin: 0 0 16px; }
    ul { padding-left: 24px; }
    li + li { margin-top: 8px; }
    .date { padding-top: 32px; color: #75667e; font-size: var(--font-size-meta); }
    .legal-nav { padding-top: 24px; border-top: 1px solid var(--line); font-size: var(--font-size-caption); }
  }
  .public-status {
    max-width: 720px;
    min-height: min(560px, calc(100dvh - 240px));
    margin-inline: auto;
    padding-block: 64px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    h1 { line-height: 1.6; }
    > p:not(.eyebrow) { margin-top: 24px; line-height: 1.95; }
  }
  .public-status__links { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 16px; }

  .black-kin-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    align-items: center;
    gap: clamp(32px, 6vw, 88px);
    padding: 48px 0 60px;
    border-bottom: 1px solid var(--line);
    h1 { line-height: 1.6; }
    p { line-height: 1.9; }
    .eyebrow { margin: 0 0 16px; }
  }

  .black-kin-hero__lead {
    margin: 24px 0 12px;
    color: #70527f;
    font-family: "Kiwi Maru", serif;
    font-size: var(--font-size-card-title);
  }

  .public-byline {
    margin-top: 24px;
    color: #7c6c84;
    font-size: var(--font-size-meta);
  }

  .black-kin-map {
    margin: 0;
    padding: 28px;
    border-radius: 24px;
    background: radial-gradient(ellipse at 80% 0%, #584461, transparent 65%), #302536;
    color: #f6edf9;
    svg { display: block; width: 100%; max-width: 230px; margin: 24px auto; height: auto; }
    figcaption { display: flex; align-items: center; gap: 7px; font-size: var(--font-size-meta); color: #ddcfe3; }
  }

  .black-kin-map__heading {
    > span { font-size: var(--font-size-meta); }
    > strong {
      display: block;
      margin-top: 8px;
      font-size: var(--font-size-page-title);
      font-weight: 500;
      span { font-size: var(--font-size-body); color: #ddcfe3; }
    }
  }

  .black-kin-map__legend { width: 10px; height: 10px; border-radius: 2px; background: #d6b47c; flex-shrink: 0; }
  .public-body { width: min(100%, 720px); margin-inline: auto; }
  .public-body p,
  .public-body li { line-height: 1.95; }
  .public-body h2 { line-height: 1.6; }
  .public-body h3 { margin: 32px 0 14px; line-height: 1.65; }
  .public-body a:not(.primary-link) { text-underline-offset: 4px; }
  .public-body [id] { scroll-margin-top: 24px; }
  .black-kin-intro { padding-top: 52px; }
  .primary-link { gap: 12px; margin-top: 10px; max-width: 100%; }
  .public-caption { margin: 12px 0 0; font-size: var(--font-size-caption); color: #7c6c84; }

  .public-toc {
    margin-top: 36px;
    padding: 24px 28px;
    border-left: 2px solid #b795c8;
    background: #f0e9f4;
    border-radius: 0 16px 16px 0;
    p { margin: 0 0 12px; font-weight: 600; }
    ol { padding-left: 24px; margin: 0; }
    li { padding-block: 6px; }
    a { color: #70527f; text-decoration: none; }
    a:hover { text-decoration: underline; }
  }

  .public-section { padding-top: 64px; }
  .black-kin-feature {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 20px;
    padding-block: 28px;
    border-bottom: 1px solid var(--line);
    h3 { margin-top: 0; }
    p:last-child { margin-bottom: 0; }
  }
  .black-kin-feature__number { padding-top: 6px; color: #9870ac; font-size: var(--font-size-card-title); }

  .black-kin-comparison {
    display: grid;
    gap: 24px;
    margin-top: 24px;
    > div { padding-left: 22px; border-left: 2px solid #d5c1de; }
    h3 { margin-top: 0; }
    p { margin: 6px 0; }
    .black-kin-comparison__hint { color: #70527f; font-weight: 500; margin-top: 12px; }
  }

  blockquote { margin-top: 32px; }
  .black-kin-numbers {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(56px, 1fr));
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 28px 0;
    li { padding: 10px 4px; background: #ede4f2; border-radius: 8px; text-align: center; color: #70527f; font-variant-numeric: tabular-nums; }
  }
  .black-kin-faq {
    h3 { padding-top: 24px; border-top: 1px solid var(--line); }
  }

  .public-cta {
    margin-top: 64px;
    padding: 36px;
    border-radius: 24px;
    background: #eee4f3;
    .eyebrow { margin: 0 0 16px; }
  }

  .public-notes {
    padding-top: 48px;
    color: #75667e;
    h2 { font-size: var(--font-size-body-large); }
    p, li { font-size: var(--font-size-caption); line-height: 1.85; }
    ul { padding-left: 22px; }
    li { margin-block: 8px; }
  }

  .public-footer {
    p { font-size: var(--font-size-caption); color: #75667e; margin: 12px 0 0; }
    border-top: 1px solid var(--line);
    padding-block: 28px 48px;
    nav { display: flex; flex-wrap: wrap; gap: 16px; font-size: var(--font-size-caption); color: #75667e; }
  }

  @media (max-width: 760px) {
    .public-header, .public-footer, main { width: calc(100% - 40px); }
    .public-header { gap: 12px; }
    .site-brand { font-size: var(--font-size-control); }
    .public-header__action { font-size: var(--font-size-control); span { display: none; } }
    .black-kin-hero { grid-template-columns: 1fr; padding-block: 32px; gap: 24px; }
    .black-kin-map {
      display: grid;
      grid-template-columns: minmax(0, 1fr) 110px;
      align-items: center;
      gap: 16px;
      padding: 24px;
      svg { margin: 0; }
      figcaption { grid-column: 1 / -1; }
    }
    .public-hero { padding-block: 32px; }
    .public-hero h1, .public-status h1, .black-kin-hero h1 { font-size: var(--font-size-section-title); }
    .black-kin-intro { padding-top: 36px; }
    .public-toc { padding: 20px; }
    .public-section { padding-top: 48px; }
    .black-kin-feature { grid-template-columns: 28px minmax(0, 1fr); gap: 12px; }
    .public-cta { padding: 28px 22px; }
    .public-status { min-height: calc(100dvh - 340px); padding-block: 48px; }
    .public-status__links { align-items: stretch; flex-direction: column; }
    .public-footer { align-items: flex-start; flex-direction: column; }
  }

  @media (prefers-reduced-motion: reduce) {
    scroll-behavior: auto;
  }
}
