:root{
  --bg:#f5f7fb;
  --card:#fff;
  --text:#1f2937;
  --muted:#6b7280;
  --primary:#2563eb;
  --primary-weak:#dbeafe;
  --ghost:#e5e7eb;
  --border:#e5e7eb;
  --accent:#3b82f6;
  --danger:#ef4444;
  --danger-weak:#fee2e2;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:"Inter","Noto Sans JP",system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,"Helvetica Neue",Arial,"Apple Color Emoji","Segoe UI Emoji";
  color:var(--text); background:var(--bg);
  line-height:1.65;
}

.container{max-width:1100px; margin:0 auto; padding:16px}
.container--narrow{max-width:880px}

.hero{text-align:center; padding:18px 0 12px}
.hero--spacious{padding:26px 0 16px}
.hero h1{margin:0 0 8px; font-size:28px; font-weight:800}
.hero p{margin:0 0 12px; color:var(--muted)}
.accent{color:var(--accent)}

.card{
  background:var(--card); border-radius:14px;
  box-shadow:0 10px 30px rgba(37,99,235,.10);
  overflow:hidden; border:1px solid #eef2ff;
}
.head{padding:14px 16px; border-bottom:1px solid var(--border)}
.head h2{margin:0; font-size:18px}
.body{padding:18px}

.small{color:var(--muted); font-size:12px}
.dim{opacity:.85}
.link{color:var(--primary); text-decoration:none}
.link:hover{text-decoration:underline}

/* スタック余白（カード間） */
.stack-lg > * + *{ margin-top:18px; }

/* 読みやすい本文 */
.prose p{margin:0 0 10px; font-size:15.5px; line-height:1.85}
.prose ul, .prose ol{margin:0 0 12px 0; padding-left:1.2rem}
.prose li{margin:6px 0}

.pillwrap{display:flex; flex-wrap:wrap; gap:10px; align-items:center; justify-content:center}
.pill{
  border:1px solid var(--border);
  border-radius:999px; padding:8px 12px; background:#fafafa
}
.pill--blue{
  border-color:#bfdbfe; background:var(--primary-weak); color:#1e3a8a;
}

.actions{display:flex; gap:10px; flex-wrap:wrap}
.actions--tight{gap:8px}
.center-actions{justify-content:center}

