/* 整体KOTOBUKI の口コミ下書きアプリを、本番と同じ部品で試す1ページ。下の :root は初期値（案A: グレージュと金）。
   色は試す人が選べる。選んだ背景とボタンの色から、文字・枠・補足の色を script が読みやすいように決めて :root に上書きする。
   スマホ1画面幅の縦長、下に固定の操作ボタン */
:root {
  --bg: #F6F3F1; --surface: #FFFFFF; --text: #3E3530; --muted: #6B5F57; --line: #E4DCD5; --line-strong: #C9BCB1;
  --primary: #564C45; --primary-line: #564C45; --primary-strong: #40372F; --primary-press: #40372F; --primary-soft: #F1ECE8; --on-primary: #FFFFFF; --btn-border: transparent;
  --accent: #B79434; --accent-soft: #F6F0E2; --gold-text: #86691F; --brand: #432710; --note: #FFF8E8; --trial: #E7E0D8; --shade: rgba(28, 24, 21, 0.45);
  --mincho: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  --font: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased; overflow-wrap: anywhere; line-break: strict; transition: background-color 200ms ease; }
button, textarea, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:disabled { cursor: default; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--primary-line); outline-offset: 2px; }
.app { max-width: 480px; margin: 0 auto; min-height: 100%; }
p { margin: 0; }
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bg); }
.progress { height: 3px; background: var(--line); }
.progress__fill { height: 100%; width: 0; background: var(--accent); transition: width 220ms ease; }
.topbar__row { display: flex; align-items: center; gap: 8px; min-height: 48px; padding-inline: 4px 12px; }
.topbar__row .grow { flex: 1; }
.topbar__count { min-width: 3.2em; text-align: right; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
.topbar__count:empty { min-width: 0; }
.trial { font-size: 12px; font-weight: 700; color: var(--text); background: var(--trial); border-radius: 999px; padding: 2px 10px; letter-spacing: 0.06em; }
.colorbtn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 12px 4px 6px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--text); font-size: 13px; font-weight: 700; }
.colorbtn i { display: inline-block; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-strong); background: linear-gradient(135deg, var(--bg) 0 50%, var(--primary) 50% 100%); }
.screen { padding-inline: 16px; padding-block: 8px 32px; }
.title { margin: 0; font-family: var(--mincho); font-size: 22px; line-height: 1.45; font-weight: 600; letter-spacing: 0.04em; text-wrap: balance; }
.screen > .title:not(.center) { padding-left: 14px; border-left: 2px solid var(--accent); }
.label { display: block; margin-bottom: 8px; padding-left: 16px; font-family: var(--mincho); font-size: 12px; letter-spacing: 0.24em; color: var(--gold-text); }
.sub { margin-top: 8px; font-size: 15px; color: var(--muted); }
.field { margin-top: 22px; }
.field__label { display: block; margin-bottom: 8px; font-size: 15px; font-weight: 600; }
.options { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.opt { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px; padding: 13px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; text-align: left; font-size: 17px; line-height: 1.45; color: var(--text); transition: background-color 150ms ease, border-color 150ms ease; }
.opt[aria-checked="true"] { border-color: var(--primary-line); box-shadow: inset 0 0 0 1px var(--primary-line); background: var(--primary-soft); }
.opt__mark { flex: none; width: 22px; height: 22px; border: 1.5px solid var(--line-strong); border-radius: 50%; background: var(--surface); color: var(--on-primary); display: inline-flex; align-items: center; justify-content: center; }
.opt--multi .opt__mark { border-radius: 6px; }
.opt__mark svg { width: 14px; height: 14px; opacity: 0; }
.opt[aria-checked="true"] .opt__mark { background: var(--primary); border-color: var(--primary-line); }
.opt[aria-checked="true"] .opt__mark svg { opacity: 1; }
.opt__label { flex: 1; min-width: 0; }
.opt__label b { display: block; font-size: 17px; }
.opt__label small { display: block; margin-top: 2px; font-size: 13px; color: var(--muted); }
.rank { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: var(--on-primary); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chip { display: inline-block; margin-left: 8px; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--gold-text); vertical-align: middle; }
.chips { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 7px; margin-top: 8px; }
.chips .opt { min-height: 44px; padding: 9px 10px; font-size: 14px; gap: 8px; line-height: 1.35; }
.chips .opt__mark { width: 18px; height: 18px; }
.segments { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg { flex: 1 1 0; min-width: 0; min-height: 46px; padding: 8px 4px; border: 0; border-left: 1px solid var(--line); background: transparent; font-size: 15px; line-height: 1.3; color: var(--text); }
.seg:first-child { border-left: 0; }
.seg[aria-checked="true"] { background: var(--primary); color: var(--on-primary); }
.phrases { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.phrase { border: 1px solid var(--line-strong); border-radius: 999px; padding: 8px 13px; font-size: 14px; background: var(--surface); color: var(--text); }
.phrase[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary-line); color: var(--primary-strong); font-weight: 700; }
.textarea { display: block; width: 100%; min-height: 104px; padding: 12px 14px; font-size: 16px; line-height: 1.7; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 10px; resize: none; -webkit-appearance: none; appearance: none; }
.textarea:focus { border-color: var(--primary-line); box-shadow: inset 0 0 0 1px var(--primary-line); }
.textarea::placeholder { color: var(--muted); }
.counter { margin-top: 6px; font-size: 13px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.note { margin-top: 10px; font-size: 13px; color: var(--muted); min-height: 1.5em; }
.welcome { text-align: center; padding-top: 12px; }
.brand { font-family: var(--mincho); color: var(--brand); display: inline-flex; flex-direction: column; align-items: center; gap: 2px; line-height: 1.1; }
.brand .sm { font-size: 13px; letter-spacing: 0.4em; padding-left: 0.4em; }
.brand .en { font-size: 30px; letter-spacing: 0.2em; padding-left: 0.2em; font-weight: 500; }
.clinic { margin-top: 10px; font-family: var(--mincho); font-size: 17px; letter-spacing: 0.12em; color: var(--muted); }
.rule { width: 56px; height: 1px; margin: 26px auto 0; background: var(--accent); }
.thanks { margin-top: 24px; font-family: var(--mincho); font-size: 21px; line-height: 1.6; font-weight: 600; text-wrap: balance; }
.thanks-sub { margin-top: 12px; font-size: 15px; line-height: 1.9; color: var(--muted); }
.howlong { margin-top: 16px; font-size: 14px; color: var(--muted); }
.nowrap { display: inline-block; white-space: nowrap; }
.box { margin-top: 26px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; font-size: 14px; line-height: 1.8; text-align: left; }
.box.trialbox { background: var(--note); }
.pcards { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.pcards .opt { align-items: flex-start; padding: 14px 16px; }
.pcards .opt__mark { margin-top: 3px; }
.pcards .meta { display: block; margin-top: 4px; font-size: 12px; color: var(--gold-text); font-weight: 700; letter-spacing: 0.04em; }
.swatches { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 10px; }
.swatch { display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 0; border: 0; border-radius: 12px; background: none; font-size: 11px; line-height: 1.3; color: var(--text); text-align: center; }
.swatch .sw { display: block; height: 44px; border-radius: 10px; border: 1px solid var(--line-strong); position: relative; overflow: hidden; }
.swatch .sw em { position: absolute; left: 10px; top: 9px; width: 22px; height: 3px; border-radius: 2px; }
.swatch .sw b { position: absolute; left: 10px; right: 10px; bottom: 8px; height: 12px; border-radius: 999px; }
.swatch[aria-pressed="true"] .sw { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text); }
.swatch[aria-pressed="true"] span:last-child { font-weight: 700; }
.custom { margin-top: 16px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.custom label { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 52px; padding: 8px 10px 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; font-size: 14px; cursor: pointer; }
.custom input[type="color"] { flex: none; width: 46px; height: 34px; padding: 0; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); cursor: pointer; }
.custom input[type="color"]::-webkit-color-swatch-wrapper { padding: 3px; }
.custom input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 5px; }
.custom input[type="color"]::-moz-color-swatch { border: 0; border-radius: 5px; }
.custom-note { margin-top: 8px; font-size: 12px; color: var(--muted); }
.cpanel { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; background: var(--shade); }
.cpanel__body { width: 100%; max-width: 480px; max-height: 88%; overflow-y: auto; background: var(--bg); border-radius: 18px 18px 0 0; padding: 14px 16px calc(18px + env(safe-area-inset-bottom, 0px)); }
.cpanel__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cpanel__head h2 { margin: 0; font-family: var(--mincho); font-size: 18px; font-weight: 600; }
.sheet { margin-top: 18px; padding: 16px 16px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 1px 2px rgba(43, 38, 34, 0.05), 0 10px 28px rgba(43, 38, 34, 0.08); }
.sheet__text { display: block; width: 100%; min-height: 170px; padding: 0; border: 0; background: transparent; color: var(--text); font-size: 16px; line-height: 1.9; resize: none; -webkit-appearance: none; appearance: none; }
.sheet__foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.sheet__count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sheet__body { font-size: 16px; line-height: 2; white-space: pre-wrap; -webkit-user-select: text; user-select: text; }
.adjust-label { margin-top: 14px; font-size: 13px; color: var(--muted); }
.adjust { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.adjust .phrase { font-size: 13px; padding: 7px 12px; }
.ai { margin-top: 16px; padding: 12px 14px; border: 1px dashed var(--line-strong); border-radius: 10px; font-size: 13px; color: var(--muted); }
.ai .linkbtn { padding-inline: 0; }
.steps { margin: 18px 0 0; padding-left: 1.5em; font-size: 15px; line-height: 1.7; }
.steps li { margin-top: 6px; padding-left: 4px; }
.steps li::marker { color: var(--primary-strong); font-weight: 600; }
.actionbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--bg); border-top: 1px solid var(--line); padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); }
.actionbar__inner { max-width: 448px; margin: 0 auto; display: flex; flex-direction: column; gap: 6px; }
.actionbar__sub { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; width: 100%; min-height: 52px; padding: 12px 18px; border-radius: 999px; border: 1px solid var(--btn-border); font-size: 17px; font-weight: 600; letter-spacing: 0.08em; background: var(--primary); color: var(--on-primary); }
.btn:active { background: var(--primary-press); }
.btn:disabled { opacity: 0.4; }
.linkbtn { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 10px; background: none; border: 0; border-radius: 8px; color: var(--primary-strong); font-size: 15px; font-weight: 600; }
.linkbtn:disabled { opacity: 0.4; }
.linkbtn.quiet { color: var(--muted); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; font-size: 14px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
