/* ==========================================================================
   Japatan — 学習ハブ(毎日レッスン / JLPT 模試 / 文法 / かな / レベル判定)
   style.css のトークン(やわらか Japatan)を使う。模試だけは本番の問題用紙と解答用紙の作り。build_learn.py が出す HTML 用。
   ========================================================================== */

:root { --ok: #2fae58; --ng: #f0524c; --lv: var(--sky); }
.lv-starter { --lv: var(--cheek); }
.lv-n5 { --lv: var(--meadow); }
.lv-n4 { --lv: var(--sky); }
.lv-n3 { --lv: var(--grape); }
.lv-n2 { --lv: var(--sun-deep); }
.lv-n1 { --lv: #ef6a5a; }

main[data-page] section { padding: 44px 0; }
main[data-page] .section-head { margin-bottom: 30px; }
main[data-page] .section-head h2 { font-size: clamp(1.4rem, 2.8vw, 1.9rem); margin-bottom: 6px; }
.learn-hero { padding: 30px 0 34px; }
.learn-hero .breadcrumb { padding: 0 0 14px; }
.learn-hero p { max-width: 720px; margin-inline: auto; }
.learn-hero h1 small { display: block; font-size: 0.5em; font-weight: 700; color: var(--ink-soft); }
.lesson-kicker { font-weight: 800; margin-bottom: 6px; }
.level-pill { cursor: pointer; font-family: inherit; font-size: 0.95rem; line-height: 1.6; }
.level-pill[class*="lv-"] { border-bottom-color: var(--lv); border-bottom-width: 3px; }
.level-pill[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.en-note, .save-note { text-align: center; color: var(--ink-soft); font-size: 0.88rem; font-weight: 600; margin-top: 14px; }
.course-links { text-align: center; font-weight: 700; margin: 26px 0; }
.note { background: var(--note-bg); border: 0; border-radius: var(--r-md); padding: 12px 18px; font-size: 0.9rem; font-weight: 600; max-width: 780px; margin: 18px auto; }
.footer-grid-4 { grid-template-columns: 1.3fr 1fr 1fr 1fr; }
@media (max-width: 900px) { .footer-grid-4 { grid-template-columns: 1fr 1fr; } }

/* ふりがな */
ruby rt { font-size: 0.55em; font-weight: 600; color: var(--ink-soft); user-select: none; }
.no-furi rt { visibility: hidden; }
u.tgt { text-decoration-thickness: 1.5px; text-underline-offset: 6px; }
b.pt { color: var(--link); font-weight: 700; }
.wk [lang="ja"] { word-spacing: 0.32em; }
.gap { display: inline-block; min-width: 2.6em; text-align: center; border: 1px solid var(--ink-soft); border-radius: 4px; margin: 0 3px; padding: 0 4px; font-weight: 700; background: var(--card); line-height: 1.5; font-size: 0.9em; }

/* ---------- 共通の部品 ---------- */
.bar { display: block; height: 8px; border: 0; border-radius: 999px; background: var(--rule); overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--meadow); border-radius: 999px; transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 0.9rem; cursor: pointer; padding: 4px 12px; border: var(--line); border-radius: 999px; background: var(--card); }
.toggle input { accent-color: var(--sky-deep); width: 16px; height: 16px; }
.say-btn { flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--sky-pale); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; vertical-align: middle; margin-inline-end: 8px; }
.say-btn svg { width: 17px; height: 17px; }
.say-btn:hover { background: var(--accent); color: var(--accent-ink); }
.say-btn:active { transform: translateY(1px); }

/* ---------- ハブ ---------- */
.learn-dash { padding-bottom: 10px !important; }
.dash-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 20px; }
.dash-card { background: var(--card); border: var(--line); border-radius: var(--r-lg); box-shadow: var(--sticker-shadow); padding: 20px 20px 22px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.dash-card h2 { font-size: 0.82rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.dash-today { background: var(--card); border-color: var(--accent); }
.dash-today .today-label { font-family: var(--disp); font-size: 1.5rem; font-weight: 700; line-height: 1.3; }
.dash-today .level-nav { justify-content: flex-start; margin-top: 0; gap: 6px; }
.dash-today .level-pill { padding: 2px 12px; font-size: 0.85rem; }
.dash-today .btn { align-self: flex-start; margin-top: 6px; }
.today-alt { font-size: 0.86rem; font-weight: 700; }
.streak-row { display: flex; align-items: center; gap: 6px; }
.streak-row img { width: 74px; height: 74px; object-fit: contain; }
.streak-num { font-family: var(--disp); font-size: 3rem; font-weight: 700; line-height: 1; }
.week-dots { display: flex; gap: 5px; }
.week-dots i { width: 14px; height: 14px; border-radius: 50%; border: 0; background: var(--rule); }
.week-dots i.on { background: var(--sun); }
.rank-name { font-family: var(--disp); font-size: 1.35rem; font-weight: 700; line-height: 1.3; }
.count-days { font-family: var(--disp); font-size: 1.5rem; font-weight: 700; line-height: 1.3; }
.dash-card small { color: var(--ink-soft); font-weight: 600; font-size: 0.8rem; line-height: 1.5; }

.tile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.tile-grid.tile-4 { grid-template-columns: repeat(4, 1fr); }
.tile-card { display: block; background: var(--card); border: var(--line); border-radius: var(--r-lg); box-shadow: var(--sticker-shadow); padding: 20px 20px 22px; color: var(--ink); text-align: center; transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1); }
.tile-card:hover { text-decoration: none; transform: translateY(-4px); }
.tile-card img { height: 96px; width: auto; margin: 0 auto 8px; object-fit: contain; }
.tile-card h3 { font-size: 1.15rem; font-weight: 800; }
.tile-card p { color: var(--ink-soft); font-size: 0.92rem; font-weight: 400; line-height: 1.6; }

.course-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.course-card { display: grid; gap: 10px; align-content: start; background: var(--card); border: var(--line); border-top: 4px solid var(--lv); border-radius: var(--r-lg); box-shadow: var(--sticker-shadow); padding: 16px 20px 18px; color: var(--ink); }
.course-card:hover { text-decoration: none; transform: translateY(-4px); }
.course-badge { font-family: var(--disp); font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.course-card p { color: var(--ink-soft); font-size: 0.9rem; font-weight: 400; line-height: 1.6; }
.course-card small { font-weight: 700; color: var(--ink-soft); }

.badge-grid { list-style: none; display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.badge { background: var(--card); border: var(--line); border-radius: var(--r-md); box-shadow: var(--sticker-shadow-sm); padding: 12px 8px; text-align: center; display: grid; gap: 2px; justify-items: center; align-content: start; }
.badge img { width: 68px; height: 68px; object-fit: contain; }
.badge strong { font-size: 0.86rem; line-height: 1.3; }
.badge small { font-size: 0.72rem; color: var(--ink-soft); line-height: 1.35; font-weight: 600; }
.badge.locked { box-shadow: none; border-style: dashed; }
.badge.locked img { filter: grayscale(1); opacity: 0.3; }
.badge.locked strong { color: var(--ink-soft); }
main[data-page="hub"] .faq-item p { padding: 0 22px 18px; color: var(--ink-soft); font-weight: 500; font-size: 0.97rem; }

/* ---------- コース(30 日の道) ---------- */
.course-meta { text-align: center; font-weight: 700; color: var(--ink-soft); margin-bottom: 22px; }
.day-path { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.day-node { display: flex; align-items: center; gap: 12px; background: var(--card); border: var(--line); border-radius: var(--r-md); box-shadow: var(--sticker-shadow-sm); padding: 10px 14px; color: var(--ink); height: 100%; }
.day-node:hover { text-decoration: none; transform: translateY(-3px); }
.day-num { flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--sky-pale); display: flex; align-items: center; justify-content: center; font-family: var(--disp); font-weight: 700; font-size: 1.1rem; }
.day-title { display: grid; line-height: 1.4; min-width: 0; }
.day-title small { color: var(--ink-soft); font-weight: 600; font-size: 0.8rem; }
.day-node.done .day-num { background: var(--ok); color: #fff; font-size: 0; }
.day-node.done .day-num::after { content: "✓"; font-size: 1.3rem; }
.day-node.next { border-color: var(--accent); }
.day-node.next .day-num { background: var(--accent); color: var(--accent-ink); }

/* ---------- レッスン ---------- */
.lesson, .test, .gpoint, .placement, .review { max-width: 860px; padding-top: 26px; padding-bottom: 60px; }
main[data-page] .lesson section.step { padding: 0 0 26px; }
.step > h2 { font-size: 1.4rem; font-weight: 700; margin: 22px 0 14px; padding-inline-start: 14px; border-inline-start: 4px solid var(--accent); }
.step h3 { font-size: 1.05rem; font-weight: 800; margin: 20px 0 10px; }
.stepper { list-style: none; display: flex; gap: 6px; position: sticky; top: 76px; z-index: 30; background: var(--card); border: var(--line); border-radius: 999px; box-shadow: var(--sticker-shadow-sm); padding: 6px; margin-bottom: 8px; }
.stepper li { flex: 1; text-align: center; font-weight: 800; font-size: 0.82rem; padding: 4px 4px; border-radius: 999px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stepper li.on { background: var(--accent); color: var(--accent-ink); }
.stepper li.past { background: var(--meadow-pale); color: var(--ink); }
.stepping .step { display: none; }
.stepping .step.show { display: block; animation: step-in 0.3s ease; }
@keyframes step-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.step-nav { display: flex; justify-content: space-between; gap: 12px; margin: 10px 0 30px; }
.step-nav .btn { padding: 11px 26px; cursor: pointer; font-size: 1rem; }
.lesson-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 20px 0; font-weight: 700; }
.lesson-nav .btn { padding: 9px 18px; font-size: 0.92rem; }

.word-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.word-card { position: relative; background: var(--card); border: var(--line); border-radius: var(--r-md); box-shadow: var(--sticker-shadow-sm); padding: 14px 16px; }
.word-card .say-btn { position: absolute; inset-inline-end: 6px; top: 12px; }
.w-term { font-size: 1.7rem; font-weight: 800; line-height: 1.3; padding-inline-end: 40px; }
.w-read { color: var(--ink-soft); font-weight: 600; font-size: 0.95rem; line-height: 1.3; }
.w-mean { font-weight: 800; margin: 4px 0 8px; }
.w-ex { font-size: 1.02rem; line-height: 2; border-top: 1px solid var(--rule); padding-top: 6px; cursor: pointer; }
.w-ext { color: var(--ink-soft); font-size: 0.9rem; line-height: 1.5; }
.kana-today { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.kana-cell { display: grid; justify-items: center; min-width: 54px; padding: 6px 8px; border: var(--line); border-radius: 12px; background: var(--card); color: var(--ink); cursor: pointer; font-family: inherit; line-height: 1.2; }
.kana-cell b { font-size: 1.5rem; font-weight: 700; }
.kana-cell small { font-size: 0.75rem; color: var(--ink-soft); font-weight: 700; }
.kana-cell:hover { background: var(--sky-pale); }
.kana-cell:active { transform: translateY(1px); }

.g-card { background: var(--card); border: var(--line); border-radius: var(--r-lg); box-shadow: var(--sticker-shadow-sm); padding: 18px 22px 16px; margin-bottom: 18px; }
.g-pattern { font-size: 1.5rem !important; font-weight: 700 !important; margin: 0 0 2px !important; color: var(--link); }
.g-meaning { font-weight: 800; margin-bottom: 10px; }
.g-form { display: flex; gap: 10px; align-items: baseline; background: var(--cloud); border: 0; border-radius: var(--r-md); padding: 8px 14px; margin-bottom: 10px; }
.g-form ul, .g-form-list { list-style: none; margin: 0 !important; font-weight: 500; }
.g-form-list { background: var(--cloud); border: 0; border-radius: var(--r-md); padding: 10px 16px; }
.g-explain { line-height: 1.8; }
.ex-list { list-style: none; margin: 0 0 12px !important; display: grid; gap: 10px; }
.ex-list li { margin: 0; border-inline-start: 2px solid var(--rule); padding-inline-start: 12px; }
.ex-ja { font-size: 1.12rem; line-height: 2.1; margin: 0 !important; }
.ex-tr { color: var(--ink-soft); font-size: 0.93rem; margin: 0 !important; }
.g-more { font-weight: 800; text-align: end; }

.read-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.read-tools .btn-play { margin-inline-start: auto; width: auto; display: inline-flex; align-items: center; gap: 6px; padding: 5px 16px; border: 0; border-radius: 999px; background: var(--sky-pale); color: var(--ink); font: inherit; font-weight: 700; font-size: 0.9rem; cursor: pointer; box-shadow: none; }
.read-tools .btn-play:hover { background: var(--accent); color: var(--accent-ink); }
.reading { background: var(--card); border: var(--line); border-radius: var(--r-lg); box-shadow: var(--sticker-shadow-sm); padding: 16px 22px 12px; }
.reading h3 { margin-top: 0; }
.reading h3 small { color: var(--ink-soft); font-weight: 600; margin-inline-start: 6px; }
.r-line { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; padding: 6px 8px; border-radius: 12px; cursor: pointer; }
.r-line:hover { background: var(--cloud); }
.r-line.playing { background: var(--sky-pale); }
.r-s { font-weight: 700; color: var(--link); white-space: nowrap; line-height: 2.2; grid-row: span 2; }
.r-ja { font-size: 1.14rem; line-height: 2.2; grid-column: 2; }
.r-line:not(:has(.r-s)) .r-ja, .r-line:not(:has(.r-s)) .r-tr { grid-column: 1 / -1; }
.r-tr { grid-column: 2; color: var(--ink-soft); font-size: 0.93rem; line-height: 1.6; display: none; padding-bottom: 6px; }
.show-tr .r-tr, .r-line.open .r-tr { display: block; }
.read-hint { color: var(--ink-soft); font-size: 0.85rem; font-weight: 600; margin-top: 8px; }

/* ---------- 4 択の問題 ---------- */
.q { background: var(--card); border: var(--line); border-radius: var(--r-lg); box-shadow: var(--sticker-shadow-sm); padding: 16px 18px 14px; margin: 0 0 16px; scroll-margin-top: 80px; }
.q-text { font-size: 1.14rem; line-height: 2.1; font-weight: 400; margin-bottom: 10px; }
.q-num { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 0 7px; margin-inline-end: 10px; border-radius: 999px; border: 0; background: var(--sky-pale); font-family: var(--disp); font-weight: 700; font-size: 0.85rem; vertical-align: middle; line-height: 1; }
.q-choices { list-style: none; margin: 0 !important; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.q-choices li { margin: 0; }
.q-choices.long { grid-template-columns: 1fr; }
.q-choice { width: 100%; height: 100%; display: flex; align-items: center; gap: 10px; text-align: start; padding: 9px 12px; border: var(--line); border-radius: 12px; background: var(--card); color: var(--ink); font: inherit; font-size: 1.05rem; line-height: 1.8; cursor: pointer; transition: transform 0.08s, background 0.12s; }
.q-choice:hover { background: var(--cloud); }
.q-choice:active { transform: translateY(1px); }
.q-c-num { flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; border: var(--line); display: inline-flex; align-items: center; justify-content: center; font-family: var(--disp); font-weight: 800; font-size: 0.82rem; background: var(--card); color: var(--ink); line-height: 1; }
.q-choice.sel { background: var(--chip-gold); border-color: var(--ink-soft); }
.q-choice.sel .q-c-num { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.q-choice.ok { background: var(--meadow-pale); border-color: var(--ok); box-shadow: inset 0 0 0 1px var(--ok); }
.q-choice.ok::after, .q-choice.ng::after { margin-inline-start: auto; font-weight: 800; }
.q-choice.ok::after { content: "○"; color: var(--ok); }
.q-choice.ng::after { content: "×"; color: var(--ng); }
.q-choice.ok .q-c-num { background: var(--ok); color: #fff; border-color: var(--ok); }
.q-choice.ng { background: var(--cheek-pale); border-color: var(--ng); border-style: dashed; }
.q-choice.ng .q-c-num { background: var(--ng); color: #fff; border-color: var(--ng); }
.q.locked .q-choice { cursor: default; }
.q.locked .q-choice:not(.ok):not(.ng) { opacity: 0.62; }
.q-mark { display: inline-block; font-family: var(--disp); font-weight: 700; padding: 1px 12px; border-radius: 999px; margin-bottom: 6px; color: #fff; }
.q.right .q-mark { background: var(--ok); }
.q.miss .q-mark { background: var(--ng); }
.q-ex { margin-top: 10px; }
.q-ex summary { cursor: pointer; font-weight: 800; font-size: 0.9rem; color: var(--link); list-style: none; }
.q-ex summary::-webkit-details-marker { display: none; }
.q-ex summary::before { content: "▸ "; }
.q-ex[open] summary::before { content: "▾ "; }
.q-ex-body { background: var(--cloud); border-radius: var(--r-md); padding: 10px 14px; margin-top: 6px; font-size: 0.96rem; line-height: 1.8; }
.q-ans { font-weight: 700; }
.js .q:not(.locked) .q-ex { display: none; }
.q.shake { animation: shake 0.35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
.q.pop-ok { animation: pop-ok 0.35s; }
@keyframes pop-ok { 40% { transform: scale(1.02); } }

/* ---------- 模試: 本番の問題用紙と解答用紙 ----------
   表紙(t-cover)→ 問題用紙(t-paper)+ 解答用紙(t-sheet)→ 休憩(t-break)→ 結果。
   問題用紙は白い紙に黒一色・明朝。色が付くのは採点のあとだけ。 */
:root { --pg-sheet: #ffffff; --pg-ink: #141414; --pg-soft: #4a4a4a; --pg-rule: #2a2a2a; --pg-hi: #ececec; --pg-shadow: rgba(20, 20, 20, 0.28);
  --exam: "Shippori Mincho", "Zen Kaku Gothic New", "Hiragino Mincho ProN", serif; --exam-ui: "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", sans-serif; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --pg-sheet: #1c1d20; --pg-ink: #ececec; --pg-soft: #b4b4b4; --pg-rule: #8c8c8c; --pg-hi: #2e2f33; --pg-shadow: rgba(0, 0, 0, 0.6); }
}
:root[data-theme="dark"] { --pg-sheet: #1c1d20; --pg-ink: #ececec; --pg-soft: #b4b4b4; --pg-rule: #8c8c8c; --pg-hi: #2e2f33; --pg-shadow: rgba(0, 0, 0, 0.6); }

main[data-page="test"] .test { max-width: 1160px; }

/* 表紙 */
.t-cover { max-width: 760px; margin: 0 auto 16px; background: var(--pg-sheet); color: var(--pg-ink); border: 1px solid var(--pg-rule); border-radius: 2px;
  box-shadow: 0 22px 44px -34px var(--pg-shadow); padding: 30px clamp(18px, 5vw, 48px) 30px; display: grid; gap: 16px; justify-items: center; text-align: center; }
.cv-head { display: grid; gap: 2px; justify-items: center; }
.cv-lv { font-family: var(--exam); font-size: 3.2rem; font-weight: 700; line-height: 1; letter-spacing: 0.04em; }
.cv-name { font-family: var(--exam-ui); font-size: 0.95rem; color: var(--pg-soft); }
.cv-plan { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.cv-plan li { display: grid; padding: 6px 14px; border: 1px solid var(--pg-ink); border-radius: 2px; line-height: 1.5; font-size: 0.86rem; }
.cv-plan li b { font-family: var(--exam); font-weight: 700; font-size: 0.98rem; }
.cv-plan li span { color: var(--pg-soft); }
.cv-plan li.brk { border-style: dashed; border-color: var(--pg-soft); color: var(--pg-soft); align-content: center; }
.cv-mode { border: 0; margin: 0; padding: 0; width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cv-mode legend { font-weight: 700; margin: 0 auto 8px; font-size: 0.95rem; }
.cv-mode .mode-card { position: relative; display: grid; gap: 2px; padding: 12px 14px 12px 40px; text-align: start; border: 1px solid var(--rule); border-radius: 12px; background: var(--card); color: var(--ink); cursor: pointer; box-shadow: none; }
.cv-mode .mode-card input { position: absolute; inset-inline-start: 14px; top: 15px; width: 17px; height: 17px; margin: 0; accent-color: var(--accent); }
.cv-mode .mode-card strong { font-family: var(--disp); font-size: 1.02rem; }
.cv-mode .mode-card span { color: var(--ink-soft); font-size: 0.86rem; line-height: 1.5; }
.cv-mode .mode-card:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cv-mode .mode-card:hover { transform: none; }
.cv-notes { width: 100%; text-align: start; border-top: 1px solid var(--pg-rule); padding-top: 14px; }
.cv-nh { font-weight: 700; margin-bottom: 6px; }
.cv-notes ol { margin: 0; padding-inline-start: 1.4em; display: grid; gap: 8px; font-size: 0.95rem; line-height: 1.7; }
.cv-notes li > [lang="ja"] { font-family: var(--exam); }
.cv-tr { display: block; color: var(--pg-soft); font-size: 0.86rem; line-height: 1.55; }
.cv-start { padding: 13px 64px; font-size: 1.1rem; cursor: pointer; }
.t-cover .t-resume .btn { padding: 9px 20px; font-size: 0.95rem; cursor: pointer; }

/* 問題用紙 + 解答用紙 */
.t-run { display: grid; grid-template-columns: minmax(0, 1fr) 252px; gap: 18px; align-items: start; }
.t-run:has(> .t-sheet[hidden]) { grid-template-columns: minmax(0, 1fr); }
.t-paper { background: var(--pg-sheet); color: var(--pg-ink); border: 1px solid var(--pg-rule); border-radius: 2px; box-shadow: 0 22px 44px -34px var(--pg-shadow);
  padding: clamp(18px, 4vw, 44px) clamp(16px, 4vw, 48px); font-family: var(--exam); min-width: 0; }
.t-paper [lang="ja"] { font-family: var(--exam); }
.t-part + .t-part { margin-top: 56px; }
.t-part-h { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; border-bottom: 2px solid var(--pg-ink); padding-bottom: 8px; margin-bottom: 8px; }
.t-part-h b { font-size: 1.2rem; font-weight: 700; letter-spacing: 0.06em; }
.t-part-h span { font-size: 1rem; }
.t-paper .t-section > h2 { font-family: var(--body, var(--exam-ui)); font-size: 0.74rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--pg-soft);
  margin: 22px 0 0; padding: 0; background: none; border-radius: 0; }
.t-paper .t-group > h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 1rem; margin: 26px 0 8px; }
.t-paper .mon-box { border: 1.5px solid var(--pg-ink); padding: 0 10px; font-family: var(--exam-ui); font-weight: 700; line-height: 1.8; font-size: 0.95rem; }
.t-paper .t-group > h3 small { font-family: var(--body, var(--exam-ui)); font-weight: 400; font-size: 0.8rem; color: var(--pg-soft); margin: 0; }
.t-paper .t-instr { background: none; border: 0; border-radius: 0; padding: 0; margin: 0 0 18px; font-weight: 400; font-size: 1rem; line-height: 1.9; }
.t-paper .q { background: none; border: 0; border-radius: 0; box-shadow: none; padding: 4px 6px; margin: 0 -6px 14px; cursor: pointer; }
.t-paper .q.cur { background: var(--pg-hi); }
.t-paper .q-text { font-size: 1.125rem; line-height: 2; letter-spacing: 0.04em; font-weight: 400; margin-bottom: 2px; }
.t-paper .q-num { display: inline-block; min-width: 2em; height: auto; padding: 0; margin-inline-end: 4px; border: 0; border-radius: 0; background: none;
  font-family: var(--exam-ui); font-weight: 700; font-size: 1rem; vertical-align: baseline; line-height: inherit; }
.t-paper .q-choices { display: grid; gap: 0 18px; padding-inline-start: 2em; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.t-paper .q-choices.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.t-paper .q-choices.c1 { grid-template-columns: minmax(0, 1fr); }
.t-paper .q-choice { display: flex; align-items: baseline; gap: 8px; width: auto; height: auto; padding: 1px 6px; border: 0; border-radius: 3px; background: none; color: inherit;
  font-size: 1.06rem; line-height: 1.85; letter-spacing: 0.03em; cursor: inherit; }
.t-paper .q-choice:hover { background: none; }
.t-paper .q-c-num { width: auto; height: auto; border: 0; border-radius: 0; background: none; color: inherit; font-family: var(--exam-ui); font-weight: 700; font-size: 0.92rem; }
.t-paper .q-choice.sel { background: var(--pg-hi); }
.t-paper .q-choice.sel .q-c-num { background: none; color: inherit; }
.t-paper .q-choice.ok { background: var(--meadow-pale); box-shadow: inset 0 0 0 1.5px var(--ok); }
.t-paper .q-choice.ok .q-c-num { background: none; color: var(--ok); }
.t-paper .q-choice.ng { background: var(--cheek-pale); box-shadow: inset 0 0 0 1px var(--ng); }
.t-paper .q-choice.ng .q-c-num { background: none; color: var(--ng); }
.t-paper .q-choice.ok::after, .t-paper .q-choice.ng::after { margin-inline-start: 4px; }
.t-paper .q.locked .q-choice:not(.ok):not(.ng) { opacity: 0.7; }
.t-paper .q-mark { font-family: var(--exam-ui); font-size: 0.8rem; padding: 0 10px; }
.t-paper .q-ex { font-family: var(--body, var(--exam-ui)); padding-inline-start: 2em; }
.t-paper .q-ex [lang="ja"] { font-family: var(--exam-ui); }
.t-paper .q-ex-body { background: var(--pg-hi); border-radius: 4px; }
.t-paper .passage { background: none; border: 1px solid var(--pg-rule); border-radius: 0; padding: 18px 22px; margin: 6px 0 20px; font-size: 1.08rem; line-height: 2.05; letter-spacing: 0.04em; }
.t-paper .passage h4 { text-align: center; font-weight: 700; }
.t-paper .passage th, .t-paper .passage td { border: 1px solid var(--pg-ink); }
.t-paper .passage th { background: var(--pg-hi); }
.t-paper .gap { border: 1px solid var(--pg-ink); border-radius: 0; background: none; font-family: var(--exam-ui); font-weight: 700; }
.t-paper u.tgt { text-decoration-thickness: 1px; text-underline-offset: 6px; }
.t-paper ruby rt { color: var(--pg-soft); }
.t-paper .wk [lang="ja"], .t-paper.wk [lang="ja"] { word-spacing: 0.32em; }

.t-sheet { position: sticky; top: 84px; max-height: calc(100vh - 176px); overflow-y: auto; overscroll-behavior: contain; background: var(--pg-sheet); color: var(--pg-ink);
  border: 1px solid var(--pg-rule); border-radius: 2px; padding: 10px 10px 14px; font-family: var(--exam-ui); font-variant-numeric: tabular-nums; }
.mk-h { text-align: center; font-weight: 700; font-size: 0.86rem; letter-spacing: 0.12em; padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1.5px solid var(--pg-ink); }
.mk-ph { font-size: 0.76rem; font-weight: 700; background: var(--pg-ink); color: var(--pg-sheet); padding: 1px 8px; margin: 12px 0 2px; }
.mk-gh { font-size: 0.72rem; font-weight: 700; color: var(--pg-soft); margin: 8px 0 2px; }
.mk-row { display: grid; grid-template-columns: 2.4em minmax(0, 1fr); align-items: center; padding: 2px 4px; border-radius: 3px; }
.mk-row.cur { background: var(--pg-hi); }
.mk-n { background: none; border: 0; padding: 0 6px 0 0; color: inherit; font: inherit; font-size: 0.78rem; font-weight: 700; text-align: end; cursor: pointer; }
.mk-bs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.mk { height: 22px; min-width: 0; padding: 0; border: 1px solid var(--pg-soft); border-radius: 50% / 50%; background: transparent; color: var(--pg-soft);
  font: inherit; font-size: 0.62rem; line-height: 1; cursor: pointer; }
.mk:hover:not(:disabled) { border-color: var(--pg-ink); color: var(--pg-ink); }
.mk[aria-pressed="true"] { background: var(--pg-ink); border-color: var(--pg-ink); color: var(--pg-sheet); }
.mk.ok { box-shadow: 0 0 0 2px var(--ok); border-color: var(--ok); }
.mk.ng { background: var(--ng); border-color: var(--ng); color: #fff; }
.mk:disabled { cursor: default; }

/* 時計つきのバー */
.t-bar { position: sticky; bottom: 10px; z-index: 40; display: flex; align-items: center; gap: 12px; background: var(--card); border: var(--line); border-radius: 14px;
  box-shadow: var(--sticker-shadow); padding: 8px 10px 8px 12px; margin: 16px 0; }
.t-bar .btn { padding: 9px 18px; font-size: 0.92rem; cursor: pointer; }
.t-bar [data-submit] { margin-inline-start: auto; }
.t-clock { position: relative; width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--card); }
.t-clock::before { content: ""; position: absolute; inset: 1px; border-radius: 50%; background: repeating-conic-gradient(var(--ink) 0 2deg, transparent 2deg 30deg);
  -webkit-mask: radial-gradient(circle, transparent 72%, #000 73%); mask: radial-gradient(circle, transparent 72%, #000 73%); }
.t-clock::after { content: ""; position: absolute; left: calc(50% - 3px); top: calc(50% - 3px); width: 6px; height: 6px; border-radius: 50%; background: var(--ink); }
.t-clock-rem { position: absolute; inset: 7px; border-radius: 50%; background: conic-gradient(var(--clk, var(--accent)) var(--deg, 0deg), transparent 0); opacity: 0.85; }
.t-clock-sec { position: absolute; left: calc(50% - 0.75px); bottom: 50%; width: 1.5px; height: 40%; background: var(--ink); transform-origin: 50% 100%; transform: rotate(var(--s, 0deg)); }
.t-bar.low { --clk: var(--ng); }
.t-bar.low .t-time { color: var(--ng); }
.t-timebox { display: grid; line-height: 1.3; }
.t-part-name { font-size: 0.72rem; font-weight: 700; color: var(--ink-soft); }
.t-part-name:empty { display: none; }
.t-time { font-family: var(--disp); font-weight: 700; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.t-used { font-size: 0.74rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.t-used:empty { display: none; }
.t-progress { font-weight: 600; color: var(--ink-soft); font-size: 0.86rem; }
.t-sheet-btn { display: none !important; }

/* 休憩 */
.t-break { max-width: 620px; margin: 0 auto 20px; background: var(--card); border: var(--line); border-radius: var(--r-lg); box-shadow: var(--sticker-shadow);
  padding: 26px 24px 28px; text-align: center; display: grid; gap: 10px; justify-items: center; }
.t-break img { width: 120px; height: 120px; object-fit: contain; }
.t-break h2 { font-size: 1.5rem; font-weight: 700; }
.t-break-up { color: var(--ng); font-weight: 700; }
.t-break .btn { cursor: pointer; padding: 11px 26px; }

@media (max-width: 979px) {
  .t-run { grid-template-columns: minmax(0, 1fr); }
  .t-sheet-btn { display: inline-flex !important; }
  .t-sheet { position: fixed; inset-inline: 0; top: auto; bottom: var(--bar-h, 80px); z-index: 45; max-height: min(52vh, 460px); border-radius: 12px 12px 0 0;
    box-shadow: 0 -14px 34px -10px var(--pg-shadow); padding: 10px 16px 14px; transform: translateY(calc(100% + var(--bar-h, 80px))); visibility: hidden;
    transition: transform 0.25s ease, visibility 0.25s; }
  .t-sheet.open { transform: none; visibility: visible; }
  .mk { height: 30px; font-size: 0.72rem; }
  .mk-row { grid-template-columns: 2.8em minmax(0, 1fr); padding: 3px 4px; }
}
@media (max-width: 560px) {
  .cv-mode { grid-template-columns: 1fr; }
  .t-paper .q-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-inline-start: 0.6em; }
  .t-paper .q-choices.c1 { grid-template-columns: minmax(0, 1fr); }
  .t-paper .q-text { font-size: 1.06rem; }
  .t-paper .passage { padding: 14px 14px; font-size: 1.02rem; }
  .t-bar { flex-wrap: wrap; gap: 8px 10px; padding: 8px; }
  .t-bar .btn { padding: 8px 12px; font-size: 0.84rem; }
  .t-progress { font-size: 0.78rem; }
}
@media (prefers-reduced-motion: reduce) { .t-sheet { transition: none; } }
.t-result, .done-card { background: var(--card); border: var(--line); border-radius: var(--r-lg); box-shadow: var(--sticker-shadow); padding: 22px 24px 24px; text-align: center; margin-bottom: 20px; display: grid; gap: 10px; justify-items: center; }
.t-result h2, .done-card h2 { font-size: 1.5rem; font-weight: 700; }
.t-result img, .done-card img { width: 130px; height: 130px; object-fit: contain; }
.score-big { font-family: var(--disp); font-size: 2.6rem; font-weight: 700; line-height: 1.1; }
.verdict { display: inline-block; font-weight: 700; padding: 2px 16px; border-radius: 999px; background: var(--chip-gold); color: var(--ink); }
.sec-bars { width: 100%; max-width: 460px; display: grid; gap: 8px; text-align: start; }
.sec-bars div { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; font-weight: 700; font-size: 0.9rem; }
.sec-bars .bar { grid-column: 1 / -1; }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 6px; }
.result-actions .btn { padding: 10px 22px; font-size: 0.95rem; cursor: pointer; }
.xp-gain { font-family: var(--disp); font-weight: 700; font-size: 1.3rem; color: var(--sun-deep); }
.only-wrong .q.right { display: none; }
.t-key { margin: 26px 0; background: var(--card); border: var(--line); border-radius: var(--r-md); padding: 12px 18px; }
.t-key summary { cursor: pointer; font-weight: 800; }
.key-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; margin-top: 12px; }
.key-list li { display: flex; justify-content: space-between; border: var(--line); border-radius: 10px; padding: 1px 10px; font-weight: 700; }
.key-list span { color: var(--ink-soft); }
.test-level { margin-bottom: 34px; }
.test-level h2 { font-size: 1.4rem; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.test-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.test-card { display: grid; gap: 2px; background: var(--card); border: var(--line); border-radius: var(--r-md); box-shadow: var(--sticker-shadow-sm); padding: 14px 16px; color: var(--ink); }
.test-card:hover { text-decoration: none; transform: translateY(-3px); }
.test-card strong { font-family: var(--disp); font-size: 1.15rem; }
.test-card span { color: var(--ink-soft); font-size: 0.86rem; font-weight: 600; }
.test-card small { font-weight: 800; color: var(--ink-soft); }
.test-card.taken small { color: var(--ok); }

/* ---------- 文法 ---------- */
.g-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.g-search { flex: 1; min-width: 200px; padding: 10px 18px; border: var(--line); border-radius: 999px; font: inherit; font-weight: 600; background: var(--card); color: var(--ink); }
.g-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.g-row { display: grid; grid-template-columns: auto 1fr; gap: 0 10px; align-items: baseline; background: var(--card); border: var(--line); border-radius: var(--r-md); padding: 8px 14px; color: var(--ink); height: 100%; }
.g-row:hover { text-decoration: none; background: var(--cloud); }
.g-no { grid-row: span 2; font-family: var(--disp); font-weight: 700; color: var(--ink-soft); font-size: 0.85rem; min-width: 1.6em; }
.g-row strong { font-size: 1.1rem; }
.g-row-m { color: var(--ink-soft); font-size: 0.86rem; font-weight: 600; line-height: 1.5; }
.g-row.done { border-color: var(--ok); }
.g-row.done .g-no { color: var(--ok); }
.g-level { margin-bottom: 40px; }
.g-level h2 { font-size: 1.35rem; font-weight: 700; margin-bottom: 12px; }
.g-level h2 a { color: var(--ink); }
.g-level h2 small { color: var(--ink-soft); font-size: 0.85rem; }
.g-article { margin: 0 auto 20px; padding: 26px clamp(18px, 4vw, 40px) 30px; max-width: none; }
.g-article h2 { margin-top: 30px; }
.g-article .g-furi { float: inline-end; }
.g-meaning-hero { font-size: 1.15rem; color: var(--ink) !important; font-weight: 800 !important; }
.g-related { display: flex; flex-wrap: wrap; gap: 8px; }
.g-related .word-chip { text-decoration: none; }
.g-lesson { text-align: center; margin-top: 20px; }
.g-lesson .btn { font-size: 0.95rem; padding: 10px 22px; }
.g-quiz .q { box-shadow: none; }
.g-quiz-result { text-align: center; font-weight: 700; font-family: var(--disp); font-size: 1.2rem; }

/* ---------- かな ---------- */
.kana-article { max-width: 860px; margin-top: 26px; }
.kana-table { border: none !important; table-layout: fixed; min-width: 300px; }
.kana-table td { border: none !important; padding: 3px !important; text-align: center !important; }
.kana-table .kana-cell { width: 100%; min-width: 0; }
.kana-game { max-width: 560px; margin: 0 auto; text-align: center; align-items: center; }
.kana-game h2 { font-size: 1.3rem; text-transform: none; letter-spacing: 0; color: var(--ink); }
.game-stage { width: 100%; display: grid; gap: 12px; justify-items: center; }
.game-kana { font-size: 5rem; font-weight: 800; line-height: 1.2; }
.game-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.game-choices button { padding: 12px; border: var(--line); border-radius: var(--r-md); background: var(--card); color: var(--ink); font-family: var(--disp); font-size: 1.3rem; font-weight: 800; cursor: pointer; box-shadow: var(--sticker-shadow-sm); }
.game-choices button:active { transform: translateY(3px); box-shadow: none; }
.game-choices button.ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.game-choices button.ng { background: var(--ng); color: #fff; }
.game-hud { display: flex; justify-content: space-between; width: 100%; font-family: var(--disp); font-weight: 700; font-size: 1.1rem; }
.game-best { font-weight: 800; color: var(--ink-soft); margin-inline-start: 10px; }

/* ---------- レベル判定・ノート ---------- */
.place-progress { text-align: center; font-weight: 800; color: var(--ink-soft); margin-bottom: 10px; }
.js .place-quiz .q { display: none; }
.js .place-quiz .q.show { display: block; }
.place-levels { width: 100%; max-width: 420px; display: grid; gap: 6px; }
.review-item { position: relative; }
.review-src { display: block; font-size: 0.8rem; font-weight: 700; color: var(--ink-soft); margin-bottom: 4px; }

/* ---------- お祝い ---------- */
.toast-wrap { position: fixed; inset-inline: 0; bottom: 84px; z-index: 90; display: grid; justify-items: center; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--card); border: var(--line); border-radius: 999px; box-shadow: var(--sticker-shadow); padding: 6px 18px 6px 8px; font-weight: 800; animation: toast-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), toast-out 0.4s ease 3.2s forwards; }
.toast img { width: 44px; height: 44px; object-fit: contain; }
@keyframes toast-in { from { opacity: 0; transform: translateY(30px) scale(0.8); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(20px); } }
.confetti { position: fixed; top: -12px; width: 10px; height: 14px; z-index: 95; pointer-events: none; border-radius: 3px; animation: confetti-fall linear forwards; }
@keyframes confetti-fall { to { transform: translateY(105vh) rotate(720deg); opacity: 0.8; } }
@media (prefers-reduced-motion: reduce) {
  .confetti { display: none; }
  .stepping .step.show, .q.shake, .q.pop-ok, .toast { animation: none; }
  .bar-fill { transition: none; }
}

/* ---------- せまい画面 ---------- */
@media (max-width: 980px) {
  .tile-grid.tile-4 { grid-template-columns: 1fr 1fr; }
  .dash-grid { grid-template-columns: 1fr 1fr 1fr; }
  .dash-today { grid-column: 1 / -1; }
  .badge-grid { grid-template-columns: repeat(4, 1fr); }
  .test-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .tile-grid, .tile-grid.tile-4, .course-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
  .tile-card img { height: 72px; }
  .word-grid { grid-template-columns: 1fr; }
  .q-choices { grid-template-columns: 1fr; }
  .passage { font-size: 1.04rem; padding: 14px 16px; }
  .stepper li { font-size: 0.72rem; }
}
@media (max-width: 560px) {
  main[data-page] .container { padding: 0 16px; }
  .dash-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .dash-count { grid-column: 1 / -1; }
  .dash-card { padding: 14px 14px 16px; }
  .streak-num { font-size: 2.4rem; }
  .streak-row img { width: 54px; height: 54px; }
  .badge-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .mode-grid { grid-template-columns: 1fr; }
  .t-bar { border-radius: var(--r-md); padding: 8px 8px 8px 14px; gap: 8px; flex-wrap: wrap; }
  .t-bar .btn { padding: 8px 14px; font-size: 0.85rem; }
  .q { padding: 14px 14px 12px; }
  .q-text { font-size: 1.06rem; }
  .day-path { grid-template-columns: 1fr; }
  .g-list { grid-template-columns: 1fr; }
  .tile-grid, .tile-grid.tile-4 { grid-template-columns: 1fr; }
  .course-grid { grid-template-columns: 1fr; }
  .test-grid { grid-template-columns: 1fr 1fr; }
}

[hidden] { display: none !important; }