.btn{
  padding:10px 14px; font-size:14px; border:0; border-radius:10px; cursor:pointer;
  transition:transform .06s ease, filter .15s ease;
}
.btn.primary{background:var(--primary); color:#fff}
.btn.primary:hover{filter:brightness(1.05)}
.btn.ghost{background:var(--ghost)}
.btn:active{transform:translateY(1px)}

footer{text-align:center; padding:10px 0 30px; color:var(--muted)}

.badge{
  display:inline-block; padding:6px 10px; border-radius:999px;
  background:#eef2ff; color:#1e3a8a; border:1px solid #c7d2fe; font-weight:600;
}

/* Grid helpers */
.grid-2{display:grid; grid-template-columns:1fr 1fr; gap:12px}
@media (max-width:800px){ .grid-2{grid-template-columns:1fr} }

.row{display:grid; gap:6px; margin:10px 0}
label{font-weight:600}
select, input[type="text"], textarea{
  padding:12px 12px; border-radius:10px; border:1px solid var(--border); width:100%;
  outline:none; transition:box-shadow .2s ease, border-color .2s ease; background:#fff;
}
select:focus, input[type="text"]:focus, textarea:focus{
  border-color:#93c5fd; box-shadow:0 0 0 4px rgba(147,197,253,.35)
}

/* エラースタイル */
.is-invalid{
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px rgba(239,68,68,.15) !important;
}
.error-msg{
  color:var(--danger); background:var(--danger-weak);
  border:1px solid #fecaca; border-radius:8px; padding:6px 10px; margin-top:6px; font-size:12px;
}
.error-summary{
  color:var(--danger); background:var(--danger-weak);
  border:1px solid #fecaca; border-radius:10px; padding:10px 12px; margin-bottom:12px;
}

/* ====== 上部バー・中央キャンバス ====== */
.topbar{margin-top:6px}
.topbar__inner{display:flex; align-items:center; justify-content:space-between; gap:12px}
.topbar.sticky{
  position:sticky; top:0; z-index:100; backdrop-filter:saturate(1.2) blur(4px);
}

/* キャンバスの中央配置 */
.center-card{ margin-top:16px; }
.canvas-outer{ display:flex; align-items:center; justify-content:center; padding:12px; }
.center-note{ text-align:center; margin-top:8px; }

/* === ここだけ修正：Canvasを端末に依存せず固定サイズに === */
.canvas-wrap{display:grid; place-items:center}
canvas{
  display:block;
  width:500px;               /* ← 固定 */
  height:500px;              /* ← 固定 */
  max-width:none;            /* ← 可変上限を解除 */
  max-height:none;           /* ← 可変上限を解除 */
  border:2px solid var(--primary);
  background:#fff;
  touch-action:none;
  border-radius:10px;
  box-shadow:0 10px 24px rgba(37,99,235,.08);
}

/* Consent checkbox */
.consent-check{display:flex; align-items:flex-start; gap:10px; margin:12px 0 2px}
.consent-check input{margin-top:4px}

/* ====== Modal ====== */
.modal{position:fixed; inset:0; display:none; z-index:1000}
.modal[aria-hidden="false"]{display:block}
.modal__backdrop{position:absolute; inset:0; background:rgba(0,0,0,.35)}
.modal__content{
  position:relative; margin:8vh auto 0; max-width:720px; background:#fff;
  border-radius:14px; border:1px solid var(--border);
  box-shadow:0 10px 30px rgba(37,99,235,.15); overflow:hidden;
}
.modal__head{display:flex; align-items:center; justify-content:space-between;
  padding:12px 16px; border-bottom:1px solid var(--border)}
.modal__body{padding:16px}
.modal__close{border:none; background:transparent; font-size:20px; cursor:pointer; line-height:1}

/* ===== 可読性 & アクセシビリティの底上げ ===== */

/* 流体タイポグラフィ（画面幅に応じて自然に拡縮） */
:root{
  --fs-sm: clamp(12px, 0.85rem, 14px);
  --fs-body: clamp(15px, 1rem + 0.25vw, 17px);
  --fs-h2: clamp(18px, 1.05rem + 0.6vw, 22px);
  --fs-h1: clamp(24px, 1.2rem + 1.2vw, 32px);
}
body{ font-size: var(--fs-body); }
.hero h1{ font-size: var(--fs-h1); }
.head h2{ font-size: var(--fs-h2); }
.small{ font-size: var(--fs-sm); }

/* カード内の行間＆余白を少し広げる */
.prose p{ line-height: 1.95; }
.body{ padding: clamp(16px, 2.5vw, 22px); }
.head{ padding: clamp(12px, 2vw, 16px) clamp(16px, 2.5vw, 20px); }

/* コンテナの左右余白（モバイルで窮屈にならないよう微調整） */
@media (max-width: 560px){
  .container{ padding: 12px; }
  .container--narrow{ padding: 12px; }
}

/* クリック/タップしやすさ：高さ＆フォーカス可視性の統一 */
.btn, select, input[type="text"], textarea{
  min-height: 44px;
}
a:focus-visible, button:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible{
  outline: 3px solid rgba(37,99,235,.35);
  outline-offset: 2px;
  border-radius: 10px;
}

/* ボタンのラベルが折り返す時の見栄え */
.btn{ padding: 12px 16px; line-height: 1.3; }

/* エラーの視認性を強化（ピクト追加＆余白） */
.error-msg{ display: block; }
.error-msg::before{
  content: "⚠︎";
  font-weight: 700;
  margin-right: 6px;
}
.error-summary ul{ margin: 6px 0 0 18px; }

/* stickyトップバーの背景・罫線で重なりを見やすく */
.topbar.sticky{
  background: rgba(255,255,255,.9);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0,0,0,.03);
}

/* 同意ページなどで使う装飾（ある場合に効く） */
.prose .lead{ font-size: clamp(16px, 1rem + 0.3vw, 18px); line-height: 2; }
.highlight-list{ list-style: none; padding-left: 0; margin: 12px 0; }
.highlight-list li{ display: flex; gap: 8px; align-items: flex-start; margin: 8px 0; }
.hl-ico{
  display: inline-grid; place-items: center;
  width: 20px; height: 20px; border-radius: 999px;
  background: var(--primary-weak); color:#1e3a8a; font-weight: 800; font-size: 12px;
}
.callout{
  border:1px solid #e5e7eb; border-radius:12px; padding:12px; background:#fafafa;
}
.callout--info{
  border-color:#c7d2fe; background: var(--primary-weak); color:#1e3a8a;
}
.sticky-cta{
  position: sticky; bottom: 12px; z-index: 50;
  background: rgba(255,255,255,.92); backdrop-filter: saturate(1.1) blur(6px);
  border: 1px solid var(--border); border-radius: 14px;
  padding: 10px; margin-top: 14px;
  box-shadow: 0 10px 24px rgba(37,99,235,.10);
}

