:root {
  --bg: #ffffff;
  --fg: #111111;
  --mute: #6e6e73;
  --line: #e5e5ea;
  --soft: #f2f2f7;
  --ac: #0a5cff;
  --ok: #1f8a4c;
  --re: #d9730d;
  --ng: #d0342c;
  --radius: 14px;
  --pad: 20px;
  --sans: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000; --fg: #f2f2f7; --mute: #98989d; --line: #2c2c2e; --soft: #1c1c1e;
    --ac: #3d8bff; --ok: #34c37a; --re: #f0a04b; --ng: #ff6b62;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body {
  margin: 0; min-height: 100%; background: var(--bg); color: var(--fg);
  font-family: var(--sans); font-size: 17px; line-height: 1.75;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}
#app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; }
a { color: var(--ac); text-decoration: none; }
b { font-weight: 700; }
svg.fig { width: 100%; height: auto; display: block; color: var(--fg); }
svg.fig text { font-family: var(--sans); }

.screen { flex: 1; display: flex; flex-direction: column; max-width: 560px; width: 100%; margin: 0 auto; padding: 0 var(--pad); padding-top: max(16px, env(safe-area-inset-top)); padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.screen.has-nav { padding-bottom: 0; }
.screen.has-tabs { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
.top { display: flex; align-items: center; justify-content: space-between; min-height: 44px; margin-bottom: 8px; }
.top .back { font-size: 17px; color: var(--ac); padding: 8px 0; display: inline-flex; align-items: center; gap: 4px; }
.top .back svg { width: 12px; height: 20px; }
.top .crumb { font-size: 13px; color: var(--mute); }
.title { font-size: 28px; font-weight: 800; letter-spacing: -0.01em; margin: 8px 0 4px; line-height: 1.25; }
.sub { color: var(--mute); font-size: 15px; margin: 0 0 16px; }

/* 入口 */
.enter { justify-content: center; }
.enter .brand { font-size: 40px; font-weight: 900; letter-spacing: -0.03em; margin-bottom: 4px; }
.enter .tag { color: var(--mute); margin-bottom: 36px; }
.field { display: block; width: 100%; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); color: var(--fg); margin-bottom: 12px; font-size: 17px; -webkit-appearance: none; }
.field:focus { outline: 2px solid var(--ac); outline-offset: 0; border-color: transparent; }
.err { color: var(--ng); font-size: 14px; min-height: 22px; margin: 4px 0 8px; }
.note { color: var(--mute); font-size: 13px; margin-top: 18px; line-height: 1.6; }
.forgot { display: block; text-align: center; text-decoration: underline; }
.forgot-link { display: block; text-align: center; color: var(--ac); font-size: 15px; font-weight: 600; padding: 14px 0 4px; }
.enter .sheet-p { margin-bottom: 20px; line-height: 1.7; }
.lbl { display: block; font-size: 13px; font-weight: 600; color: var(--mute); margin: 4px 0 6px; }
/* パスワード欄（表示の切り替えつき）。app.js の pwField が作る */
.pw { position: relative; margin-bottom: 12px; }
.pw .field { margin-bottom: 0; padding-right: 64px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); padding: 8px 10px; font-size: 14px; font-weight: 600; color: var(--ac); background: none; border: 0; }
.link-btn { background: none; border: 0; color: var(--ac); font-size: 14px; font-weight: 600; padding: 0 0 0 8px; }
.muted { color: var(--mute); }
/* 覚える所（理由が資料に無い決まり。2026-09-24） */
.memo { display: flex; gap: 10px; align-items: baseline; margin: -4px 0 18px; padding: 10px 12px; border-radius: 12px; background: var(--soft); font-size: 15px; line-height: 1.7; }
.memo-k { flex: 0 0 auto; font-size: 12px; font-weight: 700; color: var(--re); border: 1px solid currentColor; border-radius: 999px; padding: 1px 8px; }
/* 学習計画（2026-09-24） */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip-b { padding: 10px 14px; border-radius: 999px; background: var(--soft); border: 1px solid var(--line); font-size: 15px; font-weight: 600; color: var(--fg); }
.chip-b.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.plan-ok, .plan-ng { font-size: 15px; font-weight: 700; margin: 0 0 12px; }
.plan-ok { color: var(--ok); }
.plan-ng { color: var(--re); }
.plan-cta { display: block; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 20px; color: inherit; }
.plan-cta b { display: block; font-size: 17px; margin-bottom: 4px; }
.plan-cta span { color: var(--mute); font-size: 14px; line-height: 1.6; }
.today-h { display: flex; justify-content: space-between; align-items: baseline; color: var(--mute); font-size: 14px; margin-bottom: 8px; }
.today-h a { color: var(--ac); font-weight: 600; }
.tasks { border-top: 1px solid var(--line); margin-bottom: 22px; }
.task { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); color: inherit; }
.task .k { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--soft); color: var(--mute); white-space: nowrap; }
.task .k.review { color: var(--re); }
.task .t { font-weight: 600; }
.task .m { color: var(--mute); font-size: 14px; white-space: nowrap; }
.empty { color: var(--mute); padding: 14px 0; }
/* 注（本文の * と、段落の下の小さい説明）と数字のまとめ。build.py が作る（2026-09-24） */
sup.fn { font-size: .62em; color: var(--ac); font-weight: 700; margin-left: 1px; vertical-align: super; line-height: 0; }
.notes { margin: -6px 0 16px; padding-left: 10px; border-left: 2px solid var(--line); font-size: 13px; line-height: 1.6; color: var(--mute); }
.notes > div + div { margin-top: 4px; }
.notes .fn-k { color: var(--ac); font-weight: 700; margin-right: 4px; }
.after .notes { margin: 10px 0 0; }
.nums { margin: 4px 0 18px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.nums > div { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; column-gap: 12px; row-gap: 2px; padding: 10px 14px; font-size: 15px; }
.nums span { flex: 1 1 9em; }
.nums b { margin-left: auto; text-align: right; }
.nums > .nums-h { display: block; background: var(--soft); font-size: 13px; font-weight: 700; color: var(--fg); padding: 8px 14px; }
.nums > div + div { border-top: 1px solid var(--line); }
.nums span { color: var(--mute); }
.nums b { font-weight: 700; }

.btn { display: block; width: 100%; padding: 16px; border-radius: var(--radius); text-align: center; font-weight: 700; font-size: 17px; background: var(--fg); color: var(--bg); transition: transform .08s ease, opacity .15s; }
.btn:active { transform: scale(0.985); }
.btn[disabled] { opacity: .35; pointer-events: none; }
.btn.ghost { background: var(--soft); color: var(--fg); }
.btn.ac { background: var(--ac); color: #fff; }
.btn + .btn { margin-top: 10px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row2 .btn + .btn { margin-top: 0; }

/* ホーム */
.hero { padding: 22px 0 6px; }
.hero .big { font-size: 56px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.hero .big small { font-size: 22px; font-weight: 700; margin: 0 8px 0 2px; }
.hero .cap { color: var(--mute); font-size: 15px; margin-top: 6px; }
.days { display: flex; gap: 6px; margin: 16px 0 8px; align-items: flex-end; height: 44px; }
.days .d { flex: 1; background: var(--soft); border-radius: 4px; min-height: 4px; position: relative; }
.days .d.on { background: var(--fg); }
.days .d.today { outline: 2px solid var(--ac); outline-offset: 1px; }
.cta { margin: 18px 0 26px; }
.cta .btn { display: flex; justify-content: space-between; align-items: center; text-align: left; color: var(--bg); }
.cta .btn .r { font-weight: 500; opacity: .8; font-size: 15px; }
.chapter { display: flex; justify-content: space-between; align-items: baseline; font-size: 16px; font-weight: 800; margin: 30px 0 0; padding-bottom: 8px; border-bottom: 2px solid var(--ac); }
.chapter .cnt { font-size: 12px; font-weight: 600; color: var(--mute); }
.section { font-size: 13px; font-weight: 700; color: var(--mute); letter-spacing: .04em; margin: 22px 0 6px; text-transform: uppercase; }
.list { border-top: 1px solid var(--line); }
.item { display: flex; align-items: center; gap: 14px; padding: 15px 0; border-bottom: 1px solid var(--line); width: 100%; text-align: left; color: inherit; }
.item .n { color: var(--mute); font-size: 13px; width: 22px; font-variant-numeric: tabular-nums; }
.item .t { flex: 1; font-size: 17px; font-weight: 600; }
.item .m { display: flex; gap: 14px; font-size: 12px; color: var(--mute); }
.item .m span { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--line); display: inline-block; }
.dot.clear { background: var(--ok); border-color: var(--ok); }
.dot.review { background: var(--re); border-color: var(--re); }
.item .chev { color: var(--line); }
.item .chev svg { width: 8px; height: 14px; }
.weekly { color: inherit; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.weekly .s { font-size: 15px; color: var(--mute); }
.weekly .s b { color: var(--fg); font-size: 20px; }
.weekly .go { color: var(--ac); font-weight: 700; white-space: nowrap; }
.foot { margin-top: 32px; text-align: center; color: var(--mute); font-size: 13px; }
.foot button { color: var(--mute); text-decoration: underline; }

/* 学ぶ */
.learn { }
.prog { display: flex; gap: 4px; margin: 6px 0 18px; }
.prog i { flex: 1; height: 3px; border-radius: 2px; background: var(--line); }
.prog i.on { background: var(--fg); }
.page { flex: 1; }
.page p { margin: 0 0 18px; font-size: 18px; line-height: 1.85; }
.page .fig { margin: 4px 0 22px; padding: 14px 10px; border-radius: var(--radius); background: var(--soft); }
.guess { border: 1.5px solid var(--fg); border-radius: var(--radius); padding: 16px; margin: 4px 0 22px; }
.guess .q { font-weight: 700; margin-bottom: 12px; }
.guess .c { display: block; width: 100%; text-align: left; padding: 12px 14px; border-radius: 10px; background: var(--soft); margin-bottom: 8px; font-size: 16px; }
.guess .c.pick { background: var(--fg); color: var(--bg); }
.guess .c.right { background: var(--ok); color: #fff; }
.guess .c.wrong { background: var(--soft); opacity: .5; }
.guess .after { margin-top: 12px; font-size: 16px; line-height: 1.75; }
.nav { display: flex; gap: 10px; position: sticky; bottom: 0; margin: 12px calc(-1 * var(--pad)) 0; padding: 12px var(--pad) max(16px, env(safe-area-inset-bottom)); background: var(--bg); }
.nav::before { content: ""; position: absolute; left: 0; right: 0; top: -18px; height: 18px; background: linear-gradient(to bottom, transparent, var(--bg)); pointer-events: none; }
.nav .btn { flex: 1; width: auto; }
.nav .btn.prev { flex: 0 0 auto; width: auto; padding-left: 22px; padding-right: 22px; background: var(--soft); color: var(--fg); }
.nav .btn + .btn { margin-top: 0; }
.done { text-align: center; padding: 20px 0 10px; }
.done .h { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.done .p { color: var(--mute); margin-bottom: 22px; }
.done .row2 .btn.clear { background: var(--ok); color: #fff; }
.done .row2 .btn.review { background: var(--re); color: #fff; }

/* 解く */
.qhead { color: var(--mute); font-size: 14px; margin: 4px 0 10px; font-variant-numeric: tabular-nums; }
.qhead .src:first-child { margin-left: 0; }
.qhead .src { margin-left: 10px; padding: 1px 8px; border: 1px solid var(--line, #444); border-radius: 999px; font-size: 12px; }
.qtext .fig { margin: 12px 0 4px; }
.qtext { font-size: 18px; font-weight: 700; line-height: 1.7; margin: 0 0 18px; }
.choice { display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; padding: 14px 16px; border-radius: 12px; border: 1.5px solid var(--line); margin-bottom: 10px; font-size: 16px; line-height: 1.65; }
.choice .k { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line); flex: 0 0 22px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; margin-top: 3px; color: var(--mute); }
.choice.right { border-color: var(--ok); }
.choice.right .k { background: var(--ok); border-color: var(--ok); color: #fff; }
.choice.wrong { border-color: var(--ng); }
.choice.wrong .k { background: var(--ng); border-color: var(--ng); color: #fff; }
.choice.dim { opacity: .45; }
.why { background: var(--soft); border-radius: var(--radius); padding: 16px; margin: 6px 0 14px; font-size: 16px; line-height: 1.75; }
.why .v { font-weight: 800; margin-bottom: 6px; }
.why .v.ok { color: var(--ok); } .why .v.ng { color: var(--ng); }
.why a { display: block; margin-top: 10px; font-weight: 600; }
.result { text-align: center; padding: 28px 0 12px; }
.result .big { font-size: 56px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.result .big small { font-size: 22px; color: var(--mute); font-weight: 600; }
.result .st { margin: 10px 0 26px; font-weight: 700; }
.result .st.clear { color: var(--ok); } .result .st.review { color: var(--re); }

.fade { animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.center { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--mute); }

/* タブバー（ホーム / 単元 / 記録 / 設定 だけに出す） */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; background: var(--bg); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.tabs .in { display: flex; width: 100%; max-width: 560px; }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 8px; font-size: 11px; color: var(--mute); font-weight: 600; }
.tabs a svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.on { color: var(--fg); }
.tabs a.on svg { stroke-width: 2.2; }

/* 記録 */
.stat { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0 20px; }
.stat div { background: var(--soft); border-radius: var(--radius); padding: 14px 16px; }
.stat .v { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .k { font-size: 13px; color: var(--mute); }
.rows { border-top: 1px solid var(--line); }
.rows div { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.rows div span:first-child { color: var(--mute); }
.days.tall { height: 72px; }

/* 2026-09-23 追加: モーダル / 解くの札 / 結果の一覧 */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 20; display: flex; align-items: flex-end; justify-content: center; animation: fadein .15s ease; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.sheet { width: 100%; max-width: 560px; background: var(--bg); border-radius: 18px 18px 0 0; padding: 20px var(--pad) max(20px, env(safe-area-inset-bottom)); animation: up .2s ease; max-height: 88vh; max-height: 88dvh; overflow: auto; }
.sheet.tall { height: 88vh; height: 88dvh; }
@keyframes up { from { transform: translateY(24px); } to { transform: none; } }
.sheet-h { font-size: 20px; font-weight: 800; margin-bottom: 6px; }
.sheet-p { color: var(--mute); font-size: 15px; margin-bottom: 18px; line-height: 1.7; }
.sheet-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; position: sticky; top: -20px; background: var(--bg); padding: 8px 0; }
.sheet-top .x { color: var(--ac); font-weight: 700; font-size: 16px; padding: 6px 0; }
body.noscroll { overflow: hidden; }

.choice { position: relative; flex-wrap: wrap; }
.choice .tx { flex: 1; min-width: 0; }
.choice .tag { flex-basis: 100%; margin: 6px 0 0 34px; font-size: 12px; font-weight: 700; }
.choice .tag.ok { color: var(--ok); } .choice .tag.ng { color: var(--ng); }
.choice.right { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.choice.wrong { border-color: var(--ng); background: color-mix(in srgb, var(--ng) 12%, transparent); }
.why .link { color: var(--ac); font-weight: 600; display: block; margin-top: 10px; font-size: 16px; }

.qlist { border-top: 1px solid var(--line); }
.qrow { display: flex; align-items: center; gap: 10px; padding: 13px 0; border-bottom: 1px solid var(--line); color: inherit; }
.qrow .qn { color: var(--mute); font-size: 13px; width: 18px; font-variant-numeric: tabular-nums; }
.qrow .qs { font-size: 12px; font-weight: 700; width: 44px; flex: 0 0 44px; }
.qrow .qs.ok { color: var(--ok); } .qrow .qs.ng { color: var(--ng); }
.qrow .qt { flex: 1; min-width: 0; font-size: 14px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qrow .chev { color: var(--line); } .qrow .chev svg { width: 8px; height: 14px; }
.result { padding-bottom: 4px; }
.result .st { margin-bottom: 8px; }
.rowlink { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); color: inherit; font-variant-numeric: tabular-nums; }
.rowlink span:last-child { flex-shrink: 0; white-space: nowrap; }
.item .mid { font-size: 11px; font-weight: 700; color: var(--ac); margin-left: 8px; vertical-align: middle; }
.done .row2 .btn.clear { background: var(--ok); color: #fff; }
.done .row2 .btn.review { background: var(--soft); color: var(--fg); }
