/* 問診アプリ試作 r3 — タブレット・スマホ向け。清潔で落ち着いた整骨院の色味(緑がかった白地+深い青緑)。
   文字 17px 以上・押せる部分 48px 以上。外部フォントなし(端末の日本語フォント)。 */
/* 配色・字体の設計: 白地に薄い緑の空気感、1 色の深い青緑を要所に、選んだ部位だけ温かい橙。見出しは太さで、本文は余白で読ませる */
:root {
  --bg: #f4f8f6; --card: #ffffff; --line: #d9e3df; --ink: #1b2a2a; --sub: #5f706d;
  --pri: #1e7a6e; --pri-ink: #ffffff; --on: #e3f2ee; --on-line: #86c3b7;
  --accent: #f0b64b; --err: #b3261e; --warn: #8a5a00; --shadow: 0 1px 2px rgba(27, 42, 42, 0.06), 0 8px 24px rgba(27, 42, 42, 0.05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111a19; --card: #1a2524; --line: #2e3d3b; --ink: #e6efec; --sub: #9fb1ad;
    --pri: #4fb3a5; --pri-ink: #0b1514; --on: #1e3330; --on-line: #3f7a71; --accent: #f2c66d; --err: #ff8a80; --warn: #f2c66d;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111a19; --card: #1a2524; --line: #2e3d3b; --ink: #e6efec; --sub: #9fb1ad;
  --pri: #4fb3a5; --pri-ink: #0b1514; --on: #1e3330; --on-line: #3f7a71; --accent: #f2c66d; --err: #ff8a80; --warn: #f2c66d;
  --shadow: none; color-scheme: dark;
}
* { box-sizing: border-box; }
html { font-size: 17px; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", -apple-system, system-ui, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.65; font-feature-settings: "palt"; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--on-line); outline-offset: 2px; }
#app, #admin { max-width: 760px; margin: 0 auto; padding: 0 16px 56px; }
.top { padding: 22px 0 8px; }
.top .clinic { font-size: 0.8rem; color: var(--sub); letter-spacing: 0.14em; }
.top h1 { margin: 2px 0 0; font-size: 1.45rem; font-weight: 600; letter-spacing: 0.02em; text-wrap: balance; }
.top .sub { margin: 4px 0 0; color: var(--sub); font-size: 0.95rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 22px 20px; margin: 12px 0; box-shadow: var(--shadow); }
.card.narrow { max-width: 420px; margin: 40px auto; }
h2 { font-size: 1.2rem; font-weight: 600; margin: 10px 0 6px; letter-spacing: 0.01em; text-wrap: balance; }
h3 { font-size: 1rem; font-weight: 600; margin: 18px 0 6px; color: var(--sub); }
.help { color: var(--sub); margin: 0 0 10px; font-size: 0.95rem; }
.lead { font-size: 1.1rem; }
.note { color: var(--sub); font-size: 0.9rem; margin-top: 16px; }
.muted { color: var(--sub); }
.req { color: var(--err); font-style: normal; font-size: 0.8rem; margin-left: 6px; border: 1px solid currentColor; border-radius: 6px; padding: 0 6px; vertical-align: 2px; }
.error { color: var(--err); font-weight: 600; margin: 12px 0 0; }
.warn { color: var(--warn); background: #fff7e0; border: 1px solid #f0d9a0; border-radius: 12px; padding: 10px 12px; }
.msg { color: var(--pri); font-weight: 600; margin: 8px 0; }
.notice { color: var(--warn); font-weight: 600; margin: 6px 0; }

/* 進み具合(全ページ共通) */
.progress { margin: 2px 0 16px; }
.progress-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.9rem; color: var(--sub); }
.progress-top .pct { font-size: 1.05rem; font-weight: 600; color: var(--pri); font-variant-numeric: tabular-nums; }
.progress .bar { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 4px; }
.progress .fill { height: 100%; background: var(--pri); border-radius: 999px; transition: width 0.35s ease; }
.progress-sub { font-size: 0.85rem; color: var(--sub); margin-top: 4px; text-align: right; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .progress .fill { transition: none; } }

.item { padding: 14px 0; border-bottom: 1px solid var(--line); }
.item:last-of-type { border-bottom: 0; }
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin: 8px 0; }
.choice { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--card); cursor: pointer; transition: background 0.15s, border-color 0.15s; }
.choice.on { border-color: var(--pri); background: var(--on); }
.choice input { width: 24px; height: 24px; flex: 0 0 24px; margin: 0; accent-color: var(--pri); }
.choice.check { margin: 10px 0; }
.field { display: block; margin: 10px 0; }
.field span { display: block; font-size: 0.92rem; color: var(--sub); margin-bottom: 4px; }
.field input, .field textarea, .field select, select { width: 100%; min-height: 50px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); }
.field textarea { min-height: 72px; }
.row { display: flex; gap: 12px; justify-content: space-between; margin-top: 20px; }
.row.tight { margin-top: 0; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; justify-content: flex-start; }
.btn { min-height: 54px; padding: 10px 20px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); cursor: pointer; font-size: 1rem; font-weight: 500; }
.btn.primary { background: var(--pri); color: var(--pri-ink); border-color: var(--pri); box-shadow: 0 6px 16px rgba(30, 122, 110, 0.22); }
.btn.secondary { background: var(--card); }
.btn.big { width: 100%; font-size: 1.15rem; min-height: 62px; margin-top: 12px; }
.btn.small { min-height: 44px; padding: 6px 14px; font-size: 0.95rem; }
.btn.link { border: 0; background: transparent; color: var(--sub); text-decoration: underline; box-shadow: none; }
.btn.danger { border-color: var(--err); color: var(--err); }
.btn.file { display: inline-flex; align-items: center; }
.btn:disabled { opacity: 0.5; }
.foot { text-align: center; margin-top: 24px; }

