:root {
  color-scheme: light;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", Meiryo, system-ui, sans-serif;
  font-synthesis: none;
  line-height: 1.65;
  color: #182a3d;
  background: #f8f6f0;

  --page: #f8f6f0;
  --surface: #fffefa;
  --surface-soft: #f1f6f3;
  --ink: #182a3d;
  --muted: #516373;
  --border: #d8e0dc;
  --teal: #176f71;
  --teal-dark: #105758;
  --teal-light: #dcefeb;
  --coral: #d56958;
  --coral-light: #fbe9e3;
  --shadow: 0 14px 40px rgb(25 48 57 / 7%);
  --radius: 22px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--page);
  color: var(--ink);
  overflow-wrap: anywhere;
  -webkit-text-size-adjust: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

a {
  color: var(--teal-dark);
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--coral);
}

:focus-visible {
  outline: 3px solid var(--coral);
  outline-offset: 3px;
}

::selection {
  background: var(--teal-light);
  color: var(--ink);
}

.app-shell {
  width: min(100% - 40px, 1120px);
  margin-inline: auto;
  padding-bottom: clamp(48px, 8vw, 96px);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 88px;
  padding-block: 18px;
  border-bottom: 1px solid var(--border);
}

.site-header .brand,
.site-header .logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--teal-light);
  color: var(--teal-dark);
  font-size: 1.4rem;
  line-height: 1;
}

.header-note {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 650;
  text-align: right;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 20px;
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
}

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
}

.site-header a {
  font-weight: 650;
}

.hero {
  position: relative;
  padding: clamp(48px, 8vw, 96px) 0 clamp(36px, 6vw, 72px);
  max-width: 850px;
}

.hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 12%;
  right: -15%;
  width: min(45vw, 420px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(220 239 235 / 75%), transparent 70%);
  pointer-events: none;
}

.eyebrow,
.kicker {
  display: inline-block;
  margin: 0 0 14px;
  color: var(--teal-dark);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.hero h1 {
  margin: 0 0 20px;
  font-size: clamp(2rem, 5vw, 3.75rem);
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.hero p {
  max-width: 66ch;
  margin: 0 0 16px;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.125rem);
}

.card {
  min-width: 0;
  padding: clamp(22px, 4vw, 40px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card + .card {
  margin-top: 20px;
}

.card h2,
.card h3 {
  margin-top: 0;
  line-height: 1.4;
  text-wrap: balance;
}

.card h2 {
  font-size: clamp(1.4rem, 2.5vw, 2rem);
}

.card p {
  color: var(--muted);
}

.stepper {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 28px;
  padding: 0;
  list-style: none;
}

.stepper > * {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.4;
}

.stepper > .active,
.stepper > .current,
.stepper > [aria-current="step"] {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
}

.stepper > .complete,
.stepper > .completed {
  border-color: var(--teal-light);
  background: var(--teal-light);
  color: var(--teal-dark);
}

progress {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--teal-light);
  accent-color: var(--teal);
}

progress::-webkit-progress-bar {
  background: var(--teal-light);
}

progress::-webkit-progress-value {
  border-radius: 999px;
  background: var(--teal);
}

progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--teal);
}

