:root {
  --paper: #fafcfd;
  --white: #fff;
  --ink: #092a43;
  --text: #163647;
  --muted: #566c7d;
  --rule: #dce5ec;
  --rule-strong: #b9c8d3;
  --field: #f3f7f9;
  --teal: #0784b8;
  --orange: #ff9f19;
  --orange-ink: #9a5200;
  --warn-bg: #fdf3ec;
  --warn-line: #efc6ad;
  --warn-ink: #8a3a16;
  --stage: #092a43;
  --stage-2: #0d3554;
  --radius: 6px;
  --ease: cubic-bezier(.22, .68, .2, 1);
  color-scheme: light;
}

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", YuGothic, Meiryo, sans-serif;
  font-size: 15px;
  line-height: 1.75;
  letter-spacing: .02em;
  font-feature-settings: "palt" 0;
  font-variant-numeric: tabular-nums;
  word-break: auto-phrase;
  line-break: strict;
  -webkit-font-smoothing: antialiased;
}
::selection { background: #cfe7f3; color: var(--ink); }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
a { color: var(--teal); text-underline-offset: .2em; }
[hidden] { display: none !important; }
.nw { white-space: nowrap; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 46fr) minmax(0, 54fr);
  min-height: 100vh;
}
.sheet { padding: 0 clamp(28px, 4vw, 64px) 64px; min-width: 0; }
.sheet > * { max-width: 660px; }

.bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 60px;
  margin: 0 calc(-1 * clamp(28px, 4vw, 64px));
  padding: 0 clamp(28px, 4vw, 64px);
  max-width: none;
  background: rgba(250, 252, 253, .94);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--rule);
}
.brand { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; flex: none; color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 700; letter-spacing: .04em; }
.brand img { height: 26px; width: auto; display: block; }
.bar-status { display: flex; align-items: center; gap: 18px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.progress { color: var(--ink); font-weight: 700; }
.bar-sec { color: var(--muted); max-width: 13em; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 1024px) and (max-width: 1499.98px) { .brand span { display: none; } }
.bar-send { min-height: 32px; padding: 0 12px; font-size: 12.5px; }
.save { display: inline-flex; align-items: center; gap: 6px; }
.save::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--rule-strong); }
.save.ok::before { background: var(--teal); }
.save.warn { color: var(--warn-ink); }
.save.warn::before { background: #d9622b; }

.notice { margin: 20px 0 0; padding: 12px 16px; border-radius: var(--radius); font-size: 13.5px; line-height: 1.7; border: 1px solid var(--rule); background: #eef5fa; color: var(--ink); }
.notice.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.notice-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* ---------- head ---------- */
.head { padding: 44px 0 8px; }
.to { margin: 0 0 6px; font-size: 14px; color: var(--muted); min-height: 1.75em; }
h1 { margin: 0; font-size: 28px; line-height: 1.4; font-weight: 700; color: var(--ink); letter-spacing: .03em; text-wrap: balance; }
.intro { margin: 18px 0 0; max-width: 38em; }
.intro.sub { margin-top: 6px; color: var(--muted); font-size: 14px; }

.index { margin: 30px 0 0; }
.index ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; border-top: 1px solid var(--rule); }
.index li { border-bottom: 1px solid var(--rule); }
.index a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 2px; color: var(--text); text-decoration: none; font-size: 14px; }
.index a:hover .ix-t { color: var(--teal); }
.index a.is-here .ix-t { color: var(--ink); font-weight: 700; }
.ix-c { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.ix-c::before { content: ""; width: 8px; height: 8px; border: 1px solid var(--rule-strong); border-radius: 2px; }
.index a.is-done .ix-c { color: var(--ink); }
.index a.is-done .ix-c::before { background: var(--orange); border-color: var(--orange); }

/* ---------- sections & questions ---------- */
.sec { padding-top: 64px; }
.sec-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-top: 14px; border-top: 2px solid var(--ink); }
.sec-h h2 { margin: 0; font-size: 21px; line-height: 1.4; color: var(--ink); font-weight: 700; display: flex; align-items: baseline; gap: 12px; }
.sec-no { font-family: "Oswald", "Noto Sans JP", sans-serif; font-size: 22px; line-height: 1; color: var(--ink); font-weight: 500; min-width: 1ch; }
.ix-n { display: inline-block; min-width: 1.6em; font-family: "Oswald", "Noto Sans JP", sans-serif; font-weight: 500; color: var(--muted); }
.sec-c { font-size: 12.5px; color: var(--muted); }
.sec-c.is-done { color: var(--orange-ink); font-weight: 700; }
.sec-lead { margin: 12px 0 0; color: var(--muted); font-size: 14px; }

