/* ==========================================================================
   SDS Study — 一橋大学大学院 SDS 入試対策
   アプリの外枠は落ち着いた紺とグレー。本文 16px、補足の文字も 14px 以上。
   ========================================================================== */

/* ---------------------------------------------------------------- fonts */
@font-face { font-family: "LM Mono"; src: url(vendor/lmmono/lmmono10-regular.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "LM Mono"; src: url(vendor/lmmono/lmmono10-italic.woff2) format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "LM Mono"; src: url(vendor/lmmono/lmmonolt10-bold.woff2) format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

/* ---------------------------------------------------------------- tokens */
:root {
  --brand: #1f3a5f;
  --brand-dk: #162b47;
  --brand-lt: #eaf0f6;
  --brand-ink: #1f3a5f;
  --ink: #1c2530;
  --ink-2: #445160;
  --ink-3: #5a6776;
  --line: #d8dee5;
  --line-2: #e8ecf0;
  --bg: #f3f5f8;
  --card: #ffffff;
  --paper: #ffffff;
  --field: #ffffff;
  --good: #2b7451;
  --good-lt: #e8f4ed;
  --warn: #8a5a10;
  --warn-lt: #fbf3e5;
  --bad: #ab3a2f;
  --bad-lt: #fbecea;
  --accent: #c2621a;
  --accent-lt: #fdf1e7;
  --sub: var(--brand);
  --sub-dk: var(--brand-dk);
  --sub-lt: var(--brand-lt);
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 35, 55, .05);
  --shadow-lg: 0 12px 32px rgba(20, 35, 55, .18);
  --fs: 16.5px;
  --top-h: 58px;
  --sans: "Noto Sans JP", "Hiragino Sans", "Yu Gothic UI", system-ui, sans-serif;
  --serif: "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --mono: "LM Mono", "Noto Sans JP", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ui-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
/* 分野色は彩度を落として、目印（細い線・小さな印）にだけ使う */
[data-subject="stat"] { --sub: #2f5a86; --sub-dk: #24435f; --sub-lt: #edf2f7; }
[data-subject="info"] { --sub: #2a6965; --sub-dk: #1f4b48; --sub-lt: #e9f3f2; }
[data-subject="econ"] { --sub: #8a3e48; --sub-dk: #622e35; --sub-lt: #f7eeef; }
[data-subject="management"] { --sub: #574a82; --sub-dk: #40365e; --sub-lt: #f0eef6; }
[data-subject="past"] { --sub: #3b4b5e; --sub-dk: #2a3644; --sub-lt: #eef1f4; }

/* ---------------------------------------------------------------- base */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.75; letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }
a { color: var(--sub); }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
img, svg { max-width: 100%; }
h1, h2, h3, h4 { text-wrap-style: balance; word-break: auto-phrase; }
p, li, .lead { text-wrap-style: pretty; }
.nw, .num { white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); color: var(--brand); padding: 8px 12px; z-index: 99; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--brand) 70%, transparent); outline-offset: 2px; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.inline { width: 1em; height: 1em; vertical-align: -.14em; margin: 0 .1em; }
.muted { color: var(--ink-3); }
.small, .tiny { font-size: 14px; }

/* ---------------------------------------------------------------- layout */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 228px; background: var(--card); color: var(--ink-2); display: flex;
  flex-direction: column; padding: 18px 12px 14px; z-index: 30; border-right: 1px solid var(--line);
}
.brand { display: flex; gap: 11px; align-items: center; color: var(--ink); text-decoration: none; padding: 2px 8px 22px; }
.brand-mark { width: 38px; height: 38px; border-radius: 9px; background: var(--brand); display: grid; place-items: center; flex: none;
  font-weight: 700; font-size: 13px; letter-spacing: .02em; color: #fff; }
.brand strong { display: block; font-size: 16.5px; line-height: 1.2; color: var(--ink); }
.brand small { display: block; font-size: 12.5px; color: var(--ink-3); margin-top: 3px; white-space: nowrap; }
#nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; color: var(--ink-2); text-decoration: none; border-radius: 8px;
  font-size: 15px; font-weight: 500; white-space: nowrap; }
.nav-link .ic { width: 20px; height: 20px; stroke-width: 1.7; }
.nav-link:hover { background: var(--line-2); color: var(--ink); }
.nav-link.active { background: var(--brand-lt); color: var(--brand); font-weight: 700; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); display: inline-block; flex: none; }
.dot.off { background: #9aa6b2; }
.dot.wait, .dot.sync { background: #c18a2c; }
.dot.err { background: var(--bad); }

.shell { margin-left: 228px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--card); border-bottom: 1px solid var(--line); padding: 0 28px; min-height: var(--top-h);
}
.crumb { font-size: 14px; color: var(--ink-3); display: flex; align-items: center; gap: 7px; min-width: 0; overflow: hidden; white-space: nowrap; }
.crumb a { color: var(--ink-3); text-decoration: none; flex: none; }
.crumb a:hover { color: var(--ink); }
.crumb span { color: var(--ink-3); flex: none; }
.crumb b { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.top-actions { display: flex; gap: 8px; flex: none; align-items: center; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); background: var(--card); border-radius: 9px;
  padding: 0 12px; height: 40px; min-width: 40px; font-size: 14px; color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.icon-btn:hover { border-color: #b9c3ce; color: var(--ink); }
.icon-btn .ic { width: 19px; height: 19px; }
.icon-btn.gear { padding: 0; width: 40px; }
.icon-btn.gear .ic { width: 20px; height: 20px; stroke-width: 1.7; }
.countdown { color: var(--brand); font-weight: 700; border-color: color-mix(in srgb, var(--brand) 30%, var(--line)); background: var(--brand-lt); }
.countdown .cd-short { display: none; }
kbd { font-family: var(--ui-mono); font-size: 12px; border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; color: var(--ink-3); line-height: 1.5; }
main { padding: 30px 34px 90px; width: 100%; max-width: 1200px; margin: 0 auto; flex: 1; }
main:focus { outline: none; }
#mobile-nav { display: none; }
.read-progress { position: fixed; top: 0; left: 0; height: 3px; background: var(--brand); z-index: 40; width: 0; transition: width .15s; }

/* ---------------------------------------------------------------- common UI */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 20px; margin: 0 0 22px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.page-head > div:first-child { min-width: 0; }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .06em; color: var(--ink-3); }
.page-head h1 { margin: 4px 0 4px; font-size: 27px; line-height: 1.4; color: var(--ink); letter-spacing: .02em; font-weight: 700; }
.lead { margin: 0; color: var(--ink-2); font-size: 15px; line-height: 1.75; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; min-width: 0; }
.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 9px; padding: 0 17px; min-height: 44px; font-size: 15px; font-weight: 600; text-decoration: none; line-height: 1.35; white-space: nowrap; cursor: pointer;
}
.btn:hover { border-color: #b6c0cb; background: #f8f9fb; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dk); border-color: var(--brand-dk); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.small { padding: 0 13px; min-height: 38px; font-size: 14px; }
.btn.selected { background: var(--good-lt); border-color: #a9d0bb; color: var(--good); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.btn.danger:hover { background: var(--bad-lt); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.btn .ic { width: 17px; height: 17px; stroke-width: 2; }
.button-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); min-width: 0; }
.card h2 { font-size: 17px; margin: 0 0 10px; color: var(--ink); line-height: 1.5; }
.card h3 { font-size: 16px; margin: 0 0 6px; }
.card > p:first-of-type { margin-top: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.card-head a { font-size: 14px; text-decoration: none; color: var(--brand); white-space: nowrap; }
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid > .card { display: flex; flex-direction: column; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin: 36px 0 12px; gap: 6px 12px; flex-wrap: wrap; }
.section-head h2 { margin: 0; font-size: 18px; color: var(--ink); min-width: 0; line-height: 1.5; }
.section-head a { font-size: 14px; text-decoration: none; white-space: nowrap; color: var(--brand); }
.badge { display: inline-flex; align-items: center; border-radius: 5px; padding: 0 7px; font-size: 13px; font-weight: 600; line-height: 1.7;
  background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.badge.base { background: var(--good-lt); color: var(--good); }
.badge.standard { background: var(--brand-lt); color: var(--brand); }
.badge.advanced { background: var(--warn-lt); color: var(--warn); }
.badge.exam { background: var(--brand); color: #fff; }
.badge.flag { background: var(--bad-lt); color: var(--bad); }
.meta { display: flex; gap: 4px 14px; flex-wrap: wrap; align-items: center; color: var(--ink-3); font-size: 14px; }
.meta > span { white-space: nowrap; }
.info-box { background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--brand); padding: 12px 16px; border-radius: 0 8px 8px 0; font-size: 14.5px; margin: 12px 0 18px; color: var(--ink-2); }
.empty { text-align: center; padding: 44px 20px; color: var(--ink-2); background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty h3 { margin-top: 0; }
.tabs { display: flex; gap: 2px; flex-wrap: wrap; margin: 0 0 18px; border-bottom: 1px solid var(--line); }
.tabs a { text-decoration: none; padding: 9px 14px 11px; color: var(--ink-3); font-size: 15px; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--ink); border-bottom-color: var(--brand); }
.tabs a .pip { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 7px; vertical-align: .06em; background: var(--sub); }
.progress { height: 7px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--sub); border-radius: 99px; min-width: 0; transition: width .3s; }
.progress.thin { height: 4px; margin-top: 8px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar > * { min-width: 0; }
.toolbar input, .toolbar select, .field input, .field select, .field textarea, textarea,
input[type=text], input[type=url], input[type=search], input[type=date] {
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; background: var(--field); min-width: 0; min-height: 44px; font-size: 15px;
}
input:focus, textarea:focus { border-color: #9fb1c5; outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent); }
.toolbar input[type=search] { flex: 1 1 240px; }
.field { margin-top: 14px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--ink-2); }
.field-help { font-size: 14px; color: var(--ink-3); margin: 8px 0 0; }
textarea { width: 100%; min-height: 110px; resize: vertical; line-height: 1.7; font-family: var(--sans); }
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 1; }
select {
  -webkit-appearance: none; appearance: none; border: 1px solid var(--line); border-radius: 9px; background-color: var(--field);
  padding: 0 38px 0 12px; line-height: 1.4; min-height: 44px; max-width: 100%; font-size: 15px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%236b7684' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; background-size: 12px 8px;
}
select:focus { border-color: #9fb1c5; outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent); }
summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
summary::before { content: ""; width: 7px; height: 7px; border-right: 1.7px solid currentColor; border-bottom: 1.7px solid currentColor; transform: rotate(-45deg); transition: transform .15s; margin: 0 3px 0 1px; flex: none; }
details[open] > summary::before { transform: rotate(45deg); }

/* list rows */
.list { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 13px 16px;
  text-decoration: none; color: var(--ink); position: relative; }
.list-row + .list-row { border-top: 1px solid var(--line-2); }
.list-row:hover { background: #f8f9fb; }
.list-row > * { min-width: 0; }
.list-row h3 { margin: 0 0 3px; font-size: 15.5px; line-height: 1.55; font-weight: 600; }
.row-num { font-weight: 700; font-size: 14px; color: var(--sub); background: var(--sub-lt); border-radius: 7px; text-align: center; padding: 6px 2px;
  font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1.4; }
.row-end { font-size: 14px; color: var(--ink-3); white-space: nowrap; text-align: right; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.4; }
.row-end small { font-size: 13px; color: var(--ink-3); font-weight: 500; font-variant-numeric: tabular-nums; }
.row-end.ok, .ok { color: var(--good); }
.row-end.ng, .ng { color: var(--bad); }
.row-end.pa, .pa { color: var(--warn); }
.row-end.ok, .row-end.ng, .row-end.pa { font-weight: 700; }

/* ---------------------------------------------------------------- home */
.hero { border-radius: 12px; color: #fff; padding: 26px 28px; margin-bottom: 16px; background: var(--brand);
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px 28px; align-items: center; }
.hero .eyebrow { color: #c8d6e6; letter-spacing: .04em; }
.hero h1 { margin: 4px 0 6px; font-size: 25px; line-height: 1.4; }
.hero p { margin: 0; color: #dde6ef; font-size: 15px; }
.hero .button-row { margin-top: 16px; }
.hero .btn { border-color: rgba(255,255,255,.4); background: transparent; color: #fff; }
.hero .btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.hero .btn.primary { background: #fff; border-color: #fff; color: var(--brand); }
.hero .btn.primary:hover { background: #eef3f8; color: var(--brand-dk); }
.hero-count { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.25);
  border-radius: 12px; padding: 14px 22px; min-width: 180px; color: #fff; text-decoration: none; }
.hero-count small { font-size: 13.5px; color: #d6e1ec; }
.hero-count strong { font-size: 40px; line-height: 1.2; font-variant-numeric: tabular-nums; font-weight: 700; }
.hero-count strong span { font-size: 17px; margin-left: 3px; }
.hero-count strong.set { font-size: 21px; padding: 6px 0; }
.hero-count.empty:hover { background: rgba(255,255,255,.16); }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 8px; }
.metric { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.metric small { color: var(--ink-3); font-size: 14px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric strong { display: block; font-size: 25px; line-height: 1.3; margin-top: 4px; color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.metric strong .u { font-size: 14px; color: var(--ink-3); font-weight: 500; margin-left: 4px; }
.continue-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: center; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; text-decoration: none; color: inherit; box-shadow: var(--shadow); }
.continue-card:hover { border-color: #b9c3ce; }
.continue-card .num { font-size: 22px; font-weight: 700; color: var(--sub); line-height: 1; width: 54px; height: 54px; display: grid; place-items: center;
  background: var(--sub-lt); border-radius: 10px; font-variant-numeric: tabular-nums; }
.continue-card h3 { margin: 2px 0 0; font-size: 17px; line-height: 1.5; }
.exam-setup { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 0 0 16px; }
.exam-setup h2 { font-size: 17px; margin: 0 0 4px; }
.exam-setup p { margin: 0 0 12px; font-size: 14.5px; color: var(--ink-2); }
.exam-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.exam-pick fieldset { border: 1px solid var(--line-2); border-radius: 9px; padding: 10px 14px 12px; margin: 0; min-width: 0; }
.exam-pick legend { font-size: 14px; font-weight: 700; color: var(--ink-2); padding: 0 4px; }
.exam-pick .hint { font-size: 14px; color: var(--ink-3); margin: 0 0 8px; }
.choice-row { display: flex; gap: 6px; flex-wrap: wrap; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 9px; padding: 0 14px; min-height: 42px;
  font-size: 15px; font-weight: 600; color: var(--ink-2); background: var(--card); white-space: nowrap; }
.choice span::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--sub); opacity: .85; }
.choice input:checked + span { border-color: var(--brand); color: var(--brand); background: var(--brand-lt); box-shadow: inset 0 0 0 1px var(--brand); }
.choice input:focus-visible + span { outline: 2px solid color-mix(in srgb, var(--brand) 60%, transparent); outline-offset: 2px; }
.exam-summary { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; font-size: 14.5px; color: var(--ink-2); margin: 0 0 16px; }
.exam-summary b { color: var(--ink); }
.exam-summary .subj { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.exam-summary .subj::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--sub); }
.exam-summary a { color: var(--brand); text-decoration: none; white-space: nowrap; }
.home-lists { margin-top: 30px; }
.mini-list { display: flex; flex-direction: column; }
.mini-list a { display: flex; flex-direction: column; gap: 1px; padding: 9px 0; border-top: 1px solid var(--line-2); text-decoration: none; color: var(--ink); }
.mini-list a:first-child { border-top: 0; }
.mini-list a span { font-weight: 600; font-size: 15px; line-height: 1.5; }
.mini-list a small { font-size: 13.5px; color: var(--ink-3); }

/* subject cards */
.subject-card { border-radius: var(--radius); color: var(--ink); text-decoration: none; padding: 16px 18px 14px; min-height: 160px;
  display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--sub); min-width: 0; }
.subject-card:hover { border-color: #b9c3ce; border-top-color: var(--sub); }
.subject-card .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.subject-card .vol, .book-head .vol, .subj-band .vol { font-size: 13px; font-weight: 700; color: var(--sub); letter-spacing: .06em; white-space: nowrap; }
.subject-card .tag-exam { font-size: 12.5px; font-weight: 600; color: var(--ink-3); border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; white-space: nowrap; }
.subject-card h3 { font-size: 20px; margin: 8px 0 2px; font-weight: 700; letter-spacing: .02em; }
.subject-card p { margin: 0 0 12px; font-size: 14px; color: var(--ink-3); }
.subject-card .progress { margin-top: auto; }
.subject-card .foot { font-size: 13.5px; color: var(--ink-3); margin-top: 8px; display: flex; justify-content: space-between; gap: 8px; white-space: nowrap; }
.subject-card.dim { opacity: .65; }
.subject-card.dim:hover { opacity: 1; }

/* books */
.book-section { margin-bottom: 34px; }
.book-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px 24px; flex-wrap: wrap; margin: 0 0 12px; }
.book-head h2 { display: inline; margin: 0 10px 0 6px; font-size: 20px; }
.book-prog { min-width: 220px; flex: 0 1 300px; font-size: 14px; color: var(--ink-3); }
.book-prog .progress { margin-top: 5px; }
.book-links { margin-top: 12px; }
.chap-row { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; align-items: center; text-decoration: none; color: var(--ink); }
.chap-row + .chap-row { border-top: 1px solid var(--line-2); }
.chap-row:hover { background: #f8f9fb; }
.chap-no { display: flex; align-items: center; justify-content: center; padding: 12px 4px; align-self: stretch; }
.chap-no small { font-size: 14px; font-weight: 700; color: var(--sub); white-space: nowrap; }
.chap-body { padding: 13px 12px 13px 2px; min-width: 0; }
.chap-body h3 { margin: 0 0 3px; font-size: 16px; color: var(--ink); line-height: 1.55; font-weight: 600; }
.chap-end { display: flex; align-items: center; padding: 0 18px; font-size: 14px; color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.chap-end.done { color: var(--good); font-weight: 700; }
.mk-count { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 600; }
.mk-count .ic { width: 14px; height: 14px; }

/* ---------------------------------------------------------------- reader */
.reader-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 272px; gap: 26px; align-items: start; }
.reader-main { min-width: 0; }
.reader-wrap.full { grid-template-columns: minmax(0, 1fr); }
.reader-wrap.full > .toc-panel { display: none; }
.chapter-meter { display: flex; align-items: center; gap: 12px; margin: -8px 0 16px; font-size: 14px; color: var(--ink-3); }
.chapter-meter .progress { flex: 0 1 260px; min-width: 120px; }
.reader-bar { position: sticky; top: var(--top-h); z-index: 15; display: flex; gap: 10px; align-items: center; justify-content: space-between;
  background: var(--bg); border-bottom: 1px solid var(--line); padding: 9px 0; margin-bottom: 14px; }
.reader-pos { flex: 1; min-width: 0; font-size: 14px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.toc-panel { position: sticky; top: calc(var(--top-h) + 16px); max-height: calc(100vh - var(--top-h) - 32px); overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 10px; font-size: 14px; overscroll-behavior: contain; }
.toc-panel h3 { font-size: 14px; letter-spacing: .04em; color: var(--ink-3); margin: 2px 8px 8px; font-weight: 700; }
.toc-list a, .toc-probs a { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: start; gap: 6px; text-decoration: none; color: var(--ink-2); padding: 6px 8px; border-radius: 7px; line-height: 1.5; font-size: 14px; }
.toc-list a .tk { width: 16px; height: 16px; margin-top: 3px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; color: transparent; }
.toc-list a .tk .ic { width: 11px; height: 11px; stroke-width: 3; }
.toc-list a.seen .tk { background: var(--good); border-color: var(--good); color: #fff; }
.toc-list a.l3 { padding-left: 24px; color: var(--ink-3); }
.toc-list a.l3 .tk { width: 13px; height: 13px; margin-top: 4px; }
.toc-list a:hover, .toc-probs a:hover { background: var(--line-2); color: var(--ink); }
.toc-list a.on { background: var(--brand-lt); color: var(--brand); font-weight: 700; }
.toc-list .tm { color: var(--accent); }
.toc-list .tm .ic { width: 14px; height: 14px; margin-top: 3px; }
.toc-list .far-tag { grid-column: 2 / -1; justify-self: start; font-size: 12.5px; font-weight: 700; color: var(--accent); background: var(--accent-lt); border-radius: 4px; padding: 0 6px; line-height: 1.6; }
.toc-sep { border-top: 1px solid var(--line); margin: 12px 4px; }
.toc-probs a { display: block; }
.toc-probs a b { color: var(--sub); margin-right: .3em; }
.drawer { position: fixed; inset: 0; z-index: 50; }
.drawer-back { position: absolute; inset: 0; background: rgba(15, 25, 40, .38); }
.drawer-panel { position: absolute; top: 0; bottom: 0; left: 0; width: min(380px, 88vw); background: var(--card); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px 12px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 17px; }
.drawer-body { overflow: auto; padding: 10px 10px calc(24px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
.drawer-body .toc-list a { font-size: 15px; padding: 8px 10px; }
.drawer-body h3 { font-size: 14px; letter-spacing: .04em; color: var(--ink-3); margin: 4px 10px 8px; font-weight: 700; }
.drawer-body .toc-probs a { font-size: 15px; padding: 8px 10px; }
.drawer-body .toc-list a.l3 { padding-left: 28px; font-size: 14.5px; }
.chapter-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 24px; }
.chapter-nav a { text-decoration: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; color: var(--ink); line-height: 1.55; min-width: 0; font-size: 15px; }
.chapter-nav a:hover { border-color: #b9c3ce; }
.chapter-nav small { display: block; color: var(--ink-3); font-size: 13.5px; }
.chapter-nav a.next { text-align: right; grid-column: 2; }
.after-read { margin-top: 24px; }
/* 節の終わりの「この節の演習」 */
.doc .sec-probs { margin: 1.8em 0 .6em; border: 1px solid var(--line); border-radius: 10px; background: #f7f9fb; padding: 12px 14px; font-family: var(--sans); font-size: 15px; letter-spacing: .01em; line-height: 1.6; }
.doc .sec-probs .sp-h { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--ink-2); font-size: 14px; margin-bottom: 6px; }
.doc .sec-probs .sp-h .ic { width: 17px; height: 17px; }
.doc .sec-probs .sp-list { display: flex; flex-direction: column; gap: 4px; }
.doc .sec-probs a { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; row-gap: 1px; padding: 8px 10px; border-radius: 8px; background: #fff; border: 1px solid var(--line-2); text-decoration: none; color: #1c2530; }
.doc .sec-probs a:hover { border-color: #b9c3ce; }
.doc .sec-probs a b { color: var(--c); white-space: nowrap; }
.doc .sec-probs a small { grid-column: 2; color: #5a6776; font-size: 13.5px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.doc .sec-probs .badge { font-size: 12.5px; }
/* 印のボタン（見出し・囲みの右端。文字と重ならないよう右側に余白をとる） */
.doc .has-mark-btn { position: relative; padding-right: 2.6rem !important; }
.doc .mark-btn { position: absolute; right: .2rem; top: 50%; transform: translateY(-50%); width: 2.1rem; height: 2.1rem; border-radius: 8px; border: 0; background: transparent; color: #9aa5b1; display: grid; place-items: center; cursor: pointer; padding: 0; }
.doc h2.has-mark-btn > .mark-btn { top: calc(50% - .2em); }
.doc .mark-btn .ic { width: 18px; height: 18px; stroke-width: 1.8; }
.doc .mark-btn:hover { background: rgba(0,0,0,.06); color: #5a6776; }
.doc .bx-h:not(.lt) > .mark-btn { color: rgba(255,255,255,.75); }
.doc .bx-h:not(.lt) > .mark-btn:hover { background: rgba(255,255,255,.16); color: #fff; }
.doc .mark-btn.on, .doc .bx-h > .mark-btn.on { color: var(--accent); }
.doc .mark-btn.on .ic { fill: currentColor; }
.doc .bx-h:not(.lt) > .mark-btn.on { color: #fff; }
.doc .bx-h:not(.lt) > .mark-btn.on .ic { fill: #fff; }
.doc .marked:is(h2, h3) { background: linear-gradient(90deg, var(--accent-lt), transparent 80%); }
.doc .bx.marked { box-shadow: 0 0 0 2px var(--accent); }

/* ---------------------------------------------------------------- 演習（タイマー） */
.q-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: -8px 0 14px; font-size: 14.5px; color: var(--ink-3); }
.q-meta a { color: var(--brand); font-weight: 600; text-decoration: none; }
.q-meta a:hover { text-decoration: underline; }
.timer-bar { position: sticky; top: calc(var(--top-h) + 8px); z-index: 14; display: grid; grid-template-columns: auto minmax(60px, 1fr) auto; align-items: center; gap: 10px 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px 10px 18px; margin: 0 0 16px; box-shadow: 0 4px 14px -8px rgba(20,35,55,.3); }
.tb-time { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.tb-dot { width: 9px; height: 9px; border-radius: 50%; background: #b8c1cb; align-self: center; flex: none; }
.tb-dot.on { background: #d0452e; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.timer { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); letter-spacing: .02em; line-height: 1.2; white-space: nowrap; }
.timer.over { color: var(--bad); }
.tb-sub { font-size: 14px; color: var(--ink-3); white-space: nowrap; }
.tb-meter { height: 6px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.tb-meter span { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 99px; transition: width .8s linear; }
.tb-meter span.over { background: var(--bad); }
.tb-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.timer-bar.done { background: var(--good-lt); border-color: #b4d8c3; }
.timer-bar.done .tb-sub { color: var(--good); font-weight: 700; white-space: normal; }
.timer-bar.done .tb-meter { display: none; }
.timer-bar.done { grid-template-columns: minmax(0, 1fr) auto; }
.q-card { margin-bottom: 16px; }
.check-prompt { font-size: 18px; font-family: var(--serif); line-height: 1.95; margin: 0; letter-spacing: .02em; }
.answer-card .ans-line { font-size: 17px; margin: 0 0 8px; }
.answer-card .ans-line b { display: inline-block; background: var(--brand); color: #fff; font-size: 14px; border-radius: 5px; padding: 0 8px; margin-right: 10px; vertical-align: .1em; }
.formula { overflow-x: auto; }
.split-label { display: flex; align-items: center; gap: 10px; font-size: 14px; letter-spacing: .06em; font-weight: 700; color: var(--ink-3); margin: 28px 0 12px; white-space: nowrap; }
.split-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.result-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; margin: 16px 0; }
.rc-time { display: flex; flex-direction: column; }
.rc-time small { font-size: 14px; color: var(--ink-3); }
.rc-time strong { font-size: 28px; line-height: 1.3; font-variant-numeric: tabular-nums; }
.rc-time span { font-size: 14px; font-weight: 600; }
.rate { display: flex; flex-direction: column; gap: 6px; }
.rate-l { font-size: 14px; color: var(--ink-3); }
.rate-seg button.on.ok { background: var(--good); color: #fff; }
.rate-seg button.on.pa { background: var(--warn); color: #fff; }
.rate-seg button.on.ng { background: var(--bad); color: #fff; }
.q-nav { display: flex; justify-content: space-between; gap: 8px; margin: 18px 0; }
.history { margin-top: 18px; }
.history-row { display: grid; grid-template-columns: 1fr auto 7em; gap: 12px; font-size: 14.5px; padding: 8px 0; border-bottom: 1px solid var(--line-2); font-variant-numeric: tabular-nums; }
.history-row:last-child { border-bottom: 0; }
.history-row .h-time { font-weight: 600; }
.history-row > span:last-child { text-align: right; font-weight: 600; }
.seg-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 12px; }
.seg-tabs button { border: 1px solid var(--line); background: var(--card); border-radius: 9px; padding: 0 14px; min-height: 40px; font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.seg-tabs button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.subj-jump { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0 0 12px; }
.subj-jump .sj-l { font-size: 14px; color: var(--ink-3); margin-right: 4px; }
.subj-jump a { text-decoration: none; font-size: 14.5px; font-weight: 700; border: 1px solid var(--line); border-radius: 99px; padding: 5px 14px; color: var(--ink-2); background: var(--card); }
.subj-jump a:hover { border-color: #b9c3ce; color: var(--ink); }
.subj-jump a.mine { border-color: var(--brand); color: var(--brand); background: var(--brand-lt); }

/* practice: 科目と章の区切り */
.subj-block { margin: 0 0 30px; }
.subj-band { display: flex; align-items: baseline; gap: 10px; padding: 10px 16px; border-radius: 10px; background: var(--sub-lt); border-left: 5px solid var(--sub); margin: 22px 0 6px; }
.subj-band h2 { margin: 0; font-size: 19px; color: var(--sub-dk); }
.subj-band .n { margin-left: auto; font-size: 14px; color: var(--ink-3); }
.chap-band { display: flex; justify-content: space-between; align-items: baseline; gap: 6px 12px; flex-wrap: wrap; margin: 18px 2px 8px; }
.chap-band h3 { margin: 0; font-size: 16px; color: var(--ink); }
.chap-band a { font-size: 14px; color: var(--brand); text-decoration: none; white-space: nowrap; }

/* past exams */
.exam-rules { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0 0 20px; }
.exam-rules .card { padding: 16px 18px; }
.exam-rules h3 { font-size: 16px; margin: 0 0 6px; }
.exam-rules p { margin: 0; font-size: 14.5px; color: var(--ink-2); }
.exam-rules .mine { color: var(--brand); font-weight: 700; }
.year-block { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; }
.year-head { display: flex; align-items: baseline; justify-content: space-between; gap: 4px 12px; flex-wrap: wrap; padding: 12px 18px; border-bottom: 1px solid var(--line-2); }
.year-head h2 { margin: 0; font-size: 18px; white-space: nowrap; }
.year-body { display: grid; grid-template-columns: 1fr 1fr; }
.exam-link { display: block; padding: 14px 18px 16px; color: var(--ink); min-width: 0; }
.exam-link + .exam-link { border-left: 1px solid var(--line-2); }
.exam-link h3 { margin: 0 0 4px; font-size: 16px; }
.exam-link .links { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

/* library */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.lib-card { display: flex; flex-direction: column; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px;
  text-decoration: none; color: var(--ink); border-left: 3px solid var(--sub); min-width: 0; }
.lib-card:hover { border-color: #b9c3ce; border-left-color: var(--sub); }
.lib-card h3 { margin: 0; font-size: 15.5px; line-height: 1.55; color: var(--ink); font-weight: 600; }
.parts { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.part-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 16px; text-decoration: none; color: var(--ink); font-size: 15.5px; }
.part-row + .part-row { border-top: 1px solid var(--line-2); }
.part-row:hover { background: #f8f9fb; }
.part-row .k { font-size: 13px; font-weight: 700; color: var(--sub); background: var(--sub-lt); border-radius: 5px; padding: 1px 8px; white-space: nowrap; }
.part-row .k.front, .part-row .k.back { color: var(--ink-2); background: var(--line-2); }
.part-row .pages { font-size: 14px; color: var(--ink-3); white-space: nowrap; }

/* review: 印 */
.mark-group { margin: 0 0 22px; }
.mark-group h3 { font-size: 15.5px; margin: 0 0 8px; color: var(--sub-dk); }
.mark-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 6px 10px 6px 16px; }
.mark-row + .mark-row { border-top: 1px solid var(--line-2); }
.mark-row a { display: flex; align-items: flex-start; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 15px; line-height: 1.55; padding: 6px 0; min-width: 0; }
.mark-row a .ic { color: var(--accent); fill: var(--accent); width: 16px; height: 16px; margin-top: 4px; }
.mark-row small { color: var(--ink-3); font-size: 13.5px; white-space: nowrap; }

/* progress page */
.heatmap { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; margin: 10px 0; }
.heatmap div { aspect-ratio: 1; border-radius: 3px; background: var(--line-2); }
.heatmap div.l1 { background: #c3d1e0; } .heatmap div.l2 { background: #7f9bbb; } .heatmap div.l3 { background: var(--brand); }
.subject-progress { margin: 14px 0; }
.subject-progress .meta { justify-content: space-between; margin-bottom: 5px; }
.subject-progress strong { color: var(--ink); }
.subject-progress .meta strong::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--sub); margin-right: 7px; }
main > .grid.two + .grid.two { margin-top: 10px; }

/* settings */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card h2 + .muted { margin-top: -4px; }
.switch-row { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line-2); gap: 10px; flex-wrap: wrap; }
.switch-row > span { min-width: 0; }
.date-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.date-row input[type=date] { min-width: 200px; }
.cd-preview { margin: 10px 0 0; font-size: 15px; color: var(--ink-2); }
.cd-preview b { color: var(--brand); }
.wipe { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.wipe-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 9px; cursor: pointer; }
.wipe-row:hover { border-color: var(--line); background: #fafbfc; }
.wipe-row input { width: 20px; height: 20px; margin: 3px 0 0; accent-color: var(--bad); flex: none; }
.wipe-row b { display: block; font-size: 15px; }
.wipe-row small { display: block; font-size: 14px; color: var(--ink-3); line-height: 1.6; }
.setup-sql { max-height: 240px; overflow: auto; font-size: 12.5px; background: var(--bg); padding: 10px; border-radius: 6px; white-space: pre-wrap; border: 1px solid var(--line-2); }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; flex: none; background: var(--card); }
.segmented button { border: 0; background: transparent; padding: 0 14px; min-height: 38px; font-size: 14px; white-space: nowrap; color: var(--ink-2); cursor: pointer; }
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button.on { background: var(--brand); color: #fff; }
.sync-state { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; margin: 0 0 6px; }
.sync-state.err { color: var(--bad); }
.sync-code { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; background: var(--bg); border: 1px solid var(--line-2); border-radius: 9px; padding: 12px 14px; margin: 12px 0; }
.sync-code small { display: block; font-size: 13.5px; color: var(--ink-3); }
.sync-code b { font-family: var(--ui-mono); font-size: 18px; letter-spacing: .06em; white-space: nowrap; }
.join-row { display: flex; gap: 8px; flex-wrap: wrap; }
.join-row input { flex: 1 1 200px; }
.qr-box { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; align-items: center; }
.qr-box .qr { width: 220px; height: 220px; display: block; background: #fff; padding: 8px; border-radius: 8px; border: 1px solid var(--line); }
.qr-box p { margin: 0 0 8px; font-size: 14.5px; color: var(--ink-2); }
.qr-box textarea { min-height: 72px; font-family: var(--ui-mono); font-size: 13px; word-break: break-all; }
.steps { margin: 0; padding-left: 1.3em; font-size: 14.5px; color: var(--ink-2); }
.steps li + li { margin-top: 4px; }
.guide p { margin: 0; font-size: 15px; color: var(--ink-2); line-height: 1.8; }

/* dialogs */
dialog { border: 1px solid var(--line); border-radius: 12px; padding: 0; width: min(720px, calc(100vw - 24px)); max-height: min(84vh, 760px); box-shadow: var(--shadow-lg); background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgba(15, 25, 40, .4); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px 12px 20px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; font-size: 17px; }
.dialog-head button { background: none; border: 1px solid var(--line); color: var(--ink-2); font-size: 14px; border-radius: 8px; padding: 0 12px; min-height: 36px; white-space: nowrap; cursor: pointer; }
.dialog-body { padding: 16px 20px 20px; overflow: auto; max-height: calc(min(84vh, 760px) - 62px); }
.search-body { padding: 14px 18px 18px; overflow: auto; max-height: calc(min(84vh, 760px) - 62px); }
.search-body input { width: 100%; font-size: 16px; padding: 10px 14px; }
.search-hit { display: block; padding: 10px 12px; border-radius: 8px; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line-2); }
.search-hit:hover, .search-hit.on { background: var(--brand-lt); }
.search-hit strong { display: block; font-size: 15px; }
.search-hit small { color: var(--ink-3); font-size: 13.5px; }
.search-hit .snip { display: block; font-size: 14px; color: var(--ink-2); margin-top: 2px; }
.search-hit mark { background: #fbe7b8; color: #1c2530; padding: 0 1px; }

dialog.confirm { width: min(440px, calc(100vw - 32px)); }
.confirm-body p { margin: 0 0 6px; font-size: 15.5px; line-height: 1.8; }
.confirm-body .button-row { justify-content: flex-end; }
.btn.danger-fill { background: var(--bad); border-color: var(--bad); color: #fff; }
#toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(16px); background: #1f2a37; color: #fff; padding: 11px 18px;
  border-radius: 10px; font-size: 14.5px; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; box-shadow: var(--shadow-lg);
  max-width: calc(100vw - 28px); text-align: center; width: max-content; }
#toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.loading { padding: 60px 0; text-align: center; color: var(--ink-3); }
.spinner { width: 26px; height: 26px; border: 2.5px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   教材の本文（.doc）
   教材の内容をアプリの画面に合わせて組み直したもの。囲み枠は種類ごとに統一し、
   見出しは枠の中に置く（枠線や本文と重ならない）。
   ========================================================================== */
.doc {
  --c: var(--doc-c, #1f4e79);
  --c-lt: color-mix(in srgb, var(--c) 10%, #fff);
  --c-ln: color-mix(in srgb, var(--c) 35%, #fff);
  --t: #1d232b; --t2: #4a5563;
  --ink: #1c2530; --ink-2: #445160; --ink-3: #5a6776; --line-in: #d8dee5;
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 32px 40px 44px;
  font-family: var(--serif); font-size: var(--fs); line-height: 1.95; color: var(--t); letter-spacing: .02em;
  overflow-wrap: anywhere; word-break: normal; line-break: strict; position: relative;
  font-feature-settings: "palt" 0; font-kerning: normal;
}
[data-subject="stat"] .doc { --doc-c: #1f4e79; }
[data-subject="info"] .doc { --doc-c: #0f6e6e; }
[data-subject="econ"] .doc { --doc-c: #9b2335; }
[data-subject="management"] .doc { --doc-c: #4a3a8c; }
[data-subject="past"] .doc { --doc-c: #1b3a5f; }
.doc.compact { padding: 22px 26px 26px; }
.doc > :first-child, .doc > .pg:first-child + * { margin-top: 0; }
.doc p { text-wrap-style: pretty; }
.doc p.p { margin: .55em 0; }
.doc p.c { text-align: center; }
.doc p.r { text-align: right; }
.doc p.ind { text-indent: 1em; }
.doc p.li { padding-left: calc(var(--b, 0em) + var(--h, 1.25em)); margin: .3em 0; }
.doc p.li > .lm { display: inline-block; width: var(--h, 1.25em); margin-left: calc(-1 * var(--h, 1.25em)); text-indent: 0; white-space: nowrap; vertical-align: baseline; }
.doc p.li > .lm > span[style*="color"]:only-child { font-size: .8em; }
.doc p.li + p.li { margin-top: .25em; }
.doc p.hg { padding-left: calc(var(--b, 0em) + var(--h)); text-indent: calc(-1 * var(--h)); }
.doc p.in { padding-left: var(--b); }
.doc .g { font-family: var(--sans); }
.doc .b { font-weight: 700; }
.doc .i { font-style: italic; }
.doc .tt { font-family: var(--mono); font-size: .92em; letter-spacing: 0; }
.doc .nw { white-space: nowrap; }
.doc .m { margin: 0 .12em; letter-spacing: 0; }
.doc .m .katex { font-size: 1.06em; }
.doc .m.m-wide { display: inline-block; max-width: 100%; margin: 0; overflow-x: auto; overflow-y: hidden; vertical-align: middle; padding: .1em 0; scrollbar-width: thin; }
.doc .katex { text-rendering: optimizeLegibility; }
.katex .cjk_fallback { font-family: var(--serif); }
.doc .m:not([data-done]), .doc .mx:not([data-done]) { white-space: normal; overflow-wrap: anywhere; }
.doc .nw:has(.m:not([data-done])) { white-space: normal; overflow-wrap: anywhere; }
.doc a { color: inherit; }
.doc a.qlink { color: var(--c); font-weight: 700; text-decoration: none; font-family: var(--sans); }
.doc a.qlink:hover { text-decoration: underline; }

/* 見出し */
.doc .hd { font-family: var(--sans); font-weight: 700; color: color-mix(in srgb, var(--c) 70%, #000); line-height: 1.5; letter-spacing: .01em;
  scroll-margin-top: calc(var(--top-h) + 72px); text-wrap-style: balance; }
.doc h2.hd { font-size: 1.32em; margin: 2.1em 0 .8em; padding-bottom: .35em; border-bottom: 2px solid var(--c-ln); }
.doc h3.hd { font-size: 1.12em; margin: 1.8em 0 .6em; padding-left: .65em; border-left: 3px solid var(--c); }
.doc h4.hd { font-size: 1.02em; margin: 1.4em 0 .4em; color: var(--c); }
.doc h2.hd .hn { display: inline-block; background: var(--c); color: #fff; font-size: .78em; line-height: 1.5; padding: .02em .5em; border-radius: 5px; font-variant-numeric: tabular-nums; margin-right: .55em; vertical-align: .12em; white-space: nowrap; }
.doc h3.hd .hn, .doc h4.hd .hn { color: var(--c); margin-right: .45em; font-variant-numeric: tabular-nums; }
.doc h2.hd.part-h { margin-top: 2.6em; }
/* 過去問・模擬試験の科目の区切り */
.doc h2.subj-h { margin: 2.6em 0 1em; padding: .55em .9em; border: 0; border-radius: 8px; background: var(--c); color: #fff; font-size: 1.16em; }
.doc h2.subj-h::before { content: "科目"; display: inline-block; font-size: .7em; font-weight: 700; letter-spacing: .08em; border: 1px solid rgba(255,255,255,.6); border-radius: 4px; padding: 0 .45em; line-height: 1.7; margin-right: .7em; vertical-align: .15em; }
.doc > h2.subj-h:first-of-type { margin-top: 0; }
.doc h2.subj-h > .mark-btn { color: rgba(255,255,255,.7); }
.doc h2.subj-h > .mark-btn:hover { background: rgba(255,255,255,.15); color: #fff; }
.doc h2.subj-h > .mark-btn.on, .doc h2.subj-h > .mark-btn.on .ic { color: #fff; fill: #fff; }
.doc h3.q-no { font-size: 1.04em; margin: 1.8em 0 .6em; padding: 0 0 .3em; border: 0; border-bottom: 1px solid var(--line); color: var(--t); }

/* 囲み枠 */
.doc .bx { margin: 1.4em 0; padding: .95em 1.15em; border-radius: 8px; background: var(--bf, transparent); position: relative; }
.doc .bx.k-frame { border: 1px solid var(--bc, #c3ccd6); }
.doc .bx.k-frame.lb { border-left: 4px solid var(--bl, var(--bc)); }
.doc .bx.k-side { border-left: 3px solid var(--bc, #c3ccd6); border-radius: 0 8px 8px 0; padding-left: 1.05em; }
.doc .bx.k-band { border-top: 2px solid var(--bc); border-bottom: 1px solid var(--bc); border-radius: 0; }
.doc .bx.k-fill { background: var(--bf, #f6f7f9); }
.doc .bx.k-plain { padding: 0; background: none; }
.doc .bx .bx { margin: 1em 0; }
.doc .bx-h { display: block; margin: -.95em -1.15em .85em; padding: .5em 1.15em;
  background: var(--th); color: #fff; font-family: var(--sans); font-weight: 700; font-size: .92em; line-height: 1.6; letter-spacing: .02em; border-radius: 7px 7px 0 0; }
.doc .bx-h.lt { color: var(--t); }
.doc .bx-h { text-wrap-style: balance; }
.doc p.fl { white-space: nowrap; overflow-x: auto; overflow-y: hidden; padding: .15em 0; scrollbar-width: thin; }
.doc .bx-h.lt [style*="color:#ffffff"], .doc .bx-h.lt [style*="color:#fff;"] { color: var(--t) !important; }
.doc .k-side > .bx-h { margin-left: -1.05em; border-radius: 0 7px 0 0; }
.doc .k-band > .bx-h { border-radius: 0; }
.doc .k-plain > .bx-h { margin: 0 0 .8em; border-radius: 7px; }
.doc .bx-h .bk { font-weight: 700; padding-right: .55em; margin-right: .1em; border-right: 1px solid currentColor; border-color: color-mix(in srgb, currentColor 45%, transparent); }
.doc .bx-h .fa { margin-right: .15em; margin-left: .25em; }
.doc .bx-h > .fa:first-child, .doc .bx-h > span:first-child > .fa { margin-left: 0; }
.doc .bx-h .mk.dk { margin: 0; }
.doc .bx-b > :first-child { margin-top: 0; }
.doc .bx-b > :last-child { margin-bottom: 0; }
.doc .cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.3em; }
.doc .col { min-width: 0; }
.doc .cols > .col + .col { border-left: 1px dashed var(--div, #ccc); padding-left: 1.2em; }

/* 小さな印（年度・難易度・種別） */
.doc .mk { text-indent: 0; padding: .04em .3em; border-radius: 4px; box-decoration-break: clone; -webkit-box-decoration-break: clone; line-height: 1.55; }
.doc .mk.dk, .doc .mk.rd { color: #fff; font-family: var(--sans); font-weight: 700; display: inline-block; white-space: nowrap; vertical-align: .1em; line-height: 1.5;
  font-size: .78em; letter-spacing: .02em; padding: .02em .45em; margin-inline-end: .35em; }
.doc .mk.dk *, .doc .mk.rd * { color: #fff !important; }
.doc .mk.circ { border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; width: 1.6em; height: 1.6em; padding: 0; line-height: 1; }
.doc p.li > .lm > .mk { margin-inline-end: 0; }
.doc .fa { display: inline-block; width: 1em; height: 1em; vertical-align: -.13em; background: currentColor; margin-right: .22em;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-position: center; mask-position: center; -webkit-mask-size: contain; mask-size: contain; }
.doc .tag { white-space: nowrap; }

/* 数式 */
.doc .dm { margin: .7em 0; overflow-x: auto; overflow-y: hidden; display: flex; align-items: center; justify-content: safe center; gap: 1em; padding: .3em 0; letter-spacing: 0; }
.doc .dm.l { justify-content: flex-start; }
.doc .dm .katex-display { margin: 0; }
.doc .dm .katex { font-size: 1.06em; }
.doc .dm > .mx, .doc .dm > .katex-display { flex-shrink: 0; }
.doc .dm .tag { margin-left: auto; font-family: var(--serif); white-space: nowrap; }
.doc .dm:not(.l):is(:has(> .tag), :has(> .eq-tags), :has(> .tags)) { display: grid; grid-template-columns: minmax(3em, 1fr) max-content minmax(3em, 1fr); column-gap: .7em; justify-content: stretch; }
.doc .dm:not(.l):is(:has(> .tag), :has(> .eq-tags), :has(> .tags)) > .mx:not(.eq-tags) { grid-column: 2; }
.doc .dm:not(.l) > :is(.tag, .eq-tags, .tags) { grid-column: 3; justify-self: end; margin-left: 0 !important; }
.doc .dm.boxed > .mx, .doc .m.boxed { border: 1px solid currentColor; padding: .35em .7em; }
.doc .m.boxed { padding: .05em .3em; }

/* 表 */
.doc .tbl { overflow-x: auto; margin: 1em 0 1.3em; }
.doc .tbl table { border-collapse: collapse; font-size: .94em; line-height: 1.7; letter-spacing: .01em; }
.doc .tbl td, .doc .tbl th { padding: .4em .65em; vertical-align: top; text-align: left; overflow-wrap: normal; word-break: normal; }
.doc .tbl table { min-width: 100%; width: auto; }
.doc .hl { padding: .05em .25em; border-radius: 3px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.doc .tbl th { color: #fff; font-family: var(--sans); font-weight: 700; }
.doc .tbl th * { color: #fff !important; }
.doc .tbl p.p { margin: 0; padding-left: 0 !important; text-indent: 0 !important; }
.doc .tbl .dm { margin: 0; }
.doc .tbl .katex { white-space: nowrap; }
.doc .tbl td[style*="center"] p.p, .doc .tbl th[style*="center"] p.p { text-align: center; }
.doc .tbl td[style*="right"] p.p { text-align: right; }
.doc .rt-tbl table { border-top: 1.5px solid #333; border-bottom: 1.5px solid #333; }
.doc .rt-tbl th { color: inherit; background: none; border-bottom: 1px solid #333; }
.doc .rt-tbl th * { color: inherit !important; }
.doc .rt-tbl tr.rt td { border-top: 1px solid #c9cfd6; }
.doc .rt-tbl .vl { border-right: 1px solid #333; }
.doc .exam-cover .rt-tbl table { border: 1px solid #333; }
.doc .exam-cover .rt-tbl th, .doc .exam-cover .rt-tbl td { border: 1px solid #333; }
.doc .election-tbl .election-boundary { border-right: 1px solid currentColor; }
.doc .qlist tr.rt td, .doc .qlist td { vertical-align: middle; }
.doc .qlist td:first-child { white-space: nowrap; width: 6.5em; }
.doc .checklist table { font-size: .94em; line-height: 1.6; }
.doc .checklist td { padding: .35em .45em; vertical-align: middle; }
.doc .checklist .cl-no { white-space: nowrap; width: 5.4em; }
.doc .checklist .cl-lv, .doc .checklist .cl-min, .doc .checklist .cl-p { white-space: nowrap; width: 1%; }
.doc .checklist .cl-box { display: none; }
.doc .tbl.legend table { font-size: .96em; }
.doc .tbl.legend td { border: 0; padding: .3em .5em; vertical-align: baseline; }
.doc .tbl.legend td.lg-b { width: 1%; white-space: nowrap; text-align: center; padding-left: 0; }
.doc .toc-document { margin: .4em 0 .8em; }
.doc .toc-row { display: flex; align-items: baseline; gap: .4em; padding: .28em 0; }
.doc .toc-t { min-width: 0; }
.doc .toc-lead { flex: 1 1 1.5em; min-width: 1.5em; border-bottom: 1.5px dotted currentColor; transform: translateY(-.28em); opacity: .6; }
.doc .toc-p { white-space: nowrap; font-variant-numeric: tabular-nums; min-width: 1.6em; text-align: right; }

/* 図 */
.doc .fig { margin: 1.4em auto; text-align: center; padding: 0 1.2em; }
.doc .fig-svg { width: 100%; height: auto; overflow: visible; }
.doc .fig-svg text { white-space: pre; letter-spacing: 0; }
.doc .fig-svg .jserif { font-family: var(--serif); }
.doc .fig-svg .jsans, .doc .fig-svg .lsans { font-family: var(--sans); }
.doc .fig-svg .lserif, .doc .fig-svg .mr { font-family: KaTeX_Main, var(--serif); }
.doc .fig-svg .mi { font-family: KaTeX_Math, serif; font-style: italic; }
.doc .fig-svg .mb { font-family: KaTeX_Math; font-weight: 700; font-style: italic; }
.doc .fig-svg .mono { font-family: var(--mono); }
.doc .fig-svg .fb { font-weight: 700; }
.doc .vec-fig { overflow-x: auto; margin: .9em auto; }
.doc .vec-fig > svg { display: block; width: 100%; height: auto; min-width: 480px; }
.doc .fig-img { display: block; margin: 0 auto; max-width: 100%; }

/* プログラム */
.doc .code-w { margin: 1.2em 0; }
.doc .code-w .code { margin-top: 0; border-top-left-radius: 0; }
.doc .code-t { display: inline-block; color: #fff; background: #555; font-family: var(--sans); font-weight: 700; font-size: .85em; padding: .15em .8em; border-radius: 5px 5px 0 0; }
.doc .code { position: relative; background: #f6f8fa; border: 1px solid #d9dee4; border-radius: 6px; margin: 1em 0; overflow-x: auto; letter-spacing: 0; }
.doc .code pre, .doc pre.code { margin: 0; padding: .8em 1em; font-family: var(--mono); font-size: .86em; line-height: 1.65; white-space: pre; }
.doc .code pre code, .doc pre.code code { font-family: inherit; font-size: inherit; }
.doc .code .ln { display: inline-block; width: 1.9em; margin-left: -.3em; margin-right: .8em; color: #6b7684; text-align: right; user-select: none; font-size: .85em; }
.doc .code-l { position: absolute; right: .7em; top: .35em; font-size: .78em; color: #596675; font-family: var(--sans); }

/* 過去問の冊子 */
.doc .bxl { display: inline-block; border: 1px solid #333; padding: 0 .4em; line-height: 1.55; margin-right: .3em; font-family: var(--sans); text-indent: 0; }
.doc .fbox { text-indent: 0; display: inline-block; border: 1px solid currentColor; padding: .05em .65em; font-family: var(--sans); font-weight: 700; line-height: 1.6; margin: .35em 0; }
.doc .exam-cover { border: 1px solid #c6ccd3; border-radius: 8px; padding: 1em 1.2em; margin: 1em 0; }
.doc details.exam-notes { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 1.2em; background: #fafbfc; }
.doc details.exam-notes > summary { font-family: var(--sans); font-weight: 700; font-size: .92em; padding: .7em 1em; color: var(--t2); }
.doc details.exam-notes[open] > summary { border-bottom: 1px solid var(--line); }
.doc .exam-notes-b { padding: .6em 1.2em 1em; }
.doc .err { color: #a02f25; }
.doc .pg { display: block; height: 0; position: relative; }
.doc .mark-anchor { scroll-margin-top: calc(var(--top-h) + 72px); }


/* ---------------------------------------------------------------- dark */
body.dark {
  --bg: #12171e; --card: #1a2129; --field: #151b22; --ink: #e3e8ee; --ink-2: #b6c1cc; --ink-3: #97a3af; --line: #2c3540; --line-2: #232b35;
  --brand-lt: #1f2b3a; --brand-ink: #a9c4e2; --good: #7fcda3; --good-lt: #183126; --warn: #e2b874; --warn-lt: #2f2717; --bad: #f09185; --bad-lt: #3a201d;
  --accent: #eaa065; --accent-lt: #3a2a1c;
  --shadow: none; color-scheme: dark;
}
body.dark [data-subject], body.dark { --sub-lt: #1f2732; }
body.dark [data-subject="stat"] { --sub: #8fb0d3; --sub-dk: #b9cfe6; }
body.dark [data-subject="info"] { --sub: #86c0b9; --sub-dk: #b3dbd6; }
body.dark [data-subject="econ"] { --sub: #d49aa2; --sub-dk: #ebc0c6; }
body.dark [data-subject="management"] { --sub: #b3a6d8; --sub-dk: #d0c7ea; }
body.dark [data-subject="past"] { --sub: #a8b5c4; --sub-dk: #cdd5de; }
body.dark main, body.dark .sidebar { --sub: #a9c4e2; }
body.dark .brand-mark { background: #2c4b70; }
body.dark .nav-link.active, body.dark .tabs a.active, body.dark .section-head a, body.dark .card-head a, body.dark .exam-summary a, body.dark .choice input:checked + span, body.dark .q-meta a, body.dark .chap-band a { color: var(--brand-ink); }
body.dark .tabs a.active { border-bottom-color: var(--brand-ink); }
body.dark .toc-list a.on { color: var(--brand-ink); }
body.dark .choice input:checked + span { border-color: var(--brand-ink); box-shadow: inset 0 0 0 1px var(--brand-ink); }
body.dark .btn.primary, body.dark .seg-tabs button.on, body.dark .segmented button.on, body.dark .badge.exam { background: #2c4b70; border-color: #3a5e88; color: #fff; }
body.dark .btn.primary:hover { background: #355a85; }
body.dark .btn:hover, body.dark .list-row:hover, body.dark .chap-row:hover, body.dark .part-row:hover, body.dark .wipe-row:hover { background: #202833; }
body.dark .hero { background: #1d3049; }
body.dark .hero .btn.primary { background: #e3e8ee; color: #1d3049; border-color: #e3e8ee; }
body.dark .badge.standard { color: var(--brand-ink); }
body.dark .info-box { border-left-color: var(--brand-ink); }
body.dark .read-progress { background: var(--brand-ink); }
body.dark .row-num, body.dark .continue-card .num { background: #1f2732; }
body.dark .countdown { color: var(--brand-ink); background: #1f2b3a; border-color: #34465c; }
body.dark .timer-bar.done { background: #183126; border-color: #2c5a43; }
body.dark .tb-meter span { background: var(--brand-ink); }
body.dark .subj-jump a.mine { color: var(--brand-ink); border-color: var(--brand-ink); background: #1f2b3a; }
body.dark .exam-rules .mine, body.dark .cd-preview b { color: var(--brand-ink); }
body.dark .search-hit mark { color: #1c2530; }
body.dark select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23b3bec9' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
body.dark #toast { background: #e3e8ee; color: #12171e; }
body.dark .heatmap div.l1 { background: #2d4560; } body.dark .heatmap div.l2 { background: #4f7398; } body.dark .heatmap div.l3 { background: #8fb0d3; }
body.dark .skip { color: var(--brand-ink); }
/* 教材の本文は紙の色のまま、まぶしさだけ抑える（教材の配色を保つため） */
body.dark .doc { --paper: #f2f0eb; border-color: var(--line); }
body.dark .doc details.exam-notes { background: #ebe8e2; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1140px) {
  .reader-wrap { grid-template-columns: minmax(0, 1fr); }
  .toc-panel { display: none; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 880px) {
  :root { --top-h: 54px; }
  .sidebar { display: none; }
  .shell { margin-left: 0; }
  .topbar { padding: 0 12px 0 14px; }
  main { padding: 18px 14px calc(96px + env(safe-area-inset-bottom)); }
  #toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  #mobile-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--card);
    border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  #mobile-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--ink-3); text-decoration: none; font-size: 12px; padding: 7px 2px 5px;
    border-radius: 8px; font-weight: 500; white-space: nowrap; }
  #mobile-nav a.active { color: var(--brand); font-weight: 700; background: none; }
  body.dark #mobile-nav a.active { color: var(--brand-ink); }
  #mobile-nav .ic { width: 22px; height: 22px; stroke-width: 1.7; }
  .grid.two, .settings-grid, .year-body, .exam-rules, .exam-pick { grid-template-columns: minmax(0, 1fr); }
  .exam-link + .exam-link { border-left: 0; border-top: 1px solid var(--line-2); }
  .page-head { flex-direction: column; align-items: stretch; margin-bottom: 16px; }
  .page-head h1 { font-size: 23px; }
  .hero { padding: 20px 18px; grid-template-columns: minmax(0, 1fr); }
  .hero h1 { font-size: 22px; }
  .hero-count { flex-direction: row; flex-wrap: wrap; justify-content: flex-start; align-items: baseline; gap: 4px 10px; padding: 10px 14px; min-width: 0; text-align: left; }
  .hero-count strong { font-size: 30px; }
  .doc { padding: 22px 18px 30px; border-radius: 0; margin: 0 -14px; border-left: 0; border-right: 0; line-height: 1.9; }
  .doc.compact { margin: 0 -14px; padding: 20px 18px 26px; border-radius: 0; }
  .doc .cols { grid-template-columns: minmax(0, 1fr); }
  /* 図は縮めすぎると図中の文字が読めないため、一定の幅を保って横にスクロールできるようにする */
  .doc .fig { overflow-x: auto; overflow-y: hidden; padding: 0 .4em; }
  .doc .fig > .fig-svg { min-width: min(calc(var(--fw, 430px) * .72), 560px); }
  /* 横にスクロールできる図・表・式は、端に影を付けて続きがあることを示す */
  .doc :is(.fig, .tbl, .dm, p.fl) {
    background:
      linear-gradient(to right, var(--paper) 30%, transparent) left / 24px 100% no-repeat local,
      linear-gradient(to left, var(--paper) 30%, transparent) right / 24px 100% no-repeat local,
      radial-gradient(farthest-side at 0 50%, rgba(0,0,0,.16), transparent) left / 10px 100% no-repeat scroll,
      radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.16), transparent) right / 10px 100% no-repeat scroll;
  }
  .doc .cols > .col + .col { border-left: 0; padding-left: 0; border-top: 1px dashed var(--div, #ccc); padding-top: .7em; }
  .doc .bx { padding: .85em .9em; }
  .doc .bx-h { margin: -.85em -.9em .75em; padding: .45em .9em; }
  .doc .k-side > .bx-h { margin-left: -1.05em; }
  .list-row { grid-template-columns: 44px minmax(0, 1fr); gap: 4px 12px; }
  .list-row .row-end { grid-column: 2; text-align: left; flex-direction: row; align-items: baseline; gap: 8px; }
  .chap-row { grid-template-columns: 64px minmax(0, 1fr); }
  .chap-end { display: none; }
  .continue-card { grid-template-columns: auto minmax(0, 1fr); }
  .continue-card > .btn { grid-column: 1 / -1; }
  .chapter-nav { grid-template-columns: minmax(0, 1fr); }
  .chapter-nav a.next { grid-column: 1; }
  .timer-bar { grid-template-columns: minmax(0, 1fr) auto; padding: 8px 10px 8px 14px; gap: 6px 10px; }
  .tb-time { flex-wrap: wrap; row-gap: 0; column-gap: 8px; }
  .tb-sub { flex-basis: 100%; padding-left: 17px; font-size: 13.5px; line-height: 1.4; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: -14px; margin-right: -14px; padding: 0 14px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tb-meter { grid-column: 1 / -1; order: 3; }
  .timer { font-size: 25px; }
  .tb-actions .btn { padding: 0 11px; }
  .metric strong { font-size: 22px; }
  .qr-box { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .qr-box > div:last-child { width: 100%; }
  .hide-sm { display: none; }
  .countdown .cd-long { display: none; }
  .countdown .cd-short { display: inline; }
  .countdown .ic { display: none; }
  .reader-pos { display: none; }
  .book-prog { flex-basis: 100%; }
  .history-row { grid-template-columns: 1fr auto 6em; }
}
@media (max-width: 420px) {
  .grid.four { gap: 10px; }
  .subject-card { min-height: 140px; padding: 14px 14px 12px; }
  .subject-card h3 { font-size: 18px; }
  .metric { padding: 12px 14px; }
  .btn { padding: 0 14px; }
  .top-actions { gap: 6px; }
  .icon-btn { padding: 0 10px; }
  .tb-actions .btn .ic { display: none; }
  .timer-bar.done .tb-actions .btn .ic { display: inline; }
}
@media print {
  .sidebar, .topbar, #mobile-nav, .reader-bar, .toc-panel, .chapter-nav, .after-read, .timer-bar, .mark-btn, .sec-probs { display: none !important; }
  .shell { margin: 0; } main { padding: 0; max-width: none; }
  .doc { border: 0; box-shadow: none; padding: 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
.doc .qlist .mk { margin-left: .55em; }
.doc .dm[style*="--b"] { padding-left: var(--b); }