.question {
  min-width: 0;
  margin: 0;
  padding: 24px 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.question:first-child {
  padding-top: 0;
  border-top: 0;
}

.question:last-child {
  padding-bottom: 0;
}

.question legend,
.question-title,
.question h3 {
  width: 100%;
  margin: 0 0 16px;
  padding: 0;
  color: var(--ink);
  font-size: clamp(1rem, 1.7vw, 1.15rem);
  font-weight: 750;
  line-height: 1.65;
}

.question-number {
  display: inline-block;
  margin-right: 0.6em;
  color: var(--teal-dark);
  font-size: 0.85em;
  font-weight: 800;
}

.options {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1.4;
  text-align: center;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.option input[type="radio"] {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--teal);
  cursor: pointer;
}

.option:hover {
  border-color: var(--teal);
  background: var(--surface-soft);
  transform: translateY(-2px);
}

.option:focus-within,
.option:focus-visible {
  outline: 3px solid var(--coral);
  outline-offset: 2px;
}

.option.is-selected,
.option.selected,
.option[aria-checked="true"],
.option:has(input[type="radio"]:checked) {
  border-color: var(--teal);
  background: var(--teal-light);
  box-shadow: inset 0 0 0 1px var(--teal);
  color: var(--teal-dark);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 28px;
}

.actions > :first-child:not(:only-child) {
  margin-right: auto;
}

.button,
.actions button,
.actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 20px;
  border: 1px solid var(--teal);
  border-radius: 12px;
  background: var(--teal);
  color: #fff;
  font-weight: 750;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.button:hover,
.actions button:hover:not(:disabled),
.actions a:hover {
  border-color: var(--teal-dark);
  background: var(--teal-dark);
  color: #fff;
  transform: translateY(-2px);
}

.button.secondary,
.button--secondary,
.actions .secondary {
  border-color: var(--border);
  background: var(--surface);
  color: var(--ink);
}

.button.secondary:hover,
.button--secondary:hover,
.actions .secondary:hover:not(:disabled) {
  border-color: var(--teal);
  background: var(--surface-soft);
  color: var(--teal-dark);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.metric-card {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
}

.metric-card:nth-child(3n + 2) {
  background: var(--surface-soft);
}

.metric-card:nth-child(3n) {
  background: #fcf2ed;
}

.metric-card h3,
.metric-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.metric-card strong,
.metric-value {
  display: block;
  color: var(--ink);
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 800;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.metric-card p {
  margin-bottom: 0;
  font-size: 0.9rem;
}

.distribution {
  display: grid;
  gap: 16px;
}

.distribution-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(0, 3fr) auto;
  align-items: center;
  gap: 12px;
}

.distribution-row > :last-child {
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}

.bar {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--teal-light);
}

.bar > span,
.bar-fill,
.bar__fill {
  display: block;
  width: var(--value, 0%);
  max-width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
  transition: width 350ms ease;
}

.bar.coral > span,
.bar--coral > span,
.bar.coral .bar-fill,
.bar--coral .bar-fill {
  background: var(--coral);
}

.note,
.disclaimer {
  padding: 16px 20px;
  border-left: 4px solid var(--coral);
  border-radius: 0 12px 12px 0;
  background: var(--coral-light);
  color: var(--ink);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1100px) {
  /* Keep the decorative circle inside the viewport so the page never scrolls sideways. */
  .hero::before {
    right: 0;
  }
}

@media (max-width: 760px) {
  .options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 520px) {
  .app-shell {
    width: min(100% - 32px, 1120px);
  }

  .site-header {
    min-height: 72px;
  }

  .header-note {
    max-width: 8em;
    font-size: 0.75rem;
  }

  .hero {
    padding-block: 42px 32px;
  }

  .card {
    border-radius: 18px;
  }

  .stepper {
    gap: 6px;
  }

  .stepper > * {
    min-height: 34px;
    padding: 5px 9px;
    font-size: 0.78rem;
  }

  .options {
    gap: 8px;
  }

  .option {
    justify-content: flex-start;
    min-height: 52px;
    padding: 9px 10px;
    text-align: left;
  }

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

  .actions > :only-child {
    grid-column: 1 / -1;
  }

  .actions > :first-child:not(:only-child) {
    margin-right: 0;
  }

  .actions button,
  .actions a {
    width: 100%;
    min-width: 0;
  }

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

  .metric-card {
    padding: 20px;
  }

  .distribution-row {
    grid-template-columns: 1fr auto;
    gap: 5px 10px;
  }

  .distribution-row .bar {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

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

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Integrated page layouts */
.hero h1 em { color: var(--teal); font-style: normal; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 10px 20px; margin-top: 26px; color: var(--teal-dark); font-size: .9rem; font-weight: 700; }
.intro-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); gap: 20px; align-items: start; }
.intro-grid .card + .card, .result-grid .card + .card { margin-top: 0; }
.section-kicker { color: var(--teal-dark); font-size: .78rem; font-weight: 800; letter-spacing: .12em; }
.privacy-box, .notice { margin-top: 26px; padding: 20px; border-radius: 16px; background: var(--surface-soft); }
.privacy-box p, .notice p { margin-block: 8px 14px; }
.save-choice { display: flex; align-items: flex-start; gap: 10px; font-weight: 700; cursor: pointer; }
.save-choice input { width: 20px; height: 20px; margin: 3px 0 0; accent-color: var(--teal); }
.intro-main .actions { justify-content: flex-start; }
.theme-list { margin: 20px 0 0; padding: 0; list-style: none; }
.theme-list li { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid var(--border); font-size: .93rem; font-weight: 700; }
.theme-list li span { color: var(--teal); font-weight: 800; }
.theme-list small { margin-left: auto; color: var(--muted); white-space: nowrap; }
.text-button { padding: 8px 0; border: 0; background: transparent; color: var(--teal-dark); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.text-button:hover { color: var(--coral); }
.stepper { justify-content: space-between; margin: 32px 0 12px; }
.stepper > div { display: grid; justify-items: start; border: 0; background: transparent; padding-left: 0; }
.stepper > div span { color: var(--muted); font-size: .78rem; }
.stepper > div strong { color: var(--ink); font-size: 1rem; }
.progress-track { height: 9px; overflow: hidden; border-radius: 99px; background: var(--teal-light); }
.progress-track > span { display: block; height: 100%; border-radius: inherit; background: var(--teal); transition: width .25s ease; }
.section-intro { padding: 44px 0 26px; }
.section-intro h1 { margin: 8px 0 12px; font-size: clamp(2rem, 4vw, 3rem); line-height: 1.3; }
.section-intro p { max-width: 74ch; margin: 8px 0; color: var(--muted); }
.section-intro .section-note { font-size: .9rem; }
.question-list { padding: clamp(20px, 4vw, 38px); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.question legend { float: left; }
.question legend + .options { clear: both; }
.option input[type="checkbox"] { flex: 0 0 auto; width: 18px; height: 18px; accent-color: var(--teal); }
.follow-up { margin-top: 16px; padding: 16px; border-radius: 14px; background: var(--surface-soft); }
.follow-up[hidden] { display: none; }
.follow-up strong { display: block; margin-bottom: 10px; }
.follow-up .options { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.note-label { display: block; margin-top: 16px; color: var(--muted); font-size: .88rem; font-weight: 700; }
textarea { display: block; width: 100%; margin-top: 6px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; resize: vertical; }
.small-note { color: var(--muted); font-size: .82rem; }
.sticky-actions { padding: 12px 0; }
.results-hero { padding-bottom: 20px; }
.notice { margin: 0 0 24px; border-left: 4px solid var(--coral); background: var(--coral-light); }
.notice p { margin-bottom: 0; }
.result-grid .metric-card { padding: 24px; }
.metric-card h2 { min-height: 2.8em; font-size: 1.23rem; }
.metric-card strong, .metric-value { font-size: inherit; line-height: inherit; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 1fr) minmax(0, 2fr) 2.5em; gap: 8px; align-items: center; font-size: .85rem; }
.bar-row strong { text-align: right; font-variant-numeric: tabular-nums; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--teal); }
.result-section, .next-steps { margin-top: 24px; }
.answer-list { margin: 22px 0 0; padding: 0; list-style: none; }
.answer-list li { display: grid; grid-template-columns: 2.5em minmax(0, 1fr) auto; gap: 8px 12px; align-items: start; padding: 12px 0; border-top: 1px solid var(--border); font-size: .9rem; }
.answer-list .answer-id { color: var(--teal-dark); font-weight: 800; }
.answer-list li strong { color: var(--teal-dark); white-space: nowrap; }
.answer-list li small { grid-column: 2 / -1; color: var(--muted); }
.references { font-size: .84rem; }
.joke-screen { display: grid; justify-items: center; max-width: 760px; margin: clamp(48px, 9vw, 110px) auto; padding-block: clamp(48px, 8vw, 96px); text-align: center; }
.joke-screen .joke-intro { margin: 22px 0 0; color: var(--muted); font-weight: 700; }
.joke-screen h1 { margin: 16px 0 22px; font-size: clamp(2.7rem, 8vw, 5.8rem); line-height: 1.2; letter-spacing: -.04em; }
.joke-screen h1 em { color: var(--coral); font-style: normal; }
.joke-screen > p:last-of-type { max-width: 34em; }
.joke-screen .actions { justify-content: center; }
.about-details { margin: 20px 0; padding: 14px 18px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft); }
.about-details summary, .answer-details summary { color: var(--teal-dark); font-weight: 800; cursor: pointer; }
.about-details p { margin-bottom: 0; }
.score-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, .8fr); gap: 28px; align-items: center; margin-bottom: 24px; background: var(--teal-dark); color: #fff; }
.score-hero .section-kicker, .score-hero p { color: #e1f2ee; }
.score-number { font-size: clamp(4.5rem, 11vw, 8rem); font-weight: 850; line-height: 1.1; letter-spacing: -.07em; font-variant-numeric: tabular-nums; }
.score-number span { margin-left: .05em; font-size: .42em; letter-spacing: 0; }
.score-caption { padding: 22px; border: 1px solid rgb(255 255 255 / 30%); border-radius: 18px; }
.score-caption strong { font-size: clamp(1.4rem, 3vw, 2rem); }
.score-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-top: 22px; }
.score-card { min-width: 0; padding: 22px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); }
.score-card:nth-child(2) { background: var(--surface-soft); }
.score-card:nth-child(4) { background: var(--coral-light); }
.score-card h3 { min-height: 2.7em; margin: 10px 0 4px; font-size: 1.12rem; }
.score-card-value { color: var(--teal-dark); font-size: clamp(2.4rem, 4.5vw, 4rem); font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.score-card-value span { font-size: .5em; }
.score-card p { margin-bottom: 0; color: var(--muted); font-size: .82rem; }
.score-track { height: 10px; overflow: hidden; border-radius: 99px; background: var(--teal-light); }
.score-track > span { display: block; height: 100%; border-radius: inherit; background: var(--teal); }
.highlight-list { margin: 16px 0 0; padding: 0; list-style: none; }
.highlight-list li { display: flex; gap: 14px; padding: 12px 0; border-top: 1px solid var(--border); }
.highlight-list li span { color: var(--teal-dark); font-weight: 800; }
.answer-details h3 { margin: 28px 0 0; }
@media (max-width: 900px) { .score-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .score-hero { grid-template-columns: 1fr; } .score-grid { grid-template-columns: 1fr; } .score-card h3 { min-height: 0; } }
@media (max-width: 760px) {
  .intro-grid { grid-template-columns: 1fr; }
  .follow-up .options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .bar-row { grid-template-columns: 1fr 2.5em; }
  .bar-row .bar { grid-column: 1 / -1; grid-row: 2; }
  .answer-list li { grid-template-columns: 2.5em 1fr; }
  .answer-list li strong { grid-column: 2; }
  .answer-list li small { grid-column: 2; }
  .stepper > div { background: transparent; }
}
@media print {
  .site-header, .site-footer, .actions, .text-button { display: none !important; }
  .app-shell { width: 100%; }
  .card { box-shadow: none; break-inside: avoid; }
}
