:root {
  --navy: #102238;
  --ink: #1f2b32;
  --muted: #69747a;
  --warm: #f4f0e8;
  --paper: #fbfaf6;
  --gold: #a9874e;
  --line: rgba(31,43,50,.14);
  --serif: "Noto Serif JP", serif;
  --sans: "Noto Sans JP", sans-serif;
  --side-pad: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.7;
  letter-spacing: .01em;
  font-size: 16px;
  word-break: normal;
  overflow-wrap: break-word;
  line-break: strict;
}
h1, h2, h3, p { margin-top: 0; }

/* Prevents a meaningful phrase (word+particle, or a verb's conjugated tail)
   from splitting across a line break on narrow screens (e.g. "資金" -> "資" /
   "金", "情報" + "が" orphaned, "できない" -> "できな" / "い"). Applied selectively
   via app.js's richText() and, for static copy, directly in index.html. */
.nobreak { white-space: nowrap; }
button { font-family: inherit; }

/* visible focus ring everywhere — never rely on color alone */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

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

.site-header { position: fixed; z-index: 110; top: 0; left: 0; width: 100%; height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-inline: var(--side-pad); color: var(--navy); background: rgba(251,250,246,.86); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.brand { font-weight: 600; font-size: .72rem; letter-spacing: .34em; color: var(--navy); text-decoration: none; }
.menu-button { display: grid; position: relative; z-index: 102; width: 44px; height: 44px; padding: 0; border: 1px solid rgba(16,34,56,.18); border-radius: 50%; background: rgba(251,250,246,.82); place-content: center; gap: 7px; cursor: pointer; }
.menu-button i { display: block; width: 23px; height: 1px; background: currentColor; transition: transform .2s; }
.menu-button[aria-expanded="true"] i:first-of-type { transform: translateY(4px) rotate(45deg); }
.menu-button[aria-expanded="true"] i:last-of-type { transform: translateY(-4px) rotate(-45deg); }
.mobile-menu { position: fixed; z-index: 101; inset: 0; padding: 92px var(--side-pad) 32px; background: var(--paper); display: grid; align-content: start; }
.mobile-menu a { min-height: 52px; display: flex; align-items: center; border-bottom: 1px solid var(--line); font-family: var(--serif); text-decoration: none; color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .menu-button i { transition: none; } }

.tool-shell { width: 100%; min-height: 100vh; }
.screen { max-width: 560px; margin: 0 auto; padding: 110px var(--side-pad) 60px; min-height: 100vh; display: flex; flex-direction: column; justify-content: center; }
.screen-center { align-items: center; text-align: center; }
[hidden] { display: none !important; }

.tool-brand { font-weight: 700; letter-spacing: .16em; font-size: .82rem; color: var(--navy); margin-bottom: 18px; }
.tool-eyebrow { font-size: .7rem; letter-spacing: .14em; font-weight: 600; color: var(--gold); margin: 0 0 12px; }

/* ---------- Buttons ---------- */
.btn-primary {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--navy); color: #f7f3ea;
  border: none; border-radius: 4px;
  padding: 14px 24px; font-size: .95rem; font-weight: 600;
  min-height: 48px; cursor: pointer;
  transition: opacity .18s ease;
  text-decoration: none;
}
.btn-primary span { color: #c6aa78; }
.btn-primary:hover { opacity: .88; }

.btn-quiet {
  background: none; border: none; color: var(--muted);
  font-size: .85rem; padding: 10px 0; cursor: pointer;
  min-height: 44px; display: inline-flex; align-items: center;
}
.btn-quiet:hover { color: var(--ink); }

/* ---------- INTRO ---------- */
.intro-inner { text-align: left; }
.tool-headline { font-family: var(--serif); font-weight: 500; font-size: clamp(1.6rem, 6.5vw, 2.4rem); line-height: 1.45; color: var(--navy); margin-bottom: 18px; text-wrap: balance; }
.tool-lead { font-size: .92rem; color: var(--muted); line-height: 1.8; margin-bottom: 28px; }
.tool-note { font-size: .78rem; color: var(--muted); margin-top: 14px; }
.tool-disclaimer { font-size: .7rem; color: #8a939a; line-height: 1.6; margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line); }

/* ---------- QUESTION ---------- */
.screen-question { justify-content: flex-start; padding-top: 96px; }
.q-header { display: flex; align-items: center; justify-content: flex-end; margin-bottom: 14px; }
.q-counter { font-size: .74rem; letter-spacing: .04em; color: var(--muted); font-variant-numeric: tabular-nums; }

.progress-track { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; margin-bottom: 40px; }
.progress-fill { display: block; height: 100%; background: var(--gold); width: 0%; transition: width .3s ease; }

.q-body { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 10px 0 20px; }
.q-text { font-family: var(--serif); font-weight: 500; font-size: clamp(.86rem, 3.4vw, 1.3rem); line-height: 1.55; color: var(--ink); margin-bottom: 28px; }
.q-text:focus { outline: none; } /* programmatic focus for SR only; visible focus not needed here */

.q-answers { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.answer-row {
  display: flex; align-items: center; gap: 14px;
  width: 100%; text-align: left;
  background: none; border: none; border-bottom: 1px solid var(--line);
  padding: 15px 4px; min-height: 48px;
  font-size: .92rem; color: var(--ink);
  cursor: pointer;
  transition: background-color .15s ease;
}
.answer-row:hover { background: var(--warm); }
.answer-row.is-selected { background: rgba(169,135,78,.12); }
.answer-key {
  flex: 0 0 22px; font-size: .72rem; color: var(--gold);
  border: 1px solid var(--line); border-radius: 50%;
  width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
}
.answer-row.is-selected .answer-key { border-color: var(--gold); background: var(--gold); color: #fff; }
.answer-label { flex: 1; }

.q-nav { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.q-hint { font-size: .68rem; color: #9aa2a4; margin: 0; }

/* ---------- ANALYSIS ---------- */
.analysis-text { font-family: var(--serif); font-size: 1.1rem; color: var(--navy); margin-bottom: 22px; }
.analysis-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; font-size: .8rem; color: var(--muted); letter-spacing: .04em; }

/* ---------- RESULT ---------- */
.screen-result { justify-content: flex-start; padding-top: 104px; }
.result-headline { font-family: var(--serif); font-weight: 500; font-size: clamp(1.3rem, 5vw, 1.7rem); line-height: 1.55; color: var(--navy); margin-bottom: 14px; text-wrap: balance; }
.result-body { font-size: .9rem; color: var(--muted); line-height: 1.8; margin-bottom: 26px; }

/* Score Guide: how to read the numbers, separate from the disclaimer
   (which exists to prevent the numbers being read as a business judgement). */
.score-guide { margin-bottom: 16px; }
.score-guide-text { font-size: .8rem; color: var(--ink); margin: 0 0 8px; }
.score-guide-scale { display: flex; align-items: center; gap: 8px; font-size: .64rem; color: var(--muted); letter-spacing: .02em; }
.score-guide-line { flex: 1; height: 1px; background: var(--line); }

.result-bars { display: flex; flex-direction: column; border-top: 1px solid var(--line); margin-bottom: 8px; }
.bar-row { border-bottom: 1px solid var(--line); }
.bar-toggle {
  display: grid; grid-template-columns: 52px 1fr 30px 20px; align-items: center; gap: 10px;
  width: 100%; background: none; border: none; padding: 13px 4px;
  min-height: 44px; cursor: pointer; text-align: left; color: inherit;
}
.bar-toggle:hover { background: var(--warm); }
.bar-label { font-size: .78rem; color: var(--ink); }
.bar-track { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
/* min-width keeps a small, deliberate sliver visible even at score 0, so a
   zero result reads as "this is the answer" rather than "nothing loaded". */
.bar-fill { display: block; height: 100%; min-width: 6px; background: var(--navy); border-radius: 3px; transition: width .6s ease; }
.bar-value { font-size: .78rem; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.bar-indicator { font-size: .9rem; color: var(--gold); text-align: center; }
.bar-detail { padding: 0 4px 16px; }
.bar-detail p { font-size: .82rem; color: var(--ink); line-height: 1.75; margin: 0; }

.score-guide-hint { font-size: .66rem; color: #9aa2a4; margin: 0 0 22px; }

.result-disclaimer { font-size: .72rem; color: #8a939a; line-height: 1.6; margin: 0 0 26px; padding-top: 14px; border-top: 1px solid var(--line); }

.result-action { background: var(--warm); border-radius: 4px; padding: 16px; margin-bottom: 18px; }
.result-action-label { font-size: .68rem; letter-spacing: .08em; color: var(--gold); margin: 0 0 8px; }
.result-action-text { font-size: .88rem; color: var(--ink); line-height: 1.7; margin: 0; }

.result-routing { display: flex; flex-direction: column; gap: 10px; margin-bottom: 28px; }
.routing-box { border-top: 1px solid var(--line); padding-top: 12px; }
.routing-tag { font-size: .62rem; letter-spacing: .1em; color: var(--muted); margin: 0 0 4px; }
.routing-label { font-size: .84rem; color: var(--ink); margin: 0 0 3px; }
.routing-sub { font-size: .72rem; color: var(--muted); margin: 0; }
.routing-link { font-size: .82rem; color: var(--gold); font-weight: 600; }

/* ---------- FUTURE ---------- */
.screen-future { justify-content: flex-start; padding-top: 110px; }
.future-headline { font-family: var(--serif); font-weight: 500; font-size: clamp(1.25rem, 4.8vw, 1.6rem); line-height: 1.55; color: var(--navy); margin-bottom: 24px; text-wrap: balance; }
.future-choices { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.future-answer-row { justify-content: flex-start; }

.future-reveal-line { font-family: var(--serif); font-size: 1.15rem; color: var(--navy); margin-bottom: 30px; }
.future-brand { font-family: var(--serif); font-size: 1.05rem; color: var(--ink); line-height: 1.9; margin-bottom: 34px; }
.future-brand p { margin-bottom: .9em; }
.future-brand .emphasis { color: var(--navy); }

/* ---------- NEXT ---------- */
.next-headline { font-family: var(--serif); font-weight: 500; font-size: clamp(1.3rem, 5vw, 1.8rem); color: var(--navy); margin-bottom: 26px; }
.next-options { display: flex; flex-direction: column; gap: 20px; margin-bottom: 30px; }
.next-option { border-top: 1px solid var(--line); padding-top: 16px; }
.next-no { font-size: .68rem; letter-spacing: .1em; color: var(--gold); margin: 0 0 6px; }
.next-option h3 { font-family: var(--sans); font-size: 1rem; color: var(--navy); margin: 0 0 6px; }
.next-option p { font-size: .84rem; color: var(--muted); line-height: 1.65; margin: 0; }
.btn-consult { display: inline-flex; align-items: center; gap: 10px; margin-top: 14px; font-size: .88rem; font-weight: 600; color: var(--navy); border-bottom: 1px solid var(--navy); padding: 4px 0; min-height: 44px; }
.btn-consult span { color: var(--gold); }

.tool-back-home { display: block; text-align: center; font-size: .76rem; color: var(--muted); margin-top: 10px; }

/* ================= Breakpoints ================= */
@media (min-width: 768px) {
  .screen { max-width: 620px; padding-top: 134px; }
  .tool-headline { font-size: clamp(2rem, 4.5vw, 2.7rem); }
}

@media (min-width: 1024px) {
  .screen { max-width: 680px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * , *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
