:root {
  --brand: #36b595;        /* マイリク メインカラー（ミントグリーン） */
  --brand-dark: #2c9a7f;
  --deep: #35605c;         /* ディープティール：見出し・列見出し */
  --lime: #d2eb77;         /* ライムアクセント */
  --cta: #f14aa4;          /* マイリク CTA ピンク */
  --cta-dark: #d63b90;
  --accent: #e8b83a;       /* ゴールド：注意喚起 */
  --bg: #f3f8f6;           /* うっすら緑がかった背景 */
  --card: #ffffff;
  --text: #3c3c3c;         /* マイリク 本文グレー */
  --muted: #7c8b87;
  --line: #e1ece8;
  --ok: #36b595;
  --radius: 14px;
  --maxw: 560px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  font-family: "M PLUS 1p", mplus-1p, -apple-system, BlinkMacSystemFont, "Segoe UI", "Yu Gothic Medium", "Yu Gothic", YuGothic, "Hiragino Kaku Gothic ProN", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
}

#app {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 16px calc(env(safe-area-inset-bottom) + 16px);
}

.loading { margin: auto; color: var(--muted); }

/* ---- 進捗バー ---- */
.progress-wrap {
  position: sticky;
  top: 0;
  background: var(--bg);
  padding: 12px 0 8px;
  z-index: 5;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: 6px;
}
.progress-track {
  height: 8px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: var(--brand);
  border-radius: 99px;
  transition: width .25s ease;
}

/* ---- カード / 画面 ---- */
.screen {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: 0 1px 3px rgba(20, 30, 60, .06);
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}
.screen.center { justify-content: center; }

.section-tag {
  align-self: flex-start;
  font-size: .78rem;
  font-weight: 700;
  color: var(--brand);
  background: rgba(45, 108, 223, .1);
  padding: 4px 10px;
  border-radius: 99px;
}
.group-label {
  font-size: .9rem;
  color: var(--muted);
  font-weight: 600;
}
.q-text {
  font-size: 1.28rem;
  font-weight: 700;
  line-height: 1.5;
}
h1.title { font-size: 1.4rem; margin: 0; }
h2.title { font-size: 1.2rem; margin: 0; }
p.lead { color: var(--muted); margin: 0; }
.body-text { margin: 0; }
.body-text + .body-text { margin-top: 6px; }

/* ---- 選択肢ボタン ---- */
.choices { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 16px 18px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .12s, background .12s, transform .05s;
}
.choice:active { transform: scale(.99); }
.choice .dot {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--line);
  flex: 0 0 auto;
}
.choice.selected { border-color: var(--brand); background: rgba(45, 108, 223, .06); }
.choice.selected .dot { border-color: var(--brand); background: var(--brand); box-shadow: inset 0 0 0 3px #fff; }

/* ---- 入力フォーム ---- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: .95rem; }
.field .req { color: #dc2626; font-size: .82rem; margin-left: 4px; }
.field input {
  padding: 14px;
  font-size: 1.05rem;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.field input:focus { outline: none; border-color: var(--brand); }
.field .err { color: #dc2626; font-size: .84rem; min-height: 1em; }

.consent-box {
  background: #f0f8f5;
  border: 1px solid #d6ece4;
  border-radius: 12px;
  padding: 14px;
  font-size: .92rem;
  color: #45524f;
}

/* ---- ブランド ロックアップ ---- */
.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  margin-bottom: 8px;
}
.brand-logo { height: 30px; width: auto; display: block; }
.brand-sub {
  font-size: .8rem;
  color: var(--deep);
  font-weight: 700;
  letter-spacing: .04em;
  padding-left: 2px;
}
h1.title, h2.title { color: var(--deep); }
.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-weight: 600;
}
.check-row input { width: 20px; height: 20px; margin-top: 3px; flex: 0 0 auto; }

