/*
 * EMJ 問い合わせ管理：フォーム・選択式案内・写真サポート・質問アシスタント
 * テーマ側で --emj-* 変数が定義されていればそれを使い、なければ下の既定値で表示する。
 */
.emji-form, .emji-guide, .emji-chat, .emji-done, .emji-mask, .emji-gate, .emji-leave {
	--_ink: var(--emj-charcoal, #20272B);
	--_navy: var(--emj-navy, #183A4A);
	--_teal: var(--emj-teal, #397D80);
	--_sage: var(--emj-sage, #DCE7E3);
	--_teal-dark: var(--emj-teal-dark, #2E696C);
	--_gold: var(--emj-gold, #B49A67);
	--_champagne: var(--emj-champagne, #D6C5A4);
	--_off: var(--emj-off, #F7F8F8);
	--_muted: var(--emj-muted, #5B666B);
	--_line: var(--emj-line, #D9E0E0);
	--_err: #A23B3B;
	--_radius: var(--emj-radius, 14px);
	--_ease: cubic-bezier(.2,.7,.2,1);
	font-family: inherit;
	color: var(--_ink);
}
.emji-form *, .emji-guide *, .emji-chat *, .emji-leave * { box-sizing: border-box; }
.screen-reader-text { position:absolute!important; width:1px; height:1px; overflow:hidden; clip:rect(1px,1px,1px,1px); white-space:nowrap; }
.nb { display: inline-block; }

/* ---------- form ---------- */
.emji-form { display: grid; gap: 26px; }
.emji-form__lead { margin: 0; font-size: 14px; color: var(--_muted); }
.emji-field { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.emji-label, .emji-field > legend { font-size: 15px; font-weight: 500; letter-spacing: .02em; padding: 0; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.emji-field > legend.emji-label { margin-bottom: 8px; }
.emji-req, .emji-opt { display: inline-block; font-size: 12px; line-height: 1; padding: 4px 7px; border-radius: 4px; font-weight: 500; letter-spacing: .04em; }
.emji-req { background: var(--_navy); color: #fff; margin-left: 6px; }
.emji-opt { background: var(--_off); color: var(--_muted); border: 1px solid var(--_line); margin-left: 6px; }
.emji-help { word-break: auto-phrase; overflow-wrap: anywhere; margin: -2px 0 2px; font-size: 14px; line-height: 1.75; color: var(--_muted); }
.emji-input {
	width: 100%; min-height: 56px; padding: 14px 16px;
	font: inherit; font-size: 16px; color: var(--_ink);
	background: #fff; border: 1px solid #B9C4C4; border-radius: 10px;
	transition: border-color .2s, box-shadow .2s;
	-webkit-appearance: none; appearance: none;
}
.emji-textarea { min-height: 140px; line-height: 1.8; resize: vertical; }
.emji-input::placeholder { color: #98A3A6; }
.emji-input:focus { outline: none; border-color: var(--_teal); box-shadow: 0 0 0 3px rgba(57,125,128,.18); }
.emji-input[aria-invalid="true"] { border-color: var(--_err); box-shadow: 0 0 0 3px rgba(162,59,59,.12); }
.emji-select { position: relative; }
.emji-select::after { content: ""; position: absolute; right: 18px; 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; }
.emji-select select { padding-right: 44px; }
.emji-error { margin: 0; font-size: 14px; color: var(--_err); display: flex; gap: 6px; align-items: flex-start; }
.emji-error::before { content: "!"; flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--_err); color: #fff; font-size: 12px; line-height: 18px; text-align: center; font-weight: 700; margin-top: 2px; }
.emji-form [hidden], .emji-guide [hidden], .emji-chat [hidden] { display: none !important; }
.emji-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.emji-segment { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
@media (min-width: 600px) { .emji-segment { grid-template-columns: repeat(4, minmax(0,1fr)); } }
.emji-seg { position: relative; }
.emji-seg input, .emji-choice input, .emji-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.emji-seg span { display: flex; align-items: center; justify-content: center; min-height: 52px; padding: 10px; text-align: center; border: 1px solid #B9C4C4; border-radius: 10px; background: #fff; cursor: pointer; transition: all .2s var(--_ease); font-size: 15px; }
.emji-seg input:checked + span { border-color: var(--_navy); background: var(--_navy); color: #fff; }
.emji-seg input:focus-visible + span, .emji-choice input:focus-visible + span, .emji-check input:focus-visible + span { outline: 3px solid rgba(57,125,128,.35); outline-offset: 2px; }

.emji-checks { display: grid; gap: 8px; }
@media (min-width: 600px) { .emji-checks { grid-template-columns: 1fr 1fr; } }
.emji-check { display: block; cursor: pointer; }
.emji-check > span { position: relative; display: block; padding: 14px 14px 14px 48px; border: 1px solid var(--_line); border-radius: 10px; background: #fff; font-size: 15px; line-height: 1.6; transition: border-color .2s; }
.emji-check > span::before { content: ""; position: absolute; left: 14px; top: 50%; width: 22px; height: 22px; margin-top: -11px; border: 1.5px solid #9AA7A8; border-radius: 6px; background: #fff; transition: all .2s; }
.emji-check input:checked + span { border-color: var(--_teal); }
.emji-check input:checked + span::before { background: var(--_teal); border-color: var(--_teal); box-shadow: inset 0 0 0 4px var(--_teal); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E"); background-size: 16px; background-position: center; background-repeat: no-repeat; }
.emji-check--consent > span { background: var(--_off); border-color: transparent; }
.emji-check a { color: var(--_navy); text-underline-offset: 3px; }

.emji-form__notice { margin: 0; padding: 16px 18px; background: var(--_off); border-radius: 10px; font-size: 14px; line-height: 1.8; color: var(--_muted); }
.emji-form__notice strong { color: var(--_ink); font-weight: 500; }
.emji-form__status { margin: 0; min-height: 1em; font-size: 14px; color: var(--_err); text-align: center; }
.emji-form__status:empty { display: none; }

/* buttons */
.emji-btn {
	position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
	min-height: 60px; padding: 0 32px; width: 100%;
	font: inherit; font-size: 16px; font-weight: 500; letter-spacing: .06em; text-decoration: none;
	border-radius: 999px; border: 1px solid transparent; cursor: pointer;
	transition: transform .15s var(--_ease), background-color .2s, color .2s, border-color .2s, box-shadow .2s;
	-webkit-tap-highlight-color: transparent;
}
@media (min-width: 600px) { .emji-btn { width: auto; min-width: 280px; } }
.emji-btn--primary { background: var(--_teal); color: #fff; }
.emji-btn--primary:hover { background: var(--_teal-dark); box-shadow: 0 8px 22px rgba(57,125,128,.22); }
.emji-btn--ghost { background: #fff; color: var(--_ink); border-color: #B9C4C4; }
.emji-btn--ghost:hover { border-color: var(--_ink); }
.emji-btn:active { transform: scale(.98); }
.emji-btn:focus-visible { outline: 3px solid rgba(57,125,128,.45); outline-offset: 3px; }
.emji-btn[disabled] { opacity: .65; cursor: progress; }
.emji-btn__busy { display: none; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: emji-spin .8s linear infinite; }
.emji-btn.is-busy .emji-btn__busy { display: inline-block; }
.emji-form__submit { display: flex; justify-content: center; }
@keyframes emji-spin { to { transform: rotate(360deg); } }

/* guide carry-over on estimate form */
.emji-guide-carry { padding: 20px; border: 1px solid var(--_sage); background: #FBFCFC; border-radius: var(--_radius); }
.emji-guide-carry__title { margin: 0 0 10px; font-weight: 500; font-size: 15px; }
.emji-guide-carry__list { margin: 0; display: grid; gap: 6px; font-size: 14px; }
.emji-guide-carry__list div { display: grid; grid-template-columns: 8em 1fr; gap: 10px; }
.emji-guide-carry__list dt { color: var(--_muted); }
.emji-guide-carry__list dd { margin: 0; }
.emji-guide-carry__note { margin: 12px 0 0; font-size: 14px; color: var(--_muted); }
.emji-guide-carry__note a { color: var(--_navy); }

/* done */
.emji-done { text-align: center; padding: 48px 24px; border: 1px solid var(--_line); border-radius: var(--_radius); background: #fff; animation: emji-in .5s var(--_ease) both; }
.emji-done:focus { outline: none; }
.emji-done__icon { display: inline-flex; width: 64px; height: 64px; border-radius: 50%; align-items: center; justify-content: center; background: var(--_sage); color: var(--_navy); margin-bottom: 18px; }
.emji-done__title { font-size: 21px; font-weight: 500; margin: 0 0 12px; letter-spacing: .04em; }
.emji-done__body { margin: 0 auto 10px; max-width: 32em; line-height: 1.9; }
.emji-done__note { margin: 0 auto; max-width: 34em; font-size: 14px; line-height: 1.8; color: var(--_muted); }
@keyframes emji-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- steps (support form) ---------- */
.emji-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; counter-reset: s; }
.emji-steps li { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 14px; color: var(--_muted); position: relative; }
.emji-steps li span { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 1px solid var(--_line); background: #fff; font-size: 14px; transition: all .3s; }
.emji-steps li.is-current { color: var(--_ink); font-weight: 500; }
.emji-steps li.is-current span { background: var(--_navy); border-color: var(--_navy); color: #fff; }
.emji-steps li.is-done span { background: var(--_sage); border-color: var(--_sage); color: var(--_navy); }
.emji-step { display: grid; gap: 22px; }
.js-emji .emji-step:not(.is-active) { display: none; }
.js-emji .emji-step.is-active { animation: emji-in .4s var(--_ease) both; }
.emji-step__q { margin: 0; font-size: clamp(19px, 4.8vw, 23px); font-weight: 500; line-height: 1.6; letter-spacing: .03em; }
.emji-step__help { margin: -10px 0 0; color: var(--_muted); line-height: 1.8; }
.emji-step__nav { display: flex; flex-direction: column-reverse; gap: 10px; }
@media (min-width: 600px) { .emji-step__nav { flex-direction: row; justify-content: center; } }

.emji-choices { display: grid; gap: 10px; }
.emji-choice { display: block; cursor: pointer; }
.emji-choice > span { display: flex; align-items: center; min-height: 60px; padding: 14px 48px 14px 20px; border: 1px solid var(--_line); border-radius: 12px; background: #fff; font-size: 16px; position: relative; transition: border-color .2s, background .2s, transform .15s; }
.emji-choice > span::after { content: ""; position: absolute; right: 20px; top: 50%; width: 20px; height: 20px; margin-top: -10px; border-radius: 50%; border: 1.5px solid #9AA7A8; transition: all .2s; }
.emji-choice:hover > span { border-color: #9AA7A8; }
.emji-choice input:checked + span { border-color: var(--_navy); background: #F3F7F6; }
.emji-choice input:checked + span::after { border-color: var(--_navy); box-shadow: inset 0 0 0 5px var(--_navy); }
.emji-choice:active > span { transform: scale(.99); }

.emji-caution { padding: 18px 20px; border-radius: 12px; background: var(--_off); border-left: 3px solid var(--_teal); }
.emji-caution__title { margin: 0 0 6px; font-weight: 500; }
.emji-caution ul { margin: 0; padding-left: 1.2em; line-height: 1.9; font-size: 14px; }

.emji-photos { display: grid; gap: 14px; }
.emji-photo-add { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 160px; border: 1.5px dashed #9AB3B2; border-radius: var(--_radius); background: #FBFCFC; cursor: pointer; text-align: center; transition: background .2s, border-color .2s; }
.emji-photo-add:hover { background: #F3F7F6; border-color: var(--_teal); }
.emji-photo-add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.emji-photo-add__icon { color: var(--_teal); }
.emji-photo-add__label { font-size: 17px; font-weight: 500; }
.emji-photo-add__sub { font-size: 14px; color: var(--_muted); }
.emji-photo-add:focus-within { outline: 3px solid rgba(57,125,128,.35); outline-offset: 2px; }
.emji-photo-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.emji-photo-item { display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: center; padding: 10px; border: 1px solid var(--_line); border-radius: 12px; background: #fff; }
.emji-photo-item img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; background: var(--_off); display: block; }
.emji-photo-item__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.emji-mini { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid #B9C4C4; background: #fff; font: inherit; font-size: 14px; cursor: pointer; color: var(--_ink); }
.emji-mini:hover { border-color: var(--_ink); }
.emji-mini--danger { color: var(--_err); }
.emji-photo-item__meta { font-size: 13px; color: var(--_muted); margin: 0 0 6px; }

/* mask editor */
.emji-mask { position: fixed; inset: 0; z-index: 100000; background: #12181B; display: flex; flex-direction: column; padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); color: #fff; }
.emji-mask__help { margin: 4px 4px 10px; font-size: 14px; line-height: 1.7; text-align: center; word-break: auto-phrase; overflow-wrap: anywhere; }
.emji-mask__stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.emji-mask canvas { max-width: 100%; max-height: 100%; touch-action: none; border-radius: 6px; background: #000; cursor: crosshair; }
.emji-mask__bar { display: flex; gap: 10px; justify-content: center; padding-top: 12px; }
.emji-mask__bar .emji-mini { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); min-height: 48px; padding: 0 18px; }
.emji-mask__bar .emji-mini--ok { background: #fff; color: var(--_ink); border-color: #fff; }

/* ---------- guide ---------- */
.emji-guide { max-width: 640px; margin: 0 auto; }
.emji-guide__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; min-height: 44px; }
.emji-guide__progress { flex: 1; height: 3px; background: var(--_line); border-radius: 3px; overflow: hidden; }
.emji-guide__progress i { display: block; height: 100%; background: var(--_teal); transition: width .4s var(--_ease); }
.emji-guide__count { font-size: 14px; color: var(--_muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.emji-guide__count small { display: block; font-size: 13px; text-align: right; color: var(--_teal-dark); }
.emji-guide__status { display: flex; gap: 10px; align-items: flex-start; margin: -6px 0 20px; padding: 10px 14px; font-size: 14px; color: var(--_muted); background: var(--_off); border-radius: 10px; }
.emji-guide__status::before { content: ""; flex: none; width: 14px; height: 1px; margin-top: .85em; background: var(--_gold); }
.emji-guide__back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 10px 0 4px; background: none; border: 0; font: inherit; font-size: 14px; color: var(--_ink); cursor: pointer; border-radius: 8px; }
.emji-guide__back:hover { background: var(--_off); }
.emji-guide__back[hidden] { display: none; }
.emji-guide__q { font-size: clamp(21px, 5.6vw, 27px); font-weight: 500; line-height: 1.55; letter-spacing: .03em; margin: 0 0 8px; }
.emji-guide__help { margin: 0 0 18px; color: var(--_muted); font-size: 14px; }
.emji-guide__opts { display: grid; gap: 10px; margin-top: 22px; }
.emji-guide__opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 64px; padding: 16px 20px; font: inherit; font-size: 17px; text-align: left; color: var(--_ink); background: #fff; border: 1px solid var(--_line); border-radius: 14px; cursor: pointer; transition: border-color .2s, background .2s, transform .15s var(--_ease), box-shadow .2s; -webkit-tap-highlight-color: transparent; }
.emji-guide__opt::after { content: ""; flex: none; width: 9px; height: 9px; border-top: 1.5px solid var(--_teal); border-right: 1.5px solid var(--_teal); transform: rotate(45deg); }
/* スマホは指を離したあとも :hover が残り、次の質問の同じ位置の選択肢が選ばれたように見えるため、マウス操作のときだけ */
@media (hover: hover) { .emji-guide__opt:hover { border-color: var(--_teal); box-shadow: 0 6px 18px rgba(32,39,43,.06); } }
.emji-guide__opt:active { transform: scale(.985); background: #F3F7F6; }
.emji-guide__opt.is-selected { border-color: var(--_navy); background: #F3F7F6; }
.emji-guide__opt:focus-visible { outline: 3px solid rgba(57,125,128,.4); outline-offset: 2px; }
.emji-guide__panel { animation: emji-in .35s var(--_ease) both; }
.emji-guide__panel:focus { outline: none; }
.emji-guide__resume { margin: 0 0 18px; padding: 14px 16px; background: var(--_off); border-radius: 12px; font-size: 14px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.emji-summary { border: 1px solid var(--_line); border-radius: var(--_radius); background: #fff; overflow: hidden; margin: 18px 0; }
.emji-summary__row { display: grid; grid-template-columns: 6.5em 1fr; gap: 12px; align-items: baseline; padding: 12px 16px; border-top: 1px solid var(--_line); }
.emji-summary__row:first-child { border-top: 0; }
@media (min-width: 600px) { .emji-summary__row { grid-template-columns: 11em 1fr; gap: 16px; padding: 14px 18px; } }
.emji-summary__q { font-size: 14px; color: var(--_muted); }
.emji-summary__a { font-weight: 500; }
.emji-notes { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 10px; }
.emji-notes li { padding: 14px 16px 14px 44px; position: relative; background: var(--_off); border-radius: 12px; font-size: 14px; line-height: 1.8; }
.emji-notes li::before { content: "i"; position: absolute; left: 14px; top: 15px; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--_teal); color: var(--_teal); font-size: 12px; font-weight: 700; text-align: center; line-height: 17px; font-style: normal; }
.emji-guide__actions { display: grid; gap: 10px; }
.emji-guide__actions .emji-btn { width: 100%; }
.emji-guide__fine { font-size: 14px; color: var(--_muted); text-align: center; margin: 14px 0 0; }
.emji-guide__fine span { display: inline-block; }
.emji-guide__redo { margin: 18px 0 0; text-align: center; }
.emji-guide__restart { min-height: 44px; padding: 0 12px; font: inherit; font-size: 14px; color: var(--_muted); background: none; border: 0; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.emji-guide__restart:focus-visible { outline: 3px solid rgba(57,125,128,.4); outline-offset: 2px; border-radius: 6px; }

/* ---------- FAQ ---------- */
.emji-faq { border-top: 1px solid var(--emj-line, #D9E0E0); }
.emji-faq__item { border-bottom: 1px solid var(--emj-line, #D9E0E0); }
.emji-faq__q { list-style: none; display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 22px 4px; cursor: pointer; font-size: 16px; font-weight: 500; line-height: 1.7; }
.emji-faq__q::-webkit-details-marker { display: none; }
.emji-faq__mark { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--emj-sage, #DCE7E3); color: var(--emj-navy, #183A4A); font-size: 13px; font-weight: 500; }
.emji-faq__icon { width: 14px; height: 14px; position: relative; }
.emji-faq__icon::before, .emji-faq__icon::after { content: ""; position: absolute; left: 0; top: 50%; width: 14px; height: 1.5px; background: var(--emj-charcoal, #20272B); transition: transform .3s cubic-bezier(.2,.7,.2,1); }
.emji-faq__icon::after { transform: rotate(90deg); }
.emji-faq__item[open] .emji-faq__icon::after { transform: rotate(0); }
.emji-faq__q:focus-visible { outline: 3px solid rgba(57,125,128,.4); outline-offset: 2px; border-radius: 6px; }
.emji-faq__a { padding: 0 4px 24px 48px; line-height: 1.95; color: #39444A; }
.emji-faq__a p { margin: 0 0 .8em; }
.emji-faq__a p:last-child { margin-bottom: 0; }
.emji-faq-group { margin-bottom: 56px; }
.emji-faq-group__title { font-size: 19px; font-weight: 500; letter-spacing: .04em; margin: 0 0 8px; }

/* ---------- chat ---------- */
.emji-chat { position: fixed; z-index: 9990; right: 20px; bottom: 20px; }
.emji-chat__launcher { display: inline-flex; align-items: center; gap: 8px; min-height: 56px; padding: 0 22px 0 18px; border-radius: 999px; border: 0; background: var(--_teal); color: #fff; font: inherit; font-size: 15px; font-weight: 500; letter-spacing: .05em; cursor: pointer; box-shadow: 0 10px 28px rgba(57,125,128,.28); transition: transform .2s var(--_ease), box-shadow .2s; }
.emji-chat__launcher:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(24,58,74,.3); }
.emji-chat__launcher:focus-visible { outline: 3px solid rgba(57,125,128,.5); outline-offset: 3px; }
.emji-chat.is-open .emji-chat__launcher { opacity: 0; pointer-events: none; }
.emji-chat__panel { position: fixed; right: 20px; bottom: 20px; width: 400px; max-width: calc(100vw - 40px); height: min(640px, calc(100vh - 40px)); display: flex; flex-direction: column; background: #fff; border-radius: 20px; box-shadow: 0 24px 60px rgba(20,30,35,.22); overflow: hidden; animation: emji-pop .3s var(--_ease) both; }
.emji-chat__panel[hidden] { display: none; }
@keyframes emji-pop { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.emji-chat__head { display: flex; justify-content: space-between; align-items: flex-start; padding: 18px 16px 12px 22px; border-bottom: 1px solid var(--_line); }
.emji-chat__title { margin: 0; font-size: 16px; font-weight: 500; letter-spacing: .05em; }
.emji-chat__sub { margin: 2px 0 0; font-size: 13px; color: var(--_muted); }
.emji-chat__close { width: 44px; height: 44px; border: 0; background: none; border-radius: 50%; cursor: pointer; color: var(--_ink); display: inline-flex; align-items: center; justify-content: center; }
.emji-chat__close:hover { background: var(--_off); }
.emji-chat__mode { margin: 0; padding: 10px 22px; font-size: 13px; line-height: 1.7; color: var(--_muted); background: var(--_off); }
.emji-chat__log { flex: 1; overflow-y: auto; padding: 18px 18px 6px; display: flex; flex-direction: column; gap: 12px; overscroll-behavior: contain; }
.emji-msg { max-width: 88%; padding: 12px 16px; border-radius: 16px; font-size: 15px; line-height: 1.85; animation: emji-in .3s var(--_ease) both; word-break: break-word; }
.emji-msg p { margin: 0 0 .5em; }
.emji-msg p:last-child { margin: 0; }
.emji-msg--bot { background: var(--_off); border-top-left-radius: 4px; align-self: flex-start; }
.emji-msg--user { background: var(--_navy); color: #fff; border-top-right-radius: 4px; align-self: flex-end; }
.emji-msg__title { font-size: 13px; color: var(--_muted); margin-bottom: 4px !important; }
.emji-msg__cta { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; margin-top: 8px; border-radius: 999px; background: var(--_teal); color: #fff !important; text-decoration: none; font-size: 14px; font-weight: 500; }
.emji-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.emji-chip { min-height: 40px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--_line); background: #fff; font: inherit; font-size: 14px; color: var(--_ink); cursor: pointer; text-align: left; line-height: 1.5; transition: border-color .2s, background .2s; }
@media (hover: hover) { .emji-chip:hover { border-color: var(--_teal); background: #F3F7F6; } }
.emji-chat__typing { display: flex; align-items: center; gap: 10px; margin: 0; padding: 6px 22px 10px; font-size: 13px; color: var(--_muted); }
.emji-chat__typing[hidden] { display: none; }
.emji-dots { display: inline-flex; gap: 4px; }
.emji-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--_teal); animation: emji-dot 1.2s infinite ease-in-out; }
.emji-dots i:nth-child(2) { animation-delay: .15s; }
.emji-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes emji-dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.emji-chat__form { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--_line); }
.emji-chat__input { flex: 1; min-width: 0; min-height: 50px; padding: 0 16px; font: inherit; font-size: 16px; border: 1px solid #B9C4C4; border-radius: 999px; background: #fff; color: var(--_ink); }
.emji-chat__input:focus { outline: none; border-color: var(--_teal); box-shadow: 0 0 0 3px rgba(57,125,128,.18); }
.emji-chat__send { flex: none; width: 50px; height: 50px; border-radius: 50%; border: 0; background: var(--_teal); color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.emji-chat__send:disabled { opacity: .5; }
.emji-chat__foot { margin: 0; padding: 0 18px 14px; font-size: 13px; color: var(--_muted); line-height: 1.7; }
.emji-chat__foot a { color: var(--_navy); }
@media (max-width: 599px) {
	.emji-chat__panel { right: 0; bottom: 0; left: 0; width: 100%; max-width: none; height: 100%; height: 100dvh; border-radius: 0; padding-bottom: env(safe-area-inset-bottom); }
	.emji-chat__head { padding-top: max(14px, env(safe-area-inset-top)); }
}

@media (prefers-reduced-motion: reduce) {
	.emji-form *, .emji-guide *, .emji-chat *, .emji-done { animation: none !important; transition: none !important; }
}

/* 日本語の設問・見出しは文節で改行（「〜です/か？」のような改行を防ぐ） */
.emji-guide__q, .emji-step__q, .emji-done__title, .emji-faq__qtext, .emji-chat__sub, .emji-guide__help, .emji-done__body, .emji-form__notice, .emji-form__lead, .emji-guide-carry__note {
	word-break: auto-phrase;
	overflow-wrap: anywhere;
	text-wrap: pretty;
	line-break: strict;
}
.emji-guide__q, .emji-step__q { text-wrap: balance; }
.emji-notes li { overflow-wrap: anywhere; line-break: strict; }
/* 開いている間はログイン中の管理バーより前面に */
.emji-chat.is-open { z-index: 100000; }
/* 画面遷移時にプログラムで移すフォーカスは枠を出さない（読み上げ位置の移動のみ） */
.emji-form [tabindex="-1"]:focus, .emji-guide [tabindex="-1"]:focus { outline: none; }

/* 困りごとの補足（専門用語の言いかえ） */
.emji-choice > span { flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; }
.emji-choice small { font-size: 13px; color: var(--_muted); line-height: 1.6; }
/* 撮影のコツ */
.emji-tips { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.emji-tips li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; font-size: 15px; line-height: 1.75; word-break: auto-phrase; overflow-wrap: anywhere; }
.emji-tips span { width: 26px; height: 26px; border-radius: 50%; background: var(--_sage); color: var(--_navy); font-size: 13px; display: inline-flex; align-items: center; justify-content: center; margin-top: 1px; }
/* メールアドレスの注意（送信は止めない） */
.emji-hint { word-break: auto-phrase; overflow-wrap: anywhere; margin: 0; padding: 12px 14px; border-radius: 10px; background: #FBF6EA; border: 1px solid #EBDDB8; font-size: 14px; line-height: 1.75; color: #5A4A1E; }
.emji-hint__fix { margin-left: 6px; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid #C9B37A; background: #fff; font: inherit; font-size: 14px; cursor: pointer; }
.emji-form [hidden].emji-hint { display: none !important; }
/* 段階式フォームの設問（legend）は、項目名ではなく質問の大きさで表示 */
.emji-field > legend.emji-step__q { font-size: clamp(19px, 4.8vw, 23px); font-weight: 500; line-height: 1.6; margin-bottom: 14px; word-break: auto-phrase; overflow-wrap: anywhere; }
.emji-choice small { word-break: auto-phrase; overflow-wrap: anywhere; }

/* 見積もり前の必須の質問 */
.emji-gate { margin-bottom: 8px; }
.emji-gate__label { display: flex; align-items: center; gap: 12px; margin: 0 0 10px; font-size: 14px; letter-spacing: .1em; color: var(--_muted); }
.emji-gate__label::before { content: ""; width: 32px; height: 1px; background: var(--_gold); }
.emji-gate__title { margin: 0; font-size: clamp(21px, 5.4vw, 26px); font-weight: 500; line-height: 1.55; letter-spacing: .04em; word-break: auto-phrase; overflow-wrap: anywhere; }
.emji-gate__lead { margin: 12px 0 28px; line-height: 1.9; color: #39444A; word-break: auto-phrase; overflow-wrap: anywhere; }
.emji-gate .emji-guide { padding-top: 24px; border-top: 1px solid var(--_line); }
.emji-gate[hidden], form.emji-form[hidden] { display: none !important; }
.emji-guide-carry__list dd, .emji-summary__a { word-break: auto-phrase; overflow-wrap: anywhere; }

/* ---------- 離脱案内（最後の質問の手前で、1訪問1回だけ） ---------- */
html.emji-leave-open { overflow: hidden; }
.emji-leave { position: fixed; inset: 0; z-index: 100000; display: flex; align-items: flex-end; justify-content: center; }
.emji-leave__backdrop { position: absolute; inset: 0; background: rgba(24,58,74,.55); animation: emji-fade .2s ease both; }
.emji-leave__box { position: relative; width: 100%; max-width: 520px; max-height: calc(100vh - 24px); overflow: auto; padding: 28px 22px calc(22px + env(safe-area-inset-bottom)); background: #fff; border-radius: 20px 20px 0 0; box-shadow: 0 -10px 40px rgba(24,58,74,.18); animation: emji-in .3s var(--_ease) both; }
@media (min-width: 600px) { .emji-leave { align-items: center; padding: 24px; } .emji-leave__box { border-radius: 20px; padding: 36px 36px 32px; } }
.emji-leave__label { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-size: 15px; font-weight: 500; color: var(--_teal-dark); }
.emji-leave__label::before { content: ""; width: 24px; height: 1px; background: var(--_gold); }
.emji-leave__title { margin: 0 0 18px; font-size: clamp(21px, 5.6vw, 25px); font-weight: 500; line-height: 1.55; letter-spacing: .03em; color: var(--_navy); }
.emji-leave__progress { height: 3px; background: var(--_line); border-radius: 3px; overflow: hidden; }
.emji-leave__progress i { display: block; height: 100%; background: var(--_teal); }
.emji-leave__count { margin: 8px 0 16px; font-size: 14px; color: var(--_muted); font-variant-numeric: tabular-nums; }
.emji-leave__body { margin: 0 0 22px; font-size: 15px; line-height: 1.85; word-break: auto-phrase; overflow-wrap: anywhere; }
.emji-leave__actions { display: grid; gap: 10px; }
.emji-leave__actions .emji-btn { width: 100%; min-width: 0; }
.emji-leave__note { margin: 10px 0 0; font-size: 14px; color: var(--_muted); text-align: center; overflow-wrap: anywhere; }
@keyframes emji-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .emji-leave__backdrop, .emji-leave__box { animation: none; } }

/* 質問文作成ジェネレーター */
.emji-qb__out { margin-top: 24px; padding: 20px; border-radius: 16px; background: rgba(24, 58, 74, .05); }
.emji-qb__title { margin: 0 0 8px; font-weight: 600; }
.emji-qb__hints { margin: 0 0 10px; padding-left: 1.2em; font-size: 14px; line-height: 1.8; }
.emji-qb__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.emji-qb__filled { margin: 0 0 16px; padding: 10px 14px; border-radius: 10px; background: rgba(24, 58, 74, .06); font-size: 14px; }