/* 痛みの強さ: 1 つの枠の中を線で区切る */
.scale { display: flex; border: 1.5px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--card); margin: 8px 0 4px; }
.scale-btn { flex: 1 1 0; min-width: 0; min-height: 62px; padding: 0; border: 0; border-left: 1px solid var(--line); background: transparent; font-size: 1.1rem; text-align: center; cursor: pointer; font-variant-numeric: tabular-nums; }
.scale-btn:first-child { border-left: 0; }
.scale-btn.on { background: var(--pri); color: var(--pri-ink); font-weight: 600; }
.scale-ends { display: flex; justify-content: space-between; color: var(--sub); font-size: 0.88rem; padding: 0 2px; }
.subitem { margin: 8px 0 14px; }
.tabs { display: flex; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.tab { min-height: 48px; padding: 8px 16px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); cursor: pointer; }
.tab.on { background: var(--pri); color: var(--pri-ink); border-color: var(--pri); }

/* 人体図 */
.bm-wrap { display: flex; gap: 14px; justify-content: center; align-items: flex-start; margin: 8px 0; }
.bm-figure { margin: 0; flex: 1 1 0; min-width: 0; max-width: 230px; text-align: center; }
.bm-figure figcaption { font-weight: 600; margin-bottom: 6px; color: var(--sub); font-size: 0.95rem; }
.bodymap { width: 100%; height: auto; display: block; margin: 0 auto; touch-action: manipulation; }
.bodymap .body { fill: #ffffff; stroke: #b9c4c8; stroke-width: 1; pointer-events: none; }
.bodymap .hint { fill: none; stroke: #b9c4c8; stroke-width: 1; stroke-linecap: round; pointer-events: none; }
.bodymap .hint.dash { stroke-dasharray: 3 4; }
.bodymap .hair { fill: #e3e9ec; stroke: #b9c4c8; stroke-width: 1; pointer-events: none; }
.bodymap .region { fill: rgba(30, 122, 110, 0.03); stroke: none; cursor: pointer; }
.bodymap .region.on { fill: rgba(240, 182, 75, 0.55); stroke: #c98a12; stroke-width: 1.2; }
.bodymap .mark { fill: var(--pri); stroke: #fff; stroke-width: 1.5; pointer-events: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bodymap .body { fill: #233130; stroke: #6d8683; } :root:not([data-theme="light"]) .bodymap .hair { fill: #33454a; } }
:root[data-theme="dark"] .bodymap .body { fill: #233130; stroke: #6d8683; }
:root[data-theme="dark"] .bodymap .hair { fill: #33454a; }
.bm-lines { list-style: none; padding: 0; margin: 10px 0; }
.bm-line { display: grid; grid-template-columns: 28px minmax(4.5em, max-content) minmax(0, 1fr) 44px; gap: 8px; align-items: center; min-height: 54px; border-bottom: 1px solid var(--line); padding: 4px 0; }
.bm-line.empty { grid-template-columns: 28px 1fr; }
.bm-lines .num { width: 28px; height: 28px; border-radius: 50%; background: var(--pri); color: var(--pri-ink); text-align: center; line-height: 28px; font-size: 0.9rem; }
.bm-lines .bm-label { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bm-lines .bm-note { min-width: 0; width: 100%; min-height: 44px; padding: 6px 10px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--card); }
.bm-x { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--card); font-size: 1.2rem; line-height: 1; cursor: pointer; }

.summary { display: grid; grid-template-columns: 1fr 2fr; gap: 6px 12px; margin: 8px 0; }
.summary dt { color: var(--sub); }
.summary dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.list { list-style: none; padding: 0; margin: 8px 0; }
.list li { border-bottom: 1px solid var(--line); padding: 6px 0; }
.list.small li { font-size: 0.9rem; }
.row-btn { width: 100%; display: flex; justify-content: space-between; align-items: center; text-align: left; border: 0; background: transparent; padding: 8px 0; }
.prow { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.prow select { width: auto; min-width: 90px; }
.status { font-size: 0.85rem; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); }
.s-finalized { background: #fff3cd; color: #5a4300; }
.s-confirmed { background: #d9f2e3; color: #0f4d2e; }
.s-void { background: #eee; color: var(--sub); }
.adm-top { display: flex; align-items: center; gap: 12px; padding: 16px 0 4px; }
.adm-top .btn { margin-left: auto; }
table.staff { width: 100%; border-collapse: collapse; margin: 8px 0; }
table.staff th, table.staff td { border: 1px solid var(--line); padding: 4px; font-size: 0.9rem; }
table.staff input { width: 100%; min-height: 44px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.pre { white-space: pre-wrap; font-size: 0.85rem; background: var(--bg); padding: 10px; border-radius: 8px; overflow: auto; }
.confirm-box { display: inline-block; padding: 8px 10px; border: 1.5px solid var(--err); border-radius: 10px; margin: 6px 0; }
.sheet-preview { border: 1.5px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 12px; background: var(--card); }
.sheet-preview .sheet h1 { font-size: 1.1rem; margin: 6px 0; }
.sheet-preview .sheet h2 { font-size: 1rem; }
textarea.pre { width: 100%; font-family: ui-monospace, Menlo, monospace; font-size: 0.8rem; }
#print-area { display: none; }
@media (max-width: 420px) {
  html { font-size: 16px; }
  .card { padding: 18px 14px; border-radius: 16px; }
  .choices { grid-template-columns: 1fr; }
  .bm-wrap { gap: 8px; }
}
@media print {
  body { background: #fff; }
  #app, #admin { display: none !important; }
  #print-area { display: block; }
  .sheet { font-size: 11pt; }
  .sheet h1 { font-size: 14pt; margin: 0 0 4pt; }
  .sheet .summary { grid-template-columns: 1fr 2fr; gap: 2pt 8pt; }
  .sheet table.staff th, .sheet table.staff td { border: 1px solid #000; }
}
