/* 色は会社HP（bizport.cloud）にそろえる。印（赤・黄・灰・青・緑）の色は、見分けやすさのため変えない */
:root {
  --bg: #f5f8fc; --card: #fff; --ink: #1e293b; --muted: #64748b; --line: #e2e8f0;
  --accent: #1565ff; --accent-deep: #0d47c9; --accent-soft: rgba(21, 101, 255, .12);
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 20px rgba(13, 71, 201, .06);
  --red: #b42318; --red-bg: #fdecea; --yellow: #8a5a00; --yellow-bg: #fff4d6;
  --gray: #475467; --gray-bg: #eceff3; --info: #175cd3; --info-bg: #e8f0fe; --ok: #067647; --ok-bg: #e7f6ee;
}
* { box-sizing: border-box; }
/* hidden の付いた要素は、ボタンなどの display 指定より優先して隠す */
[hidden] { display: none !important; }
/* 書体: 細く潰れる Yu Gothic UI をやめ、Windows 標準のユニバーサルデザイン書体（BIZ UDPゴシック）を先に。外部の書体は読み込まない
   数字は等幅（tabular-nums）にして、金額の桁をそろえる */
body { margin: 0; font-family: "BIZ UDPGothic", "BIZ UDPゴシック", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif; font-variant-numeric: tabular-nums; background: var(--bg); color: var(--ink); line-height: 1.7; -webkit-font-smoothing: antialiased; }
.top { display: flex; align-items: center; gap: 12px; padding: 12px 20px; background: var(--card); border-bottom: 1px solid var(--line); box-shadow: 0 1px 0 rgba(15, 23, 42, .02); }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; color: var(--accent-deep); text-decoration: none; font-size: 18px; letter-spacing: .02em; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 10px; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-deep)); box-shadow: 0 2px 6px rgba(21, 101, 255, .3); flex: none; }
.top-spacer { flex: 1; }
.top-link { color: var(--muted); text-decoration: none; font-size: 13px; }
.top-link:hover { color: var(--accent-deep); text-decoration: underline; }
@media (max-width: 640px) { .top-link { display: none; } }
.tag { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 1px 8px; }
.banner { background: var(--info-bg); color: var(--info); padding: 8px 16px; font-weight: 700; }
main { max-width: 1280px; margin: 0 auto; padding: 20px 16px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 24px 16px; }
h1 { font-size: 23px; margin: 8px 0 18px; letter-spacing: .01em; }

