:root {
  --ink: #172235;
  --ink-soft: #445065;
  --paper: #ffffff;
  --ground: #edf3f8;
  --line: #cad6e2;
  --navy: #14385e;
  --blue: #2c6b97;
  --blue-light: #dcebf5;
  --gold: #bd8b36;
  --gold-light: #f5ead5;
  --danger: #a23b3b;
  --danger-light: #fff2f1;
  --shadow: 0 18px 48px rgba(26, 52, 78, .10);
  --radius-lg: 22px;
  --radius-md: 14px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 100% 0, rgba(44, 107, 151, .12), transparent 32rem),
    var(--ground);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", YuGothic, Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.8;
}

button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.site-shell {
  width: min(100%, 920px);
  margin: 0 auto;
  padding: 0 20px 56px;
}

.site-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(20, 56, 94, .12);
}

.brand {
  color: var(--navy);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-decoration: none;
}

.product-label {
  padding: 5px 12px;
  border: 1px solid var(--blue);
  border-radius: 999px;
  color: var(--blue);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .12em;
}

.diagnosis-view { padding-top: 56px; }

.intro { max-width: 760px; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .18em;
}

h1 {
  margin: 0;
  color: var(--navy);
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(2.2rem, 7vw, 4.4rem);
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.15;
}

.lead {
  margin: 22px 0 12px;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 700;
  line-height: 1.6;
}

.intro-copy { max-width: 680px; margin: 0; color: var(--ink-soft); }

.notice-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  margin: 34px 0;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, .72);
  color: var(--ink-soft);
  font-size: .9rem;
}

.notice-card p { margin: 0; }
.notice-card p:last-child { white-space: nowrap; }

.progress-wrap { margin: 46px 0 26px; }
.progress-meta { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 8px; color: var(--ink-soft); font-size: .88rem; font-weight: 700; }
.progress-track { height: 5px; overflow: hidden; border-radius: 999px; background: #d8e1e9; }
.progress-track span { display: block; width: 20%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--navy), var(--blue)); transition: width .25s ease; }

