/* 受験ツール共通 — 積分連打(/sekibun/style.css)と同じ見た目。ツールごとの色は index.html で --accent を上書きする */
:root {
  --bg: #f2f2f7; --card: #ffffff; --text: #16191d; --sub: #6b7280; --faint: #9aa1ab; --line: #e3e6ea; --fill: #e9e9ef;
  --accent: #7c3aed; --accent-soft: #f1eafe; --on-accent: #fff;
  --green: #18794e; --green-soft: #e6f4ec; --red: #c42b1c; --red-soft: #fdecea; --orange: #b45309;
  --math: "Times New Roman", "Hiragino Mincho ProN", "Yu Mincho", serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1114; --card: #1b1e23; --text: #eceef1; --sub: #a3abb5; --faint: #7a828c; --line: #2a2e35; --fill: #2a2e35;
    --accent: #b794ff; --accent-soft: #2a1f45; --on-accent: #160b2e;
    --green: #5fd49a; --green-soft: #15301f; --red: #ff7b6e; --red-soft: #3a1b18; --orange: #f7b955;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif; }
main { max-width: 560px; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); min-height: 100dvh; }
button { font: inherit; color: inherit; }
.math { font-family: var(--math); }
.sub { color: var(--sub); font-size: 14px; }
.hint { color: var(--sub); font-size: 13px; margin: 6px 0 0; text-align: center; }
.card { background: var(--card); border-radius: 14px; }
.pad { padding: 16px; }

/* ホーム */
.home-head h1 { font-size: 30px; margin: 8px 0 2px; }
.lead { margin: 0 0 8px; color: var(--sub); font-size: 14px; }
.group { margin: 18px 0; }
.group h2 { font-size: 13px; font-weight: 600; color: var(--sub); margin: 0 4px 6px; }
.group-head { display: flex; justify-content: space-between; align-items: baseline; }
.link { background: none; border: 0; color: var(--accent); font-size: 13px; cursor: pointer; padding: 4px; }
.list > * + * { border-top: 1px solid var(--line); }
.row-toggle { display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; }
.row-toggle > span { flex: 1; display: flex; flex-direction: column; }
.row-toggle b { font-weight: 500; }
.row-toggle .sub { font-size: 15px; }
input[role="switch"] { appearance: none; width: 50px; height: 30px; border-radius: 15px; background: var(--fill); position: relative;
  flex: none; cursor: pointer; transition: background .15s; margin: 0; }