/* 進行ステップ（consentで利用していれば効く） */
.steps{
  display:flex; gap:10px; justify-content:center; align-items:center; margin-top:6px;
}
.step{
  display:flex; flex-direction:column; align-items:center; gap:6px;
  padding:10px 12px; border:1px solid var(--border); background:#fff; border-radius:12px;
  min-width:80px;
}
.step span{
  display:inline-grid; place-items:center; width:28px; height:28px; border-radius:999px;
  background:#e5e7eb; font-weight:800;
}
.step small{ color:var(--muted); font-size:12px; }
.step--active{ border-color:#c7d2fe; box-shadow:0 6px 16px rgba(37,99,235,.12); }
.step--active span{ background: var(--primary); color:#fff; }

/* ===== Consent page readability overrides ===== */
body { line-height: 1.9; }

.hero h1 { font-size: 24px; }
.head h2 { font-size: 16px; }

.prose p,
.prose li { font-size: 14px; line-height: 1.95; }

.prose .lead { font-size: 15px; font-weight: 500; }

.small { font-size: 11.5px; }

.card .body { padding: 16px; }
.head { padding: 12px 16px; }

.consent-check span { font-size: 14px; }

/* 念のため：色で囲う“呼び出し枠”を使っていても無彩色に戻す */
.callout {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0;
}

/* 進行ステップがある場合の微調整（小さめ表示） */
.steps { display:flex; gap:8px; justify-content:center; margin: 8px 0 0; }
.step { display:flex; align-items:center; gap:6px; font-size:12px; color: var(--muted); }
.step span {
  display:inline-grid; place-items:center;
  width:20px; height:20px; border-radius:999px;
  background:#eef2ff; color:#1e3a8a; font-weight:700;
  border:1px solid #c7d2fe;
}
.step--active { color: var(--text); }

/* アイコンのみボタン */
.icon-only {
  padding: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.icon-only svg { width: 20px; height: 20px; }

/* 説明書ボタン行の揃え */
.inline-dl{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.inline-dl .btn{
  --btn-h: 44px;
  height: var(--btn-h);
  padding: 0 14px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  vertical-align:middle;
  line-height:1;
}
.inline-dl .btn.icon-only{ width: var(--btn-h); padding:0; }
.inline-dl .btn.icon-only svg{ width:20px; height:20px; }

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(100%);
  pointer-events: none;
}
.btn.primary { background:#2563eb; color:#fff; }
.btn.primary:hover:enabled { filter:brightness(1.05); }

.va-map-wrap{
  display:flex;
  flex-direction:column;
  align-items:center;
}
#vaMapTop, #vaMapFocus{
  max-width: 240px;
  width: 220px;
  height: 220px;
  border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.08) inset;
}

/* --- VAミニマップの青枠を完全に無効化 --- */
.vamap { outline:none !important; border:none !important; box-shadow:none !important; }
.vamap canvas { border:0 !important; outline:0 !important; }
.vamap:focus, .vamap canvas:focus { outline:none !important; }

/* ---- 情報ボックス（枠で囲う） ---- */
.info-box{
  max-width: 520px;
  margin: 10px auto;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fafafa;
  padding: 10px 12px;
  text-align: left;
}
.info-box__label{
  font-size: 12px;
  color: #6b7280;
  letter-spacing: .02em;
  margin-bottom: 4px;
}
.info-box__value{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 15px;
  color: #111827;
}

/* 小さめコピーアイコンボタン */
.copy-btn{
  border: 1px solid #c7d2fe;
  background: #eef2ff;
  color: #374151;
  border-radius: 8px;
  cursor: pointer;
  transition: transform .06s ease, box-shadow .12s ease;
}
.copy-btn--icon{
  width: 30px; height: 30px; padding: 0; line-height: 1;
  display:flex; align-items:center; justify-content:center;
}
.copy-btn:hover{ transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.copy-btn:active{ transform: translateY(0); }

/* コピーの小トースト */
.copy-toast{
  position: fixed; left: 50%; bottom: 72px; transform: translateX(-50%);
  background: #111827; color: #fff; padding: 8px 12px; border-radius: 10px;
  font-size: 12px; opacity: 0; pointer-events: none; transition: opacity .18s ease;
  box-shadow: 0 6px 16px rgba(0,0,0,.18);
}
.copy-toast.show{ opacity: .92; }

/* 枠外・小さめ撤回ボタン（中央） */
.withdraw-cta{
  text-align: center;
  margin: 8px 0 14px;
  color: #6b7280;
}
.btn.tiny{ font-size: 12px; padding: 5px 10px; border-radius: 999px; }
.btn.ghost{ border: 1px solid #d1d5db; background: #fff; color: #374151; }
.sep{ margin: 16px 0; border: 0; height: 1px; background: #e5e7eb; }
.mt-8{ margin-top: 8px; }

/* ---- 情報ボックス ---- */
.info-box{
  max-width: 520px;
  margin: 10px auto;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fafafa;
  padding: 10px 12px;
}
.info-box__label{
  font-size: 12px;
  color: #6b7280;
  letter-spacing: .02em;
  margin-bottom: 4px;
  text-align: center;
}
.info-box__value{
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 15px;
  color: #111827;
}
.info-box__value--center{ justify-content: center; }

.copy-btn{
  border: 1px solid #c7d2fe;
  background: #eef2ff;
  color: #374151;
  border-radius: 8px;
  cursor: pointer;
  transition: transform .06s ease, box-shadow .12s ease;
}
.copy-btn--icon{
  width: 28px; height: 28px;
  padding: 0; line-height: 1;
  display:flex; align-items:center; justify-content:center;
  font-size: 14px;
}
.copy-btn:hover{ transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.copy-btn:active{ transform: translateY(0); }

.copy-toast{
  position: fixed; left: 50%; bottom: 72px; transform: translateX(-50%);
  background: #111827; color: #fff; padding: 8px 12px; border-radius: 10px;
  font-size: 12px; opacity: 0; pointer-events: none; transition: opacity .18s ease;
  box-shadow: 0 6px 16px rgba(0,0,0,.18);
}
.copy-toast.show{ opacity: .92; }

/* ---- 枠外・小さめ撤回リンク（スクショ風） ---- */
.withdraw-inline{
  text-align: center;
  margin: 16px 0 8px;
  color: #6b7280;
}
.withdraw-inline__link{
  display: inline-block;
  font-size: 14px;
  color: #3b82f6;
  text-decoration: none;
  border-bottom: 1px solid rgba(59,130,246,.35);
  padding-bottom: 2px;
}
.withdraw-inline__link:hover{
  color: #1d4ed8;
  border-bottom-color: rgba(29,78,216,.5);
}
.withdraw-inline__note{
  display: block;
  font-size: 12px;
  margin-top: 6px;
  color: #9ca3af;
}

.sep{ margin: 16px 0; border: 0; height: 1px; background: #e5e7eb; }
.mt-8{ margin-top: 8px; }

/* 統一のためのコントロール高さ */
:root { --ctl-h: 44px; }

/* すべての入力を同じ見た目に統一 */
select,
input[type="text"],
input[type="number"],
textarea {
  width: 100%;
  padding: 12px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  outline: none;
  transition: box-shadow .2s ease, border-color .2s ease;
  min-height: var(--ctl-h);
  line-height: 1.3;
  font-size: 14px;
  box-sizing: border-box;
}

/* フォーカス時（統一） */
select:focus,
input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(147,197,253,.35);
}

/* 数値入力の端末差を軽減（必要なら） */
input[type="number"] {
  -webkit-appearance: none;
  appearance: none;
}

/* Chrome スピンボタン（任意） */
/*
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
*/

select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 36px;
}

/* Controls: 同じ高さ・同じ内側余白・同じ行揃え */
:root { --ctl-h: 44px; }
select,
input[type="number"] {
  height: var(--ctl-h);
  line-height: calc(var(--ctl-h) - 2px);
  padding: 0 12px;
  width: 100%;
  box-sizing: border-box;
  vertical-align: middle;
}
select { -webkit-appearance: none; appearance: none; padding-right: 36px; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

.row { align-items: start; }
label { line-height: 1.2; }

select:focus,
input[type="number"]:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(147,197,253,.35);
}

.is-invalid {
  height: var(--ctl-h);
  line-height: calc(var(--ctl-h) - 2px);
}

/* === Canvas & VA map: responsive, device-agnostic === */
:root{
  /* Canvas は最大 360px。狭い端末では 300px まで自動で縮む */
  --canvas-size: clamp(300px, 85vmin, 360px);
  /* VA ミニマップは最大 220px。狭い端末では 160px まで縮む */
  --vamap-size: clamp(160px, 40vmin, 220px);
}

/* キャンバスの中央配置は既存のまま */
.canvas-wrap{ display:grid; place-items:center }

/* ここを置き換え：端末に依存せず “同じ見た目上限” を維持しつつ縮む */
canvas{
  display:block;
  width: var(--canvas-size);
  height: var(--canvas-size);
  border:2px solid var(--primary);
  background:#fff;
  touch-action:none;
  border-radius:10px;
  box-shadow:0 10px 24px rgba(37,99,235,.08);
}

/* VAミニマップ（Top/Focus）も可変に */
#vaMapTop, #vaMapFocus{
  width: var(--vamap-size);
  height: var(--vamap-size);
  max-width: none;
  max-height: none;
  border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.08) inset;
}