.step-panel {
  padding: 30px;
  border: 1px solid rgba(202, 214, 226, .9);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.step-heading { margin: 0 0 4px; color: var(--navy); font-size: clamp(1.45rem, 3vw, 1.9rem); line-height: 1.4; }
.step-intro { margin: 0 0 28px; color: var(--ink-soft); }

.question { min-width: 0; margin: 0; padding: 26px 0; border: 0; border-top: 1px solid #e3e9ef; }
.question:first-of-type { border-top: 0; padding-top: 10px; }
.question-title { display: block; margin-bottom: 14px; font-weight: 750; line-height: 1.65; }
.question-code { display: block; margin-bottom: 4px; color: var(--blue); font-size: .74rem; font-weight: 800; letter-spacing: .1em; }
.question-help { margin: -5px 0 14px; color: var(--ink-soft); font-size: .88rem; }

.options { display: grid; gap: 10px; }
.option {
  position: relative;
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 11px;
  align-items: start;
  min-height: 52px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.option:hover { border-color: var(--blue); background: #f8fbfd; }
.option:has(input:checked) { border-color: var(--blue); background: var(--blue-light); box-shadow: inset 0 0 0 1px var(--blue); }
.option input { width: 19px; height: 19px; margin: 3px 0 0; accent-color: var(--navy); }
.option-text { line-height: 1.55; }

.scale-options { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.scale-options .option { grid-template-columns: 1fr; text-align: center; }
.scale-options .option input { justify-self: center; }
.scale-number { display: block; color: var(--navy); font-size: 1.25rem; font-weight: 850; line-height: 1.2; }
.scale-caption { display: block; margin-top: 5px; color: var(--ink-soft); font-size: .78rem; }

.form-error { min-height: 1.8em; margin: 18px 4px 0; color: var(--danger); font-weight: 700; }
.question.invalid { margin-inline: -12px; padding-inline: 12px; border-radius: 12px; background: var(--danger-light); }

.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 22px; }
.button {
  min-height: 50px;
  padding: 12px 22px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.button:hover { transform: translateY(-1px); }
.button.primary { background: var(--navy); color: white; box-shadow: 0 8px 20px rgba(20, 56, 94, .18); }
.button.primary:hover { background: #0e2f50; }
.button.secondary { border-color: var(--line); background: white; color: var(--navy); }
.button[hidden] { display: none; }

.result-view { padding-top: 42px; }
.result-header { padding: 34px; border-radius: var(--radius-lg); background: linear-gradient(135deg, #102f50, #245f88); color: white; box-shadow: var(--shadow); }
.result-kicker { margin: 0 0 10px; color: #c9e5f5; font-size: .78rem; font-weight: 800; letter-spacing: .16em; }
.result-header h1 { color: white; font-size: clamp(1.9rem, 6vw, 3.4rem); }
.type-name { margin: 22px 0 8px; font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; font-size: clamp(1.35rem, 4vw, 2rem); font-weight: 700; line-height: 1.55; }
.risk-line { display: inline-flex; align-items: center; gap: 10px; margin: 12px 0 0; padding: 8px 13px; border: 1px solid rgba(255,255,255,.38); border-radius: 999px; background: rgba(255,255,255,.10); font-weight: 800; }
.result-lead { margin: 20px 0 0; max-width: 720px; }

.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
.summary-card { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-md); background: white; }
.summary-card small { display: block; margin-bottom: 7px; color: var(--blue); font-weight: 800; letter-spacing: .05em; }
.summary-card p { margin: 0; font-size: .94rem; line-height: 1.7; }

.result-section { margin-top: 18px; padding: 28px 30px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: white; }
.result-section h2 { margin: 0 0 16px; color: var(--navy); font-size: 1.35rem; line-height: 1.5; }
.result-section p { margin: 12px 0; }
.result-section p:first-of-type { margin-top: 0; }
.result-section p:last-child { margin-bottom: 0; }

.score-list { display: grid; gap: 15px; }
.score-item { display: grid; grid-template-columns: 150px 1fr 100px; gap: 14px; align-items: center; }
.score-name { font-weight: 750; }
.score-track { height: 10px; overflow: hidden; border-radius: 999px; background: #e3eaf0; }
.score-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--navy), #4e91bd); }
.score-value { text-align: right; font-weight: 850; }
.score-note { grid-column: 2 / 4; margin-top: -10px; color: var(--ink-soft); font-size: .84rem; }

.measure-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.measure-card { padding: 17px; border: 1px solid #dbe4ec; border-radius: 12px; background: #f8fbfd; }
.measure-card h3 { margin: 0 0 5px; color: var(--navy); font-size: 1rem; }
.measure-card p { margin: 0; color: var(--ink-soft); font-size: .9rem; }

.degree-block { padding: 18px 0; border-top: 1px solid #e4eaf0; }
.degree-block:first-of-type { padding-top: 0; border-top: 0; }
.degree-block h3 { margin: 0 0 7px; font-size: 1.05rem; }
.degree-block p { margin: 0; }

.insight-list, .watch-list { margin: 0; padding-left: 1.4em; }
.insight-list li, .watch-list li { margin: 9px 0; }
.safety-note { margin-top: 18px !important; padding: 14px 16px; border-left: 3px solid var(--gold); background: var(--gold-light); color: #5c471e; }
.confidence-note { color: var(--ink-soft); font-size: .88rem; }

.result-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 28px 0; }
.text-button { padding: 10px 14px; border: 0; background: transparent; color: var(--blue); font-weight: 750; text-decoration: underline; cursor: pointer; }

.loading-layer { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px; background: rgba(13, 31, 48, .55); backdrop-filter: blur(4px); }
.loading-layer[hidden] { display: none; }
.loading-card { display: grid; justify-items: center; gap: 9px; width: min(100%, 390px); padding: 30px; border-radius: 18px; background: white; text-align: center; box-shadow: var(--shadow); }
.loading-card span:last-child { color: var(--ink-soft); font-size: .88rem; }
.spinner { width: 34px; height: 34px; border: 4px solid var(--blue-light); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.site-footer { display: flex; justify-content: space-between; gap: 20px; margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: .76rem; }
.mobile-break { display: none; }

@media (max-width: 720px) {
  .site-shell { padding-inline: 14px; }
  .diagnosis-view { padding-top: 38px; }
  .notice-card { grid-template-columns: 1fr; gap: 8px; }
  .notice-card p:last-child { white-space: normal; }
  .step-panel, .result-section { padding: 22px 17px; }
  .scale-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-grid { grid-template-columns: 1fr; }
  .measure-grid { grid-template-columns: 1fr; }
  .score-item { grid-template-columns: 105px 1fr 82px; gap: 9px; }
  .score-note { grid-column: 1 / 4; margin-top: -4px; }
  .form-actions { justify-content: stretch; }
  .form-actions .button { flex: 1; }
  .result-header { padding: 28px 20px; }
  .mobile-break { display: initial; }
}

@media print {
  @page { size: A4; margin: 15mm 13mm 17mm; }
  body { background: white; color: #111; font-size: 10.5pt; line-height: 1.65; }
  .site-shell { width: 100%; max-width: none; padding: 0; }
  .no-print, .diagnosis-view, .site-footer { display: none !important; }
  .result-view { display: block !important; padding: 0; }
  .result-header { padding: 20px; color: white !important; background: #14385e !important; box-shadow: none; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .result-header h1 { color: white !important; }
  .summary-grid { grid-template-columns: repeat(3, 1fr); break-inside: avoid; }
  .summary-card, .result-section { box-shadow: none; break-inside: avoid; }
  .result-section { margin-top: 10px; padding: 16px 18px; }
  .score-track, .score-track span { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .measure-grid { grid-template-columns: repeat(2, 1fr); }
  a { color: inherit; text-decoration: none; }
}