input[role="switch"]::after { content: ""; position: absolute; top: 2px; left: 2px; width: 26px; height: 26px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
input[role="switch"]:checked { background: var(--accent); }
input[role="switch"]:checked::after { transform: translateX(20px); }
input[role="switch"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.segmented { display: flex; background: var(--fill); border-radius: 10px; padding: 3px; }
.segmented label { flex: 1; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; text-align: center; padding: 7px 0; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; }
.segmented input:checked + span { background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }
.start-bar { position: sticky; bottom: 0; padding: 12px 0 calc(8px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 30%); }
.start-bar.two { display: flex; gap: 12px; }
.start-bar.two .btn { flex: 1; }
.btn { display: block; width: 100%; border: 0; border-radius: 12px; padding: 14px; font-size: 17px; font-weight: 700;
  background: var(--fill); cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn:disabled { opacity: .45; cursor: default; }
.foot { text-align: center; font-size: 13px; color: var(--sub); margin-top: 24px; }
.foot a { color: var(--accent); }

/* プレイ */
.play { display: flex; flex-direction: column; gap: 14px; min-height: calc(100dvh - 36px); }
.play-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.icon-btn { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--fill); font-weight: 700; cursor: pointer; }
.qno { color: var(--sub); font-variant-numeric: tabular-nums; }
.qno b { font-size: 22px; color: var(--text); }
.stats { justify-self: end; display: flex; flex-direction: column; align-items: flex-end; font-size: 13px; color: var(--sub);
  font-variant-numeric: tabular-nums; }
.streak { font-weight: 700; }
.streak.hot { color: var(--orange); }
.progress { height: 6px; border-radius: 3px; background: var(--fill); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .2s; }
.progress.small { height: 5px; margin-top: 6px; }
.progress.full i { background: var(--green); }
.question { margin-top: auto; padding: 26px 14px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.badge { font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 3px 10px; }
.q { margin: 0; width: 100%; white-space: nowrap; overflow: hidden; line-height: 1.3; }
.feedback-slot { min-height: 54px; margin-top: auto; display: flex; align-items: center; }
.feedback { width: 100%; text-align: center; font-size: 20px; font-weight: 700; margin: 0; animation: pop .2s ease-out; }
.feedback.ok { color: var(--green); }
.next { width: 100%; min-height: 52px; display: flex; justify-content: space-between; align-items: center; padding: 0 16px;
  border: 0; border-radius: 14px; background: var(--card); font-weight: 700; font-size: 17px; cursor: pointer; animation: up .2s ease-out; }
.ng { color: var(--red); }
.choices { display: flex; flex-direction: column; gap: 10px; }
.choice { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 0 14px; border-radius: 14px; border: 2px solid transparent;
  background: var(--card); text-align: left; cursor: pointer; transition: transform .1s; }
.choice:active:not(:disabled) { transform: scale(.97); }
.choice:disabled { cursor: default; }
.mark { width: 28px; height: 28px; border-radius: 50%; background: var(--fill); color: var(--sub); flex: none;
  display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.c { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; font-size: 20px; }
.choice.correct { border-color: var(--green); background: var(--green-soft); }
.choice.correct .mark { background: var(--green); color: #fff; }
.choice.wrong { border-color: var(--red); background: var(--red-soft); }
.choice.wrong .mark { background: var(--red); color: #fff; }
.choice.dimmed { opacity: .45; }
@keyframes pop { from { transform: scale(.8); opacity: 0; } }
@keyframes up { from { transform: translateY(10px); opacity: 0; } }

/* 結果 */
.center-title { text-align: center; font-size: 17px; margin: 6px 0; }
.score { position: relative; text-align: center; padding: 8px 0 4px; }
.ring { width: 150px; height: 150px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 12; }
.ring .track { stroke: var(--fill); }
.ring .bar { stroke-linecap: round; }
.score-num { position: absolute; top: 8px; left: 0; right: 0; height: 150px; display: flex; flex-direction: column;
  justify-content: center; align-items: center; }
.score-num b { font-size: 48px; line-height: 1; font-variant-numeric: tabular-nums; }
.score-num span { color: var(--sub); font-size: 14px; }
.msg { font-weight: 700; margin: 6px 0 0; }
.kv > div { display: flex; justify-content: space-between; padding: 12px 14px; }
.kv span { color: var(--text); }
.kv b { font-weight: 500; color: var(--sub); font-variant-numeric: tabular-nums; }
.bd, .mistake { padding: 12px 14px; }
.bd-top { display: flex; justify-content: space-between; }
.mistake p { margin: 4px 0 0; }
.mistake > .math { font-size: 19px; }
.ans { font-size: 15px; overflow-wrap: anywhere; }
.ans.ok { color: var(--green); }
.ans.ok .math { color: var(--text); }
.ans.ng { color: var(--red); }
.ans.ng .math { color: var(--sub); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--red) 60%, transparent); }

/* 受験ツール共通の追加分 */
.back { display: inline-block; color: var(--accent); text-decoration: none; font-size: 15px; padding: 4px 0; }
.mistake .mq { font-size: 19px; }
.mistake .mq.text { font-size: 17px; }
.mnote { margin-top: 6px !important; }
.note { margin: -6px 0 0; padding: 10px 14px; border-radius: 12px; background: var(--card); color: var(--sub); font-size: 14px;
  animation: up .2s ease-out; }
/* 古文・漢文など文章の問題: 明朝で、長ければ折り返す */
.text { font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif; }
.q.text { white-space: normal; font-size: 26px; overflow-wrap: anywhere; }
.q.wrap { white-space: normal; font-size: 19px; line-height: 1.6; text-align: left; font-weight: 500; }
.mistake .mq.wrap { font-size: 15px; }
.c.text { white-space: normal; font-size: 16px; line-height: 1.4; padding: 10px 0; }

/* ツール一覧 */
.tool-list { display: flex; flex-direction: column; gap: 10px; }
.tool { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--card);
  text-decoration: none; color: var(--text); }
.tool img { width: 48px; height: 48px; border-radius: 11px; flex: none; }
.tool > span { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.tool b { font-size: 17px; }
.tool small { color: var(--sub); font-size: 13px; }
.tool i { font-style: normal; color: var(--faint); font-size: 22px; }

/* 結果のシェア・受験ナビの案内 */
.share { display: flex; gap: 10px; margin: 14px 0 0; }
.share .btn { flex: 1; text-align: center; text-decoration: none; font-size: 15px; padding: 12px; }
.share-x { background: #000 !important; color: #fff !important; }
.share-line { background: #06c755 !important; color: #fff !important; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .share-x { background: #fff !important; color: #000 !important; } }
.ronin-promo { display: flex; align-items: center; gap: 12px; margin: 18px 0 4px; padding: 12px 14px; border-radius: 14px;
  background: var(--card); text-decoration: none; color: var(--text); border: 1px solid var(--line); }
.ronin-promo img { border-radius: 10px; flex: none; }
.ronin-promo > span { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ronin-promo small { font-size: 11px; color: var(--faint); }
.ronin-promo b { font-size: 15px; }
.ronin-promo span span { font-size: 12.5px; color: var(--sub); }
.ronin-promo i { font-style: normal; color: var(--faint); font-size: 20px; }

/* 例文(古文単語) */
.example { margin: 8px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--card); border-left: 4px solid var(--accent, #2357d6); }
.example p { margin: 0; }
.ex-text { font-size: 16px; line-height: 1.7; font-family: "Hiragino Mincho ProN", "Yu Mincho", serif; }
.ex-src { font-size: 12px; color: var(--sub); margin-left: 6px; font-family: inherit; }
.ex-tr { margin-top: 4px !important; font-size: 13px; color: var(--sub); line-height: 1.6; }
.example.small { margin-top: 8px; padding: 8px 10px; }
.example.small .ex-text { font-size: 14px; }