/* ---- ボタン ---- */
.btn {
  padding: 15px;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  width: 100%;
}
.btn-primary { background: var(--cta); color: #fff; box-shadow: 0 3px 0 var(--cta-dark); }
.btn-primary:disabled { background: #cbd5d0; box-shadow: none; cursor: not-allowed; }
.btn-primary:active:not(:disabled) { background: var(--cta-dark); box-shadow: none; transform: translateY(2px); }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: none;
  font-weight: 600;
  cursor: pointer;
  padding: 10px;
  font-size: .95rem;
}
.nav { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.nav .spacer { flex: 1; }

.icon-ok { color: var(--ok); font-size: 3rem; line-height: 1; }
.center-block { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }

.hint { font-size: .85rem; color: var(--muted); }
.link-reset { background: none; border: none; color: var(--brand); text-decoration: underline; cursor: pointer; font-size: .85rem; padding: 0; }

/* =========================================================
   セクション単位（1画面=1セクション・表形式）
   ========================================================= */
.sec-wrap { display: flex; flex-direction: column; flex: 1; }

/* 上部固定ヘッダ（セクション見出し＋進捗＋列見出し） */
.sec-sticky {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  margin: 0 -16px;
  padding: 8px 16px 0;
  box-shadow: 0 3px 10px rgba(20, 30, 60, .06);
}
.sec-head { padding: 8px 0 6px; }
.sec-meta { display: flex; justify-content: space-between; font-size: .76rem; color: var(--muted); }
.sec-meta span:first-child { color: #fff; background: var(--brand); font-weight: 700; padding: 2px 10px; border-radius: 99px; }
.sec-title { font-size: 1.1rem; font-weight: 700; margin-top: 5px; color: var(--deep); }
.sec-track { height: 6px; background: var(--line); border-radius: 99px; margin-top: 8px; overflow: hidden; }
.sec-fill { height: 100%; width: 0; background: var(--brand); border-radius: 99px; transition: width .25s ease; }

/* 列見出し */
.row-grid {
  display: grid;
  grid-template-columns: 1fr 46px 46px 46px 46px;
  gap: 2px;
  align-items: center;
}
.legend { padding: 7px 0; border-bottom: 2px solid var(--brand); }
.legend-pin { font-size: .72rem; color: var(--muted); display: flex; align-items: center; line-height: 1.2; }
.legend-pin .pin { color: var(--brand); margin-right: 4px; font-size: 1rem; }
.legend-cell {
  font-size: .64rem;
  line-height: 1.2;
  text-align: center;
  color: var(--deep);
  font-weight: 700;
  word-break: break-all;
}

/* 設問リスト */
.qlist { padding-top: 2px; }
.group-row {
  font-size: .85rem;
  font-weight: 700;
  color: var(--deep);
  background: rgba(54, 181, 149, .1);
  padding: 8px 10px;
  border-radius: 8px;
  margin: 12px 0 2px;
}
.qrow { padding: 12px 0; border-bottom: 1px solid var(--line); transition: background .15s; }
.qrow.unanswered { background: #fdf7e6; box-shadow: inset 3px 0 0 var(--accent); border-radius: 4px; }
.qtext { font-size: .95rem; line-height: 1.45; padding: 0 8px 0 6px; }

.circle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 46px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #c6d6d0;
  transition: transform .08s, background .1s, border-color .1s;
}
.circle-btn:active .circle { transform: scale(.88); }
.circle.on { background: var(--brand); border-color: var(--brand); box-shadow: inset 0 0 0 4px #fff; }

/* 下部固定ナビ */
.sec-nav {
  position: sticky;
  bottom: 0;
  background: var(--bg);
  margin: 8px -16px 0;
  padding: 10px 16px calc(env(safe-area-inset-bottom) + 8px);
  box-shadow: 0 -3px 10px rgba(20, 30, 60, .06);
}
.sec-note { font-size: .8rem; color: #b07d10; font-weight: 700; min-height: 1.1em; text-align: center; margin-bottom: 6px; }
.sec-nav-row { display: flex; gap: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; }
.btn-sub { flex: 0 0 auto; width: auto; padding-left: 22px; padding-right: 22px; background: #e5f2ee; color: var(--deep); box-shadow: none; }
.btn-sub:active { background: #d7ebe4; transform: translateY(1px); }
.btn-next { flex: 1; background: var(--brand); box-shadow: 0 3px 0 var(--brand-dark); }
.btn-next:active:not(:disabled) { background: var(--brand-dark); box-shadow: none; transform: translateY(2px); }
