/* 配置：紺の帯（現在地）→ 1列の読み物。スマホで片手で読み、親指で押す。 */
:root {
  --bg: #f6f7fa;
  --surface: #ffffff;
  --fg: #16203a;
  --muted: #5b6480;
  --line: #d9dde8;
  --navy: #14285a;
  --navy-deep: #0d1c42;
  --on-navy: #ffffff;
  --on-navy-muted: #c3cbe2;
  --accent: #e8730c;
  --accent-fg: #ffffff;
  --accent-soft: #fdeedd;
  --good: #1c7a4a;
  --good-soft: #e2f3e9;
  --bad: #b3261e;
  --bad-soft: #fbe6e4;
  --font-display: "Zen Kaku Gothic New", "BIZ UDPGothic", "Hiragino Sans", "Yu Gothic", sans-serif;
  --font-body: "BIZ UDPGothic", "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1424; --surface: #18203a; --fg: #e8ebf5; --muted: #a2abc6; --line: #2f3a5c;
    --navy: #0a1230; --navy-deep: #060b1f; --on-navy: #ffffff; --on-navy-muted: #b3bcd8;
    --accent: #ff9a3d; --accent-fg: #1a1205; --accent-soft: #3a2a14;
    --good: #6fd19c; --good-soft: #143424; --bad: #ff9a92; --bad-soft: #401a17;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1424; --surface: #18203a; --fg: #e8ebf5; --muted: #a2abc6; --line: #2f3a5c;
  --navy: #0a1230; --navy-deep: #060b1f; --on-navy: #ffffff; --on-navy-muted: #b3bcd8;
  --accent: #ff9a3d; --accent-fg: #1a1205; --accent-soft: #3a2a14;
  --good: #6fd19c; --good-soft: #143424; --bad: #ff9a92; --bad-soft: #401a17;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 17px; line-height: 1.85; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--navy-deep); }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.4; text-wrap: balance; margin: 0; }
h1 { font-size: 1.55rem; font-weight: 900; }
h2 { font-size: 1.25rem; font-weight: 900; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: 680px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }


.band { background: var(--navy); color: var(--on-navy); }
.band .wrap { padding-block: 20px 22px; }
main.wrap { padding-block: 24px 64px; display: flex; flex-direction: column; gap: 28px; }
.eyebrow { font-size: .8rem; color: var(--on-navy-muted); letter-spacing: .08em; }
.band p.lead { color: var(--on-navy-muted); font-size: .95rem; margin-top: 6px; }
.back { background: none; border: 0; padding: 4px 0; min-height: 40px; color: var(--on-navy-muted); font-size: .9rem; }
.memo { font-size: .88rem; color: var(--muted); border-left: 3px solid var(--accent); padding-left: 12px; }

/* ボタン */
.btn { border: 1.5px solid var(--line); background: var(--surface); border-radius: 8px; padding: 10px 18px; min-height: 48px; font-weight: 700; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.wide { width: 100%; }
.link { background: none; border: 0; padding: 8px 0; min-height: 44px; color: var(--navy); text-decoration: underline; text-underline-offset: 3px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .link { color: var(--accent); } }
:root[data-theme="dark"] .link { color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* 入力 */
form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .lab { font-weight: 700; font-size: .95rem; }
.field input { background: var(--surface); border: 1.5px solid var(--line); border-radius: 8px; padding: 10px 12px; min-height: 48px; width: 100%; }
.field .help { font-size: .85rem; color: var(--muted); }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice label { display: flex; align-items: center; justify-content: center; gap: 8px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 8px; min-height: 48px; font-weight: 700; cursor: pointer; }
.choice input { accent-color: var(--accent); width: 18px; height: 18px; }
.choice label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

/* 一覧 */
.progress { display: flex; align-items: center; gap: 12px; margin-top: 14px; font-size: .9rem; font-variant-numeric: tabular-nums; }
.bar { flex: 1; height: 8px; background: rgba(255,255,255,.2); border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border: 1.5px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg.two { grid-template-columns: repeat(2, 1fr); }
.seg button { background: none; border: 0; border-right: 1px solid var(--line); min-height: 46px; font-size: .9rem; font-weight: 700; color: var(--muted); padding: 4px 6px; }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--navy); color: var(--on-navy); }
.stage { display: flex; flex-direction: column; gap: 4px; }
.stage > p { color: var(--muted); font-size: .9rem; }
.stage h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lessons { list-style: none; margin: 8px 0 0; padding: 0; border-top: 1px solid var(--line); }
.lessons li { border-bottom: 1px solid var(--line); }
.lessons button { display: flex; width: 100%; align-items: center; gap: 12px; text-align: left; background: none; border: 0; padding: 14px 4px; min-height: 64px; }
.lessons .t { flex: 1; min-width: 0; }
.lessons .t b { display: block; font-family: var(--font-display); font-size: 1.05rem; line-height: 1.45; }
.lessons .t span { color: var(--muted); font-size: .85rem; }
.pill { flex: none; font-family: var(--font-body); font-size: .8rem; font-weight: 400; padding: 2px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pill.done { background: var(--good-soft); border-color: transparent; color: var(--good); font-weight: 700; }
.pill.again { background: var(--accent-soft); border-color: transparent; color: var(--fg); }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.card { text-align: left; background: var(--surface); border: 1.5px solid var(--line); border-radius: 8px; padding: 14px; display: flex; flex-direction: column; gap: 6px; min-height: 120px; }
.card[aria-expanded="true"] { border-color: var(--navy); box-shadow: inset 0 -4px 0 var(--accent); }
.card small { color: var(--muted); font-size: .8rem; }
.card b { font-family: var(--font-display); font-size: 1.05rem; line-height: 1.35; }
.card .num { font-family: var(--font-display); font-weight: 900; font-size: 1.3rem; font-variant-numeric: tabular-nums; margin-top: auto; }
.card .mini { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.card .mini i { display: block; height: 100%; background: var(--accent); }

/* レッスン本文 */
.goals { background: var(--accent-soft); padding: 16px 18px; border-radius: 6px; }
.goals h3 { font-size: .9rem; margin-bottom: 6px; }
.goals ul { margin: 0; padding-left: 1.2em; }
section.part { display: flex; flex-direction: column; gap: 12px; }
.kicker { font-family: var(--font-display); font-size: .85rem; color: var(--accent); letter-spacing: .1em; }
.talk { display: flex; flex-direction: column; gap: 10px; }
.talk .say { padding: 12px 16px; border-radius: 6px; }
.talk .ng { background: var(--bad-soft); }
.talk .ok { background: var(--good-soft); }
.talk .say b { display: block; font-size: .82rem; }
.talk .ng b { color: var(--bad); }
.talk .ok b { color: var(--good); }
.talk .why { font-size: .92rem; color: var(--muted); }

/* クイズ */
.q { display: flex; flex-direction: column; gap: 10px; padding-top: 20px; border-top: 1px solid var(--line); }
.q .num { font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.q .ask { font-weight: 700; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opts button { text-align: left; background: var(--surface); border: 1.5px solid var(--line); border-radius: 8px; padding: 12px 14px; min-height: 52px; line-height: 1.6; }
.opts button:disabled { cursor: default; opacity: .75; }
.opts button.picked { border-color: var(--navy); opacity: 1; }
.opts button.right { border-color: var(--good); background: var(--good-soft); opacity: 1; }
.opts button.wrong { border-color: var(--bad); background: var(--bad-soft); opacity: 1; }
.fb { font-size: .95rem; min-height: 1.85em; }
.fb b.r { color: var(--good); } .fb b.w { color: var(--bad); }
.fb .wait { color: var(--muted); }
.result { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.result .score { font-family: var(--font-display); font-size: 1.5rem; font-weight: 900; font-variant-numeric: tabular-nums; }

/* 管理者 */
.filters { display: flex; flex-direction: column; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px; padding: 6px 16px; min-height: 44px; font-size: .92rem; }
.chips button[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: var(--on-navy); font-weight: 700; }
.people { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.people > li { border-bottom: 1px solid var(--line); }
.person { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; width: 100%; text-align: left; background: none; border: 0; padding: 14px 4px; min-height: 72px; align-items: center; }
.person .name { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; min-width: 0; }
.person .name small { font-family: var(--font-body); font-weight: 400; color: var(--muted); font-size: .82rem; margin-left: 6px; }
.person .total { font-family: var(--font-display); font-weight: 900; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.person .total small { font-size: .8rem; font-weight: 700; color: var(--muted); }
.person .split { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.detail { padding: 4px 4px 18px; display: flex; flex-direction: column; gap: 8px; }
.scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .88rem; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: .78rem; color: var(--muted); font-weight: 700; }
td.n, th.n { text-align: right; }
tr:last-child td { border-bottom: 0; }
tr.grp td { background: var(--bg); font-weight: 700; font-size: .8rem; color: var(--muted); }
@media (prefers-reduced-motion: no-preference) { .bar i, .card .mini i { transition: width .3s ease-out; } }

/* ===== 本番の画面で足した分 ===== */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; padding-bottom: env(safe-area-inset-bottom, 0px); }
.band { padding-top: env(safe-area-inset-top, 0px); }
.band .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.band .linkbtn { background: none; border: 0; color: var(--on-navy-muted); font-size: .85rem; min-height: 40px; padding: 4px 0; text-decoration: underline; text-underline-offset: 3px; }
.msg { font-size: .95rem; padding: 10px 14px; border-radius: 8px; }
.msg.error { background: var(--bad-soft); color: var(--bad); }
.msg.ok { background: var(--good-soft); color: var(--good); }
.msg.info { background: var(--accent-soft); color: var(--fg); }
.loading { color: var(--muted); padding-block: 24px; }
.btn:disabled { opacity: .6; cursor: default; }
section.part .src { font-size: .82rem; color: var(--muted); }
section.part ul, section.part ol { margin: 0; padding-left: 1.3em; }
.draft { font-size: .75rem; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--fg); margin-left: 6px; white-space: nowrap; }

/* 点検の反映：押す所の高さ・色だけに頼らない正誤・暗い画面での選択中 */
.back, .band .linkbtn { min-height: 44px; padding-inline: 8px; margin-inline: -8px; }
.opts .mark { font-weight: 700; }
.opts button.right .mark { color: var(--good); }
.opts button.wrong .mark { color: var(--bad); }
h1:focus { outline: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .seg button[aria-pressed="true"],
  :root:not([data-theme="light"]) .chips button[aria-pressed="true"] { background: var(--accent-soft); color: var(--fg); box-shadow: inset 0 0 0 2px var(--accent); }
  :root:not([data-theme="light"]) .opts button.picked { border-color: var(--accent); }
}