/* 入口の見出しと、3つの手順（文字だけにしない。アイコンは線画の SVG。絵文字は端末で形が変わるので使わない） */
.hero { text-align: center; padding: 6px 0 4px; }
.hero h1 { font-size: 30px; line-height: 1.5; margin: 0 0 10px; letter-spacing: .01em; }
.hero p { margin: 0 auto; max-width: 640px; color: var(--muted); font-size: 14px; }
@media (max-width: 640px) { .hero h1 { font-size: 22px; } }
.steps { display: flex; align-items: stretch; justify-content: center; gap: 10px; margin: 18px 0 22px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow); min-width: 190px; }
.step .ico { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-deep); flex: none; }
.step b { display: block; font-size: 14px; }
.step span { display: block; font-size: 12px; color: var(--muted); }
.step-arrow { align-self: center; color: #b8c7e6; flex: none; }
@media (max-width: 800px) { .steps { flex-direction: column; align-items: stretch; } .step-arrow { transform: rotate(90deg); align-self: center; } }

/* 主役の箱（自分の書類で試す）と、控えめな箱（サンプル） */
/* 主役の箱: 枠線で囲まず、上に細い帯を敷いて格を付ける（枠線だと広告の枠に見える） */
.card.primary-card { position: relative; padding-top: 26px; overflow: hidden; box-shadow: 0 2px 4px rgba(15, 23, 42, .05), 0 14px 34px rgba(13, 71, 201, .1); }
.card.primary-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 5px; background: linear-gradient(90deg, var(--accent), var(--accent-deep)); }
.card.quiet-card { background: #fbfdff; }
.card-tag { display: inline-block; background: var(--accent-soft); color: var(--accent-deep); font-size: 12px; font-weight: 700; border-radius: 99px; padding: 2px 11px; margin-left: 8px; vertical-align: middle; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.card-head .ico { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-deep); flex: none; }
.card.quiet-card .card-head .ico { background: var(--gray-bg); color: var(--gray); }
.card-head h2 { margin: 0; font-size: 18px; }
h2 { font-size: 17px; margin: 20px 0 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card > h2:first-child { margin-top: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
button, .btn { font: inherit; border-radius: 10px; border: 1px solid #cbd5e1; background: var(--card); padding: 9px 16px; cursor: pointer; color: var(--ink); text-decoration: none; display: inline-block; transition: background-color .15s, border-color .15s, box-shadow .15s, transform .15s; }
button:hover:not(:disabled), .btn:hover { border-color: var(--accent); color: var(--accent-deep); }
button:focus-visible, .btn:focus-visible, a:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; box-shadow: 0 2px 6px rgba(21, 101, 255, .25); }
/* 文字とアイコンを並べるボタン */
button.with-ico, .btn.with-ico { display: inline-flex; align-items: center; gap: 7px; }
button.big { padding: 12px 22px; font-size: 16px; }
button.primary:hover:not(:disabled), .btn.primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); color: #fff; transform: translateY(-1px); box-shadow: 0 6px 14px rgba(13, 71, 201, .25); }
button.danger { color: var(--red); border-color: #f1b5ae; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.link { border: 0; background: none; color: var(--info); padding: 0 4px; text-decoration: underline; box-shadow: none; }
button.link:hover:not(:disabled) { color: var(--accent-deep); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 800px) { .grid2 { grid-template-columns: 1fr; } }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { border-bottom: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: top; font-size: 14px; }
th { color: var(--muted); font-weight: 600; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); background: var(--card); }
th { background: #f8fafc; }
tr:last-child td { border-bottom: 0; }
.badge { display: inline-block; border-radius: 6px; padding: 1px 8px; font-size: 13px; font-weight: 700; margin: 1px 2px 1px 0; }
.b-red { background: var(--red-bg); color: var(--red); }
.b-yellow { background: var(--yellow-bg); color: var(--yellow); }
.b-gray { background: var(--gray-bg); color: var(--gray); }
.b-info { background: var(--info-bg); color: var(--info); }
.b-ok { background: var(--ok-bg); color: var(--ok); }
.b-done { background: var(--gray-bg); color: var(--muted); text-decoration: line-through; font-weight: 400; }
.review { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .review { grid-template-columns: 1fr; } }
.paper { position: sticky; top: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px; box-shadow: var(--shadow); }
.paper .imgbox { overflow: auto; max-height: 80vh; border: 1px solid var(--line); background: #888; }
.paper img { display: block; width: 100%; transform-origin: top left; }
.field { border-bottom: 1px solid var(--line); padding: 10px 4px; }
.field.need { background: var(--red-bg); border-left: 4px solid var(--red); padding-left: 8px; }
.field.warn { background: var(--yellow-bg); border-left: 4px solid var(--yellow); padding-left: 8px; }
.field .label { font-weight: 700; font-size: 14px; }
.field .raw { font-size: 13px; color: var(--muted); }
.field .val { font-size: 16px; margin: 2px 0; }
.field input, .field select, input.code, select#formType { font: inherit; padding: 8px 12px; border: 1.5px solid #cbd5e1; border-radius: 10px; min-width: 0; max-width: 100%; background: #fff; transition: border-color .15s, box-shadow .15s; }
.field input:focus, .field select:focus, input.code:focus, select#formType:focus, .chat-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field .val { font-variant-numeric: tabular-nums; }
.group { margin-top: 16px; font-weight: 700; color: var(--accent); border-bottom: 2px solid var(--accent); padding-bottom: 2px; }
.flagline { margin: 4px 0; font-size: 14px; }
.cmp { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.cmp div { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; }
.progress { height: 10px; background: var(--gray-bg); border-radius: 99px; overflow: hidden; }
.progress div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-deep)); transition: width .3s; }

/* 公開の試用: 読み取りの前の確認、1回試したあとの案内 */
.consent { display: grid; gap: 8px; margin: 8px 0 14px; }
.consent ul { margin: 0; padding: 10px 12px 10px 28px; font-size: 13px; line-height: 1.7; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
/* 確認の4点: ふだんは1行にたたみ、開くと中身が出る（書類を置く前に読むものを減らす） */
.safety { border: 1px solid var(--line); border-radius: 12px; background: #f8fbff; padding: 10px 14px; margin: 0 0 10px; }
.safety > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); }
.safety > summary::-webkit-details-marker { display: none; }
.safety > summary .ico { color: var(--accent-deep); flex: none; display: inline-flex; }
.safety > summary b { font-weight: 700; }
.safety > summary .more { margin-left: auto; color: var(--accent-deep); font-size: 12px; white-space: nowrap; }
.safety[open] > summary .more::after { content: "閉じる"; }
.safety:not([open]) > summary .more::after { content: "くわしく見る"; }
.safety .promises { margin-top: 10px; }
.consent label.agree { font-size: 14px; border-color: #b8c7e6; background: #fff; }
.promises { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 10px; }
@media (max-width: 560px) { .promises { grid-template-columns: 1fr; } }
.promise { display: flex; gap: 9px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: #f8fbff; font-size: 12.5px; line-height: 1.65; }
.promise .ico { color: var(--accent-deep); flex: none; margin-top: 1px; }
.promise b { display: block; font-size: 13px; }
.promise span { color: var(--muted); }
.consent label { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 1.6; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; cursor: pointer; }
.consent input { margin-top: 4px; flex: none; }
.consent label { font-size: 14px; border-color: #b8c7e6; background: #fff; }
button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
/* 「スマホで写真を撮る」は、指で触る端末（スマホ・タブレット）だけに出す。PC では意味が無い */
@media (hover: hover) and (pointer: fine) { .camera-only { display: none; } }
/* 読み取り中は、棒の上を光が流れて「動いている」と分かるようにする */
.progress.running div { min-width: 12%; position: relative; overflow: hidden; }
.progress.running div::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent); animation: nencho-run 1.4s linear infinite; }
@keyframes nencho-run { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .progress.running div::after { animation: none; } }
/* 公開の試用では、本題の「自分の書類で1回試す」を先に（スマホでは上、PC では左） */
.grid2.trial-first > :first-child { order: 2; }
.reg-form { display: grid; gap: 10px; margin: 10px 0; max-width: 460px; }
.reg-form label { display: grid; gap: 4px; font-size: 13px; }
.reg-form label.check { display: flex; gap: 8px; align-items: flex-start; line-height: 1.6; }
.reg-form label.check input { margin-top: 4px; flex: none; }
.reg-form input.code { width: 100%; box-sizing: border-box; }
/* サンプルの一覧: 文字だけのボタンをやめ、アイコン・説明・「試す」の行に */
.sample-list { display: grid; gap: 8px; }
.sample-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--card); }
.sample-item:hover:not(:disabled) { border-color: var(--accent); background: #f8fbff; }
.sample-item .ico { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 11px; background: var(--gray-bg); color: var(--gray); flex: none; }
.sample-item:hover:not(:disabled) .ico { background: var(--accent-soft); color: var(--accent-deep); }
.sample-item .txt { flex: 1; min-width: 0; }
.sample-item .txt b { display: block; font-size: 14px; line-height: 1.5; }
.sample-item .txt span { display: block; font-size: 12px; color: var(--muted); line-height: 1.6; }
.sample-item .go { color: var(--accent-deep); font-size: 13px; font-weight: 700; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
/* 読み取りのボタンのまわり */
.start-row { margin: 16px 0 0; }
.start-hint { display: block; font-size: 12px; color: var(--muted); margin: 0 0 6px; }
.start-note { display: block; font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.next-step { border-color: #b8c7e6; background: #f8fbff; margin-top: 16px; }
.card .next-step { box-shadow: none; margin-bottom: 0; }

/* 書類を置く枠（ドラッグして置ける・クリックして選べる） */
.dropzone { display: block; border: 2px dashed #b8c7e6; border-radius: 14px; padding: 30px 16px; text-align: center; background: #f8fbff; cursor: pointer; transition: border-color .15s, background-color .15s; }
.dropzone strong { font-size: 16px; }
.dropzone .ico { display: inline-flex; align-items: center; justify-content: center; width: 54px; height: 54px; border-radius: 50%; background: #fff; color: var(--accent); border: 1px solid #dbe6fb; margin-bottom: 8px; transition: transform .15s, background-color .15s; }
.dropzone:hover .ico, .dropzone.over .ico { transform: translateY(-2px); background: var(--accent-soft); }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: #eef4ff; }
.dropzone strong { display: block; color: var(--accent-deep); margin-bottom: 4px; }
.dropzone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dropzone .files { margin-top: 8px; font-size: 13px; color: var(--ink); }
.error { color: var(--red); font-weight: 700; }
.notice { background: var(--yellow-bg); border-radius: 8px; padding: 8px 12px; margin: 8px 0; }
ul.tight { margin: 4px 0; padding-left: 20px; }
.hidden-sm { }
@media (max-width: 600px) { .hidden-sm { display: none; } }

/* ---- 質問窓口（画面右下）chat.js ---- */
.chat-fab { position: fixed; right: 20px; bottom: 20px; z-index: 50; border-radius: 999px; padding: 12px 18px; background: var(--accent); color: #fff; border: none; font-weight: 700; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.chat-fab:hover { filter: brightness(1.08); }
.chat-panel { position: fixed; right: 20px; bottom: 78px; z-index: 50; width: 380px; max-width: calc(100vw - 32px); height: min(560px, calc(100vh - 110px)); display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 32px rgba(0,0,0,.18); overflow: hidden; }
.chat-panel[hidden] { display: none; }
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--accent); color: #fff; }
.chat-close { background: none; border: none; color: #fff; font-size: 22px; line-height: 1; padding: 0 4px; }
.chat-note { margin: 0; padding: 6px 14px; font-size: 12px; color: var(--muted); background: var(--bg); border-bottom: 1px solid var(--line); }
.chat-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-msg { max-width: 88%; padding: 8px 12px; border-radius: 12px; white-space: pre-wrap; word-break: break-word; font-size: 14px; line-height: 1.6; }
.chat-msg.bot { align-self: flex-start; background: var(--bg); border: 1px solid var(--line); }
.chat-msg.me { align-self: flex-end; background: var(--accent); color: #fff; }
.chat-msg.wait { color: var(--muted); }
.chat-msg.err { color: var(--red); }
.chat-faq { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 8px; }
.chat-q { font-size: 13px; padding: 4px 10px; border-radius: 999px; }
.chat-form { border-top: 1px solid var(--line); padding: 8px 12px; }
.chat-form[hidden] { display: none; }
.chat-form textarea { width: 100%; font: inherit; font-size: 14px; resize: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.chat-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 6px; }
.chat-count { margin-right: auto; font-size: 12px; color: var(--muted); }
.chat-foot { margin: 0; padding: 6px 12px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
@media (max-width: 600px) {
  .chat-fab { right: 12px; bottom: 12px; }
  .chat-panel { right: 8px; left: 8px; bottom: 64px; width: auto; max-width: none; height: calc(100vh - 90px); }
}
@media print { .chat-fab, .chat-panel { display: none; } }