.q { margin: 0; padding: 26px 0 0; border: 0; min-width: 0; }
.q-wrap + .q-wrap .q { border-top: 1px solid var(--rule); margin-top: 26px; }
.q-label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 0; margin: 0 0 12px; font-weight: 700; color: var(--ink); font-size: 15.5px; line-height: 1.6; }
legend.q-label { float: left; width: 100%; }
legend.q-label + * { clear: both; }
.q-no { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); font-weight: 500; min-width: 3.4em; }
.q-no::before { content: ""; width: 9px; height: 9px; border-radius: 2px; border: 1px solid var(--rule-strong); flex: none; }
.is-done .q-no { color: var(--ink); }
.is-done .q-no::before { background: var(--orange); border-color: var(--orange); }
.q-text { flex: 1 1 18em; }
.plan-tag, .opt-tag, .req-tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 3px; font-size: 11px; font-weight: 700; letter-spacing: .04em; white-space: nowrap; }
.plan-tag { border: 1px dashed #7f93a3; color: #3f5668; }
.plan-tag.a { border-style: solid; border-color: var(--rule-strong); color: var(--muted); }
.opt-tag { background: var(--field); color: var(--muted); font-weight: 500; }
.req-tag { background: #eaf3f8; color: #075d86; }
.q-hint { margin: -4px 0 12px; font-size: 13.5px; color: var(--muted); }
.q-err { margin: 8px 0 0; font-size: 13px; color: var(--warn-ink); }

.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opts.stacked { flex-direction: column; gap: 6px; }
.opt { position: relative; display: inline-flex; cursor: pointer; }
.opt input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.opt span {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 9px 16px;
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  background: var(--white); color: var(--text); font-size: 14.5px; line-height: 1.5;
  transition: background-color .16s var(--ease), border-color .16s var(--ease), color .16s var(--ease);
}
.opts.stacked .opt span { width: 100%; }
.opts.stacked .opt span::before {
  content: ""; flex: none; width: 16px; height: 16px; border: 1.5px solid var(--rule-strong); border-radius: 50%; background: var(--white);
}
.opts.stacked .opt.check span::before { border-radius: 3px; }
.opt:hover span { border-color: var(--ink); }
.opt input:focus-visible + span { outline: 2px solid var(--teal); outline-offset: 2px; }
.opt input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.opts.stacked .opt input:checked + span::before { border-color: #fff; background: radial-gradient(circle, #fff 0 4px, transparent 4.5px); }
.opts.stacked .opt.check input:checked + span::before {
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m3.5 8.5 3 3 6-7' fill='none' stroke='%23092a43' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat;
}
.opt.tbd span { border-style: dashed; color: var(--muted); }
.opt.tbd input:checked + span { color: #fff; border-style: solid; }

.follow { display: block; margin: 16px 0 0; padding: 2px 0 2px 16px; border-left: 1px solid var(--rule-strong); }
.f-label { display: block; margin-bottom: 8px; font-size: 13.5px; font-weight: 700; color: var(--text); }

input[type="text"], input[type="email"], textarea, select {
  width: 100%; min-height: 46px; padding: 10px 14px;
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  background: var(--white); color: var(--ink); font: inherit; font-size: 15px;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
textarea { min-height: 96px; resize: vertical; line-height: 1.7; }
input::placeholder, textarea::placeholder { color: #6e8293; }
input:hover, textarea:hover, select:hover { border-color: #8ea3b3; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(7, 132, 184, .18); }
input[aria-invalid="true"] { border-color: #c4572a; }
.q-input label { display: block; }
.q-input .q-label { margin-bottom: 8px; }
.select { position: relative; max-width: 280px; }
.select select { appearance: none; padding-right: 40px; cursor: pointer; }
.select::after { content: ""; position: absolute; right: 16px; top: 50%; width: 8px; height: 8px; border-right: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); transform: translateY(-70%) rotate(45deg); pointer-events: none; }

.premise { margin: 0 0 14px; padding: 14px 18px 14px 34px; background: var(--white); border: 1px solid var(--rule); border-radius: var(--radius); font-size: 14px; line-height: 1.8; }
.premise li + li { margin-top: 6px; }
.premise li::marker { color: var(--muted); }

/* permission matrix */
.matrix-scroll { overflow-x: auto; margin: 0 0 14px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--white); }
.matrix { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 520px; }
.matrix th, .matrix td { border-bottom: 1px solid var(--rule); padding: 0; }
.matrix tr:last-child th, .matrix tr:last-child td { border-bottom: 0; }
.matrix thead th { padding: 10px 6px 9px; font-size: 12.5px; font-weight: 700; color: var(--ink); text-align: center; vertical-align: bottom; line-height: 1.4; background: var(--field); }
.matrix thead th .plan-tag { display: flex; width: max-content; margin: 5px auto 0; height: 18px; font-size: 10.5px; }
.matrix tbody th { text-align: left; padding: 8px 12px; font-weight: 500; color: var(--text); white-space: nowrap; }
.matrix td { width: 17%; border-left: 1px solid var(--rule); }
.cell {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 5px;
  width: 100%; min-height: 44px; padding: 6px; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: 12px; color: var(--muted);
  transition: background-color .16s var(--ease);
}
.cell svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.cell.on { color: var(--ink); font-weight: 700; }
.cell.on svg { stroke-width: 2.2; }
.cell:hover { background: #f1f6f9; }
.cell.changed::after { content: ""; position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border-radius: 2px; background: var(--orange); }
.cell:focus-visible { outline-offset: -3px; }

/* ---------- submit ---------- */
.submit { margin-top: 80px; padding-top: 14px; border-top: 2px solid var(--ink); }
.submit h2 { margin: 0; font-size: 21px; color: var(--ink); }
.remain { margin: 12px 0 0; font-size: 14px; color: var(--text); }
.todo { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.todo a { display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border: 1px solid var(--rule-strong); border-radius: 4px; font-size: 12.5px; color: var(--ink); text-decoration: none; background: var(--white); }
.todo a:hover { border-color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 24px; border-radius: var(--radius);
  border: 1px solid var(--ink); background: var(--white); color: var(--ink);
  font: inherit; font-size: 15px; font-weight: 700; letter-spacing: .04em; cursor: pointer;
  transition: background-color .16s var(--ease), color .16s var(--ease), transform .16s var(--ease);
}
.btn:hover { background: #eef3f6; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); color: #fff; min-width: 200px; }
.btn.primary:hover { background: #163d5c; }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn.ghost { border-color: transparent; text-decoration: underline; text-underline-offset: .2em; background: transparent; }
.sent { margin: 18px 0 0; padding: 12px 16px; border-radius: var(--radius); font-size: 14px; background: #eef5fa; border: 1px solid var(--rule); color: var(--ink); }
.sent.ok { background: #fff7eb; border-color: #f3d3a3; color: #5e3a06; }
.sent.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.sent:focus { outline: none; }
.foot { margin-top: 64px; padding-top: 18px; border-top: 1px solid var(--rule); font-size: 12.5px; color: var(--muted); }
.foot p { margin: 0; }

/* ---------- stage ---------- */
.stage {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 14px;
  padding: 18px clamp(24px, 2.6vw, 44px) 18px;
  background: var(--stage); color: #fff; min-width: 0;
}
.stage-tabs { display: flex; flex-wrap: nowrap; gap: 0 16px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid rgba(255, 255, 255, .14); }
.stage-tabs::-webkit-scrollbar { display: none; }
.stage-tabs button {
  appearance: none; border: 0; background: none; cursor: pointer;
  flex: none; white-space: nowrap;
  padding: 10px 0 9px; margin-bottom: -1px; border-bottom: 2px solid transparent;
  color: rgba(255, 255, 255, .7); font: inherit; font-size: 13px; letter-spacing: .03em;
  transition: color .16s var(--ease), border-color .16s var(--ease);
}
.stage-tabs button span { margin-right: 6px; color: rgba(255, 255, 255, .55); font-family: "Oswald", "Noto Sans JP", sans-serif; font-weight: 500; }
.stage-tabs button:hover { color: #fff; }
.stage-tabs button[aria-selected="true"] { color: #fff; border-bottom-color: #fff; }
.stage-tabs button:focus-visible { outline-color: #7cc8ea; }
.stage-frame { flex: 1; min-height: 0; overflow: auto; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.25) transparent; padding: 2px 2px 12px; display: flex; flex-direction: column; }
.stage-inner { margin-block: auto; }
.stage-title { margin: 4px 0 10px; font-size: 12px; text-align: right; color: rgba(255, 255, 255, .64); }
.mock-host { position: relative; overflow: hidden; }
.m-sizer { position: relative; overflow: hidden; }
.mock-hint { display: none; }
.stage-caption { margin: 12px 0 0; min-height: 1.7em; font-size: 13px; color: rgba(255, 255, 255, .7); }
.stage-caption.hot { color: #ffbe5c; }

/* mobile disclosure */
.sec-mock { display: none; }

@media (max-width: 1023.98px) {
  html { scroll-padding-top: 64px; }
  .layout { display: block; }
  .stage { display: none; }
  .sheet { padding: 0 20px 48px; }
  .bar { margin: 0 -20px; padding: 0 20px; height: 56px; }
  .brand span { display: none; }
  .bar-sec { display: none; }
  .sheet > * { max-width: none; }
  .sec-mock { display: block; margin-top: 22px; }
  .sec-mock summary {
    list-style: none; cursor: pointer;
    display: flex; align-items: center; justify-content: space-between;
    min-height: 46px; padding: 0 16px; border-radius: var(--radius);
    background: var(--ink); color: #fff; font-size: 14px; font-weight: 700;
  }
  .sec-mock summary::-webkit-details-marker { display: none; }
  .sec-mock summary::after { content: ""; width: 8px; height: 8px; border-right: 1.5px solid #fff; border-bottom: 1.5px solid #fff; transform: rotate(45deg) translateY(-3px); transition: transform .2s var(--ease); }
  .sec-mock[open] summary { border-radius: var(--radius) var(--radius) 0 0; }
  .sec-mock[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
  .sec-mock .mock-host { background: var(--stage); padding: 12px 12px 4px; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; }
  .sec-mock .mock-host.scrolls { -webkit-mask-image: linear-gradient(90deg, #000 82%, transparent); mask-image: linear-gradient(90deg, #000 82%, transparent); }
  .sec-mock .mock-host.scrolls.at-end { -webkit-mask-image: none; mask-image: none; }
  .mock-hint { display: block; margin: 0; padding: 6px 12px 12px; background: var(--stage); border-radius: 0 0 var(--radius) var(--radius); font-size: 12px; color: rgba(255, 255, 255, .72); }
}
@media (max-width: 560px) {
  h1 { font-size: 23px; }
  .index ol { grid-template-columns: 1fr; }
  .bar-status { gap: 12px; font-size: 12px; }
  .opts:not(.stacked) .opt span { padding: 9px 14px; }
  .btn.primary { width: 100%; }
  .progress .pl, .save .st-time { display: none; }
  .matrix { min-width: 0; font-size: 12.5px; }
  .matrix tbody th { white-space: normal; padding: 8px; line-height: 1.45; }
  .matrix thead th { padding: 8px 2px; font-size: 11.5px; }
  .matrix td { width: 15%; }
  .cell span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}

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

/* ---------- gate ---------- */
.gate { min-height: 100vh; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 14px; max-width: 560px; margin: 0 auto; padding: 40px 24px; }
.gate img { height: 40px; width: auto; }
.gate h1 { font-size: 22px; }
.gate p { margin: 0; color: var(--muted); }

/* ---------- print ---------- */
.print-summary { display: none; }
@media print {
  @page { size: A4; margin: 16mm 14mm; }
  body { background: #fff; opacity: 1; font-size: 10.5pt; font-family: "BIZ UDPGothic", "Yu Gothic UI", "Yu Gothic", "Noto Sans JP", sans-serif; }
  .layout, .gate { display: none !important; }
  .print-summary { display: block; color: #000; }
  .print-summary header { display: flex; align-items: center; gap: 12px; padding-bottom: 8px; border-bottom: 1.5pt solid #092a43; }
  .print-summary header img { height: 22px; width: auto; }
  .print-summary h1 { font-size: 14pt; margin: 0; }
  .print-summary header p { margin: 2px 0 0; font-size: 9pt; color: #333; }
  .print-summary section { margin-top: 12px; break-inside: auto; }
  .print-summary h2 { font-size: 11.5pt; margin: 0 0 4px; padding-bottom: 3px; border-bottom: .75pt solid #999; break-after: avoid; }
  .print-summary dl { margin: 0; }
  .print-summary dl > div { display: grid; grid-template-columns: 45% 55%; gap: 10px; padding: 4px 0; border-bottom: .5pt solid #ddd; break-inside: avoid; }
  .print-summary dt { font-weight: 700; }
  .print-summary dd { margin: 0; }
  .print-summary .none { color: #888; }
  .print-summary footer { margin-top: 14px; font-size: 8.5pt; color: #555; }
}
