: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; }
button, input { font-family: inherit; }

.nobreak { white-space: nowrap; }

: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; }
[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; }
.section-headline { font-family: var(--serif); font-weight: 500; font-size: clamp(1.3rem, 5vw, 1.8rem); line-height: 1.5; color: var(--navy); margin-bottom: 22px; text-wrap: balance; }

/* ---------- 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; width: 100%; justify-content: center;
  margin-top: 8px;
}
.btn-primary span { color: #c6aa78; }
.btn-primary:hover { opacity: .88; }

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

.text-link { display: inline-flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--ink); font-size: .82rem; font-weight: 600; min-height: 40px; }
.text-link span { color: var(--gold); }

/* ---------- INTRO ---------- */
.intro-inner { text-align: left; }
.tool-headline { font-family: var(--serif); font-weight: 500; font-size: clamp(1.7rem, 7vw, 2.4rem); line-height: 1.4; color: var(--navy); margin-bottom: 10px; }
.tool-tagline { font-family: var(--serif); font-size: 1rem; color: var(--ink); line-height: 1.7; margin-bottom: 22px; }
.tool-lead { font-size: .88rem; color: var(--muted); line-height: 1.85; margin-bottom: 26px; }
.tool-note { font-size: .76rem; color: var(--muted); margin-top: 14px; text-align: center; }

/* ---------- Fields (INPUT / TARGET) ---------- */
.field-list { display: flex; flex-direction: column; gap: 22px; margin-bottom: 22px; }
.field { border-top: 1px solid var(--line); padding-top: 16px; }
.field-label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.field-label { font-size: .85rem; font-weight: 600; color: var(--ink); }
.help-toggle { background: none; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); font-size: .68rem; padding: 4px 10px; min-height: 28px; cursor: pointer; }
.help-toggle:hover { color: var(--ink); }
.field-help { font-size: .78rem; color: var(--muted); line-height: 1.7; margin: 0 0 10px; background: var(--warm); padding: 10px 12px; border-radius: 4px; }
.field-input-row { display: flex; align-items: center; gap: 10px; }
.field-input {
  flex: 1; border: 1px solid var(--line); border-radius: 4px; background: var(--paper);
  font-size: 1rem; padding: 12px 14px; min-height: 48px; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.field-input[aria-invalid="true"] { border-color: var(--gold); }
.field-unit { font-size: .85rem; color: var(--muted); min-width: 24px; }
.field-error { font-size: .74rem; color: #8a6b2f; min-height: 1.2em; margin: 6px 0 0; }
.target-current-note { font-size: .78rem; color: var(--muted); margin: 8px 0 0; }

/* ---------- CURRENT ---------- */
.sales-label { font-size: .78rem; color: var(--muted); margin: 0 0 4px; }
.sales-figure { font-family: var(--serif); font-size: clamp(1.8rem, 8vw, 2.6rem); color: var(--navy); margin: 0 0 22px; font-variant-numeric: tabular-nums; }

.flow-diagram { display: flex; flex-direction: column; align-items: center; margin: 8px 0 20px; }
.flow-step { text-align: center; padding: 10px 0; }
.flow-value { font-size: 1.05rem; font-weight: 600; color: var(--navy); margin: 0 0 2px; font-variant-numeric: tabular-nums; }
.flow-label { font-size: .74rem; color: var(--muted); margin: 0; }
.flow-step-final .flow-value { font-size: 1.3rem; }
.flow-arrow-row { display: flex; align-items: center; gap: 10px; color: var(--gold); font-size: .8rem; }
.flow-arrow { font-size: .9rem; }
.flow-rate { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.flow-note { color: var(--muted); font-size: .82rem; text-align: center; margin-bottom: 22px; }

/* ---------- SIMULATE / MIXED shared result block ---------- */
.sim-result, .mixed-result { text-align: center; padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.sim-compare { font-size: .82rem; color: var(--muted); margin: 0 0 6px; }
.sim-diff { font-size: .95rem; color: var(--navy); font-weight: 600; font-variant-numeric: tabular-nums; }
.mixed-target-line { font-size: .82rem; color: var(--muted); margin: 4px 0 0; }
.mixed-gap-line { font-size: .9rem; color: var(--navy); font-weight: 600; margin: 4px 0 0; }

/* ---------- KPI stepper controls ---------- */
.kpi-controls { display: flex; flex-direction: column; border-top: 1px solid var(--line); margin-bottom: 6px; }
.kpi-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.kpi-row.is-changed .kpi-row-label { color: var(--gold); }
.kpi-row-label { font-size: .84rem; color: var(--ink); flex: 1; }
.kpi-stepper { display: flex; align-items: center; gap: 6px; }
.kpi-step-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--paper); color: var(--navy); font-size: 1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.kpi-step-btn:hover { background: var(--warm); }
.kpi-value {
  min-width: 88px; text-align: center; font-size: .88rem; font-weight: 600; color: var(--ink);
  background: none; border: none; padding: 8px 4px; cursor: pointer; font-variant-numeric: tabular-nums;
  min-height: 36px;
}
.kpi-changed-note { font-size: .62rem; color: var(--gold); letter-spacing: .04em; flex-shrink: 0; width: 40px; text-align: right; }

/* ---------- Quick Simulation ---------- */
.quick-sim { border-top: 1px solid var(--line); padding-top: 18px; margin: 8px 0 22px; }
.quick-sim-heading { font-family: var(--serif); font-size: 1rem; color: var(--navy); margin: 0 0 14px; }
.quick-sim-list { display: flex; flex-direction: column; gap: 14px; margin-bottom: 14px; }
.quick-sim-row { border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.quick-sim-label { font-size: .8rem; color: var(--muted); margin: 0 0 3px; }
.quick-sim-change { font-size: .86rem; color: var(--ink); margin: 0 0 3px; font-variant-numeric: tabular-nums; }
.quick-sim-delta { font-size: .86rem; color: var(--navy); font-weight: 600; margin: 0; font-variant-numeric: tabular-nums; }
.quick-sim-note { font-size: .74rem; color: #9aa2a4; line-height: 1.6; margin: 0; }

/* ---------- TARGET ---------- */
.target-gap { text-align: center; margin: 4px 0 22px; }
.target-gap-label { font-size: .8rem; color: var(--muted); margin: 0 0 4px; }
.target-gap-figure { font-family: var(--serif); font-size: 1.5rem; color: var(--navy); margin: 0; font-variant-numeric: tabular-nums; }

.reverse-block { margin-top: 30px; border-top: 1px solid var(--line); padding-top: 26px; }
.reverse-heading { font-family: var(--serif); font-size: 1.2rem; color: var(--navy); margin: 0 0 8px; }
.reverse-sub { font-size: .8rem; color: var(--muted); margin: 0 0 18px; }
.reverse-list { display: flex; flex-direction: column; gap: 16px; margin-bottom: 8px; }
.reverse-row { border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.reverse-label { font-size: .82rem; font-weight: 600; color: var(--ink); margin: 0 0 4px; }
.reverse-current, .reverse-required { font-size: .82rem; color: var(--muted); margin: 0 0 2px; font-variant-numeric: tabular-nums; }
.reverse-required { color: var(--navy); font-weight: 600; }
.reverse-impossible { font-size: .78rem; color: var(--muted); margin: 4px 0 0; }

.mixed-block { margin-top: 30px; border-top: 1px solid var(--line); padding-top: 26px; }
.mixed-heading { font-family: var(--serif); font-size: 1.2rem; color: var(--navy); margin: 0 0 18px; }

/* ---------- ACTION ---------- */
.action-choices { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.action-choice-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;
}
.action-choice-row:hover { background: var(--warm); }
.action-choice-row[aria-checked="true"] { background: rgba(169,135,78,.12); }
.action-choice-no { flex: 0 0 22px; font-size: .72rem; color: var(--gold); }
.action-body { color: var(--muted); font-size: .88rem; line-height: 1.85; margin-bottom: 22px; }

/* ---------- 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: 24px; }
.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 0 8px; }
.btn-consult { display: inline-flex; align-items: center; gap: 10px; margin-top: 6px; 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-restart { display: block; width: 100%; text-align: center; border: none; margin: 8px 0 4px; }
.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.6rem); }
}
@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; }
}
