/* QAMPUS — 学習管理UI
 * スケール: 文字 12 / 13 / 14 / 15 / 17 / 22px、余白 4の倍数、角丸 6 / 8 / 10px
 */
:root {
  --bg: #FFFFFF;
  --bg-subtle: #F8F9FB;
  --bg-hover: #F2F4F7;
  --text: #20232A;
  --text-2: #4B505B;
  --muted: #717784;
  --line: #E6E8EC;
  --line-strong: #D5D9E0;
  --accent: #405DC7;
  --accent-hover: #3550B4;
  --accent-soft: #EEF1FB;
  --ok: #1F8A5B;
  --ok-soft: #EAF5EF;
  --ng: #C2413B;
  --ng-soft: #FBEEED;
  --warn: #8A5A00;
  --warn-soft: #FFF7E6;
  --warn-line: #F1DDB2;
  --r-sm: 6px;
  --r: 8px;
  --r-lg: 10px;
  --sidebar: 240px;
  --font: "Inter", "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  font-feature-settings: "palt" 0;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
sup, sub { font-size: .72em; line-height: 0; position: relative; vertical-align: baseline; }
sup { top: -.45em; }
sub { bottom: -.2em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#main:focus { outline: none; }
.muted { color: var(--muted); font-weight: 400; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--bg); padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r); }
.skip:focus { left: 8px; }
.noscript { padding: 24px; text-align: center; }
.ico { display: inline-flex; }
.ico svg { width: 18px; height: 18px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; flex: none; }

/* ---------- Loading / fatal ---------- */
.loading { min-height: 80vh; display: flex; gap: 10px; align-items: center; justify-content: center; color: var(--muted); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fatal { max-width: 560px; margin: 0 auto; padding: 48px 16px; display: grid; gap: 20px; justify-items: start; }

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; font-size: 15px; letter-spacing: .08em; }
.brand-mark {
  width: 24px; height: 24px; border-radius: var(--r-sm); background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 700; letter-spacing: 0;
}

/* ---------- Shell ---------- */
.shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 20;
  display: flex; flex-direction: column; gap: 4px;
  background: var(--bg-subtle); border-right: 1px solid var(--line);
  padding: 16px 12px; overflow-y: auto;
}
.sidebar > .brand { padding: 4px 8px 16px; }
.nav { display: grid; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 10px;
  border-radius: var(--r-sm); text-decoration: none; color: var(--text-2); font-weight: 500;
}
.nav-item .ico { color: var(--muted); }
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item[aria-current="page"] { background: #fff; color: var(--text); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; }
.nav-item[aria-current="page"] .ico { color: var(--accent); }
.nav-section { margin-top: 20px; }
.nav-heading { font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 10px 6px; }
/* カテゴリ（化学・生物学・オフィスアワー・英語など） */
.nav-cat { font-size: 11px; font-weight: 600; color: var(--muted); padding: 10px 10px 2px; letter-spacing: .02em; }
.nav-cat:first-child { padding-top: 0; }
.cat-list { display: grid; gap: 20px; }
.cat-head { display: flex; align-items: baseline; gap: 8px; margin: 0 0 8px; font-size: 14px; font-weight: 600; color: var(--text-2); }
.cat-head .muted { font-size: 12px; font-weight: 400; }
.data-table tbody tr.cat-row th { background: var(--bg-subtle); font-size: 12px; font-weight: 600; color: var(--text-2); padding-top: 8px; padding-bottom: 8px; }
.nav-course .dot { margin: 0 4px; }
.nav-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.side-note { margin-top: auto; padding: 12px 10px 0; font-size: 12px; color: var(--muted); line-height: 1.5; }

.main-col { margin-left: var(--sidebar); min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 10; height: 52px;
  display: flex; align-items: center; gap: 12px; padding: 0 32px;
  background: rgba(255, 255, 255, .97); border-bottom: 1px solid var(--line);
}
.brand-sm { display: none; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; flex-wrap: nowrap; min-width: 0; font-size: 13px; }
.crumbs li { display: flex; align-items: center; min-width: 0; white-space: nowrap; }
.crumbs li + li::before { content: "/"; color: var(--line-strong); margin: 0 8px; }
.crumbs a { color: var(--muted); text-decoration: none; padding: 4px 0; }
.crumbs a:hover { color: var(--text); text-decoration: underline; }
.crumbs [aria-current] { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }

.content { max-width: 1000px; padding: 28px 32px 64px; }

/* ---------- Page / section ---------- */
.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: 22px; font-weight: 700; line-height: 1.35; letter-spacing: -.005em; }
.page-head p { margin-top: 4px; font-size: 13px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.section { margin-top: 32px; }
.section-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 12px; }
.section-head h2 { font-size: 15px; font-weight: 600; }
.section-head .muted { font-size: 13px; }
.section-head.wrap { flex-wrap: wrap; align-items: center; justify-content: space-between; row-gap: 10px; }
.section-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.notice {
  display: grid; gap: 2px; margin-bottom: 20px; padding: 12px 14px;
  background: var(--warn-soft); border: 1px solid var(--warn-line); border-radius: var(--r);
  color: #5E4100; font-size: 13px;
}
.notice.is-error { background: var(--ng-soft); border-color: #F0CFCC; color: #7E2621; width: 100%; }
.notice summary { cursor: pointer; }
.notice ul { margin: 4px 0 0; padding-left: 18px; }
.notice-detail { opacity: .75; font-size: 12px; }

.empty { border: 1px dashed var(--line-strong); border-radius: var(--r-lg); padding: 28px 20px; text-align: center; display: grid; gap: 4px; }
.empty .muted { font-size: 13px; }

/* ---------- Metrics strip ---------- */
.metrics {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg);
}
.metrics-3 { grid-template-columns: repeat(3, 1fr); }
.metric { padding: 14px 16px; min-width: 0; }
.metric + .metric { border-left: 1px solid var(--line); }
.metric-label { font-size: 12px; color: var(--muted); }
.metric-value { font-size: 20px; font-weight: 600; line-height: 1.3; margin-top: 2px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.metric-sub { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 2px; }
.metric.is-ng .metric-value { color: var(--ng); }
.metric.is-ok .metric-value { color: var(--ok); }

/* ---------- Progress bar ---------- */
.bar { height: 4px; background: #ECEEF2; border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .3s ease; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 36px; padding: 0 14px; border-radius: var(--r);
  background: var(--bg); border: 1px solid var(--line-strong); color: var(--text);
  font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover:not(:disabled) { background: var(--bg-subtle); border-color: #C3C8D1; }
.btn:disabled { color: #A5AAB4; background: var(--bg-subtle); border-color: var(--line); cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn-lg { min-height: 44px; padding: 0 22px; font-size: 15px; font-weight: 600; }
.btn-count {
  min-width: 22px; padding: 0 6px; border-radius: 4px; font-size: 12px; font-weight: 600; line-height: 20px;
  background: var(--bg-hover); color: var(--text-2); font-variant-numeric: tabular-nums;
}
.btn-primary .btn-count { background: rgba(255, 255, 255, .18); color: #fff; }
.btn:disabled .btn-count { background: transparent; color: inherit; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none;
  border: 0; background: none; border-radius: var(--r-sm); color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }

/* ---------- Course cards ---------- */
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.course-card {
  display: flex; flex-direction: column; text-decoration: none;
  border: 1px solid var(--line); border-top: 3px solid var(--c); border-radius: var(--r-lg);
  padding: 14px 16px 16px; background: var(--bg);
  transition: border-color .12s, background .12s;
}
.course-card:hover { border-color: var(--line-strong); border-top-color: var(--c); background: var(--bg-subtle); }
.cc-head { display: flex; align-items: center; justify-content: space-between; }
.cc-subject { font-size: 12px; font-weight: 600; color: var(--c); }
.cc-go { color: var(--muted); }
.cc-title { font-size: 16px; font-weight: 600; line-height: 1.45; margin-top: 4px; }
.cc-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.cc-progress { margin-top: 20px; display: grid; gap: 8px; }
.cc-progress-row { display: flex; justify-content: space-between; font-size: 13px; font-variant-numeric: tabular-nums; }
.cc-progress-row strong { font-weight: 600; }

/* ---------- Unit table ---------- */
.table { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.table-head, .unit-row {
  display: grid; align-items: center; column-gap: 16px;
  grid-template-columns: 56px minmax(0, 1fr) 64px 168px 64px 20px;
  padding: 0 16px;
}
.table-head { height: 36px; background: var(--bg-subtle); border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 500; color: var(--muted); }
.table-body { list-style: none; margin: 0; padding: 0; }
.table-body li + li { border-top: 1px solid var(--line); }
.unit-row {
  width: 100%; min-height: 60px; padding-top: 10px; padding-bottom: 10px;
  border: 0; background: none; text-align: left; cursor: pointer;
}
.unit-row:hover { background: var(--bg-subtle); }
.col-no { font-size: 13px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.col-title { min-width: 0; }
.unit-title { display: block; font-size: 14px; font-weight: 600; }
.unit-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 3px; font-size: 12px; color: var(--muted); }
.col-count, .col-acc { font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.table-head .col-count, .table-head .col-acc { text-align: right; }
.col-progress { display: flex; align-items: center; gap: 10px; }
.col-progress .bar { flex: 1; }
.frac { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 40px; text-align: right; }
.col-go { color: var(--muted); display: inline-flex; justify-content: flex-end; }
.only-sm { display: none; }

.status {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 4px;
  font-size: 11.5px; font-weight: 500; background: var(--bg-hover); color: var(--muted); white-space: nowrap;
}
.status.is-progress { background: var(--accent-soft); color: var(--accent); }
.status.is-done { background: var(--ok-soft); color: var(--ok); }
.status.is-ng { background: var(--ng-soft); color: var(--ng); }
.badge { display: inline-flex; height: 20px; align-items: center; padding: 0 7px; border-radius: 4px; font-size: 11.5px; font-weight: 600; background: #FFF1E6; color: #A44A12; }

/* ---------- Review ---------- */
.table-wrap { border: 1px solid var(--line); border-radius: var(--r-lg); overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { padding: 12px 16px; text-align: left; border-top: 1px solid var(--line); vertical-align: middle; }
.data-table thead th { border-top: 0; background: var(--bg-subtle); font-size: 12px; font-weight: 500; color: var(--muted); padding-top: 9px; padding-bottom: 9px; }
.data-table tbody th { font-weight: 600; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table .num.is-ng { color: var(--ng); font-weight: 600; }
.data-table .act { text-align: right; width: 1%; }
.tlink { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.tlink:hover { text-decoration: underline; }
.cell-progress { display: flex; align-items: center; gap: 10px; min-width: 140px; }
.cell-progress .bar { flex: 1; }

.seg { display: inline-flex; padding: 2px; border-radius: var(--r); background: var(--bg-hover); }
.seg-btn {
  min-height: 28px; padding: 0 12px; border: 0; border-radius: var(--r-sm); background: none;
  font-size: 13px; color: var(--text-2); cursor: pointer;
  flex: none; white-space: nowrap; /* スマホで文字が縦に折り返さないように */
}
.seg-btn[aria-pressed="true"] { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 0 0 1px var(--line); }

.wrong-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.wrong-list li + li { border-top: 1px solid var(--line); }
.wrong-item { display: grid; gap: 4px; width: 100%; padding: 12px 16px; border: 0; background: none; text-align: left; cursor: pointer; }
.wrong-item:hover { background: var(--bg-subtle); }
.wi-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.wi-q { font-size: 14px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wi-foot { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); }
.wi-go { color: var(--accent); font-weight: 600; }

/* ---------- Practice menu (sheet / dialog) ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(20, 23, 30, .32);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: fade .12s ease;
}
.sheet {
  width: 100%; max-width: 440px; background: var(--bg); border-radius: var(--r-lg);
  border: 1px solid var(--line); box-shadow: 0 12px 32px rgba(20, 23, 30, .14);
  padding: 20px; max-height: 88vh; overflow-y: auto;
}
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.sheet-head h2 { font-size: 17px; font-weight: 600; line-height: 1.4; }
.sheet-head p { font-size: 13px; margin-top: 2px; }
.sheet-head .icon-btn { margin: -6px -8px 0 0; }
.menu { display: grid; gap: 6px; }
.menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); text-align: left; cursor: pointer;
}
.menu-item:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.menu-item:disabled { cursor: not-allowed; background: var(--bg-subtle); color: #A5AAB4; }
.menu-item.is-primary { border-color: var(--accent); }
.mi-text { flex: 1; min-width: 0; display: grid; }
.mi-label { font-weight: 600; font-size: 14px; }
.mi-desc { font-size: 12px; color: var(--muted); }
.menu-item:disabled .mi-desc { color: inherit; }
.mi-count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(16px); } }

/* ---------- Focus mode (quiz / result) ---------- */
html:has(.focus) { scroll-padding-top: 64px; scroll-padding-bottom: 80px; }
.focus { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.focus-inner { width: 100%; max-width: 720px; margin: 0 auto; padding: 0 24px; }
.focus-bar { position: sticky; top: 0; z-index: 10; background: rgba(255, 255, 255, .97); border-bottom: 1px solid var(--line); padding-top: var(--safe-t); }
.focus-bar .focus-inner { display: flex; align-items: center; gap: 12px; height: 52px; }
.focus-bar .icon-btn { margin-left: -8px; }
.focus-title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; font-size: 13px; white-space: nowrap; overflow: hidden; }
.ft-label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.ft-mode { color: var(--muted); }
.focus-count { font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.focus-count strong { font-weight: 600; }
.focus-progress { height: 2px; background: transparent; margin-bottom: -1px; }
.focus-progress span { display: block; height: 100%; background: var(--c, var(--accent)); transition: width .25s ease; }
.focus-main { flex: 1; padding: 28px 0 40px; }

.question { padding-bottom: 4px; }
.q-enter { animation: qin .16s ease-out; }
@keyframes qin { from { opacity: 0; transform: translateY(4px); } }
.q-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.q-meta > span:not(.badge) + span:not(.badge)::before { content: "·"; margin-right: 10px; color: var(--line-strong); }
.q-text { font-size: 17px; font-weight: 600; line-height: 1.75; word-break: break-word; white-space: pre-wrap; }

.choices { display: grid; grid-auto-rows: 1fr; gap: 8px; margin-top: 20px; }
.choice {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px; height: 100%;
  padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--bg); text-align: left; cursor: pointer; font-size: 15px; line-height: 1.6; word-break: break-word;
  transition: border-color .1s, background .1s;
}
.choice:hover:not(:disabled) { border-color: #AEB4C0; background: var(--bg-subtle); }
.ch-key {
  flex: none; width: 26px; height: 26px; border-radius: var(--r-sm); display: grid; place-items: center;
  border: 1px solid var(--line-strong); background: var(--bg); color: var(--text-2);
  font-size: 13px; font-weight: 600;
}
.ch-text { flex: 1; min-width: 0; }
.ch-mark { flex: none; font-size: 12px; font-weight: 600; }
.choice[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.choice[aria-checked="true"] .ch-key { background: var(--accent); border-color: var(--accent); color: #fff; }
.choice:disabled { cursor: default; }
.choice.is-correct { border-color: var(--ok); background: var(--ok-soft); box-shadow: inset 0 0 0 1px var(--ok); }
.choice.is-correct .ch-key { background: var(--ok); border-color: var(--ok); color: #fff; }
.choice.is-correct .ch-mark { color: var(--ok); }
.choice.is-wrong { border-color: var(--ng); background: var(--ng-soft); box-shadow: inset 0 0 0 1px var(--ng); }
.choice.is-wrong .ch-key { background: var(--ng); border-color: var(--ng); color: #fff; }
.choice.is-wrong .ch-mark { color: var(--ng); }
.choice.is-dim { color: var(--muted); }

.feedback { margin-top: 24px; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; animation: fade .16s ease; }
.fb-head { display: flex; align-items: center; gap: 8px; padding: 10px 16px; font-size: 15px; font-weight: 600; border-bottom: 1px solid var(--line); }
.fb-dot { width: 8px; height: 8px; border-radius: 50%; }
.feedback.is-ok .fb-head { background: var(--ok-soft); color: var(--ok); }
.feedback.is-ok .fb-dot { background: var(--ok); }
.feedback.is-ng .fb-head { background: var(--ng-soft); color: var(--ng); }
.feedback.is-ng .fb-dot { background: var(--ng); }
.fb-body { padding: 16px; display: grid; gap: 16px; }
.fb-answer { display: flex; align-items: flex-start; gap: 10px; font-weight: 600; font-size: 15px; }
.fb-label { flex: none; font-size: 12px; color: var(--muted); font-weight: 500; padding-top: 3px; }
.fb-key { flex: none; width: 24px; height: 24px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--ok); color: #fff; font-size: 12px; }
.fb-block h2 { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.fb-block p { font-size: 15px; line-height: 1.75; white-space: pre-wrap; word-break: break-word; }
.fb-warn { background: var(--warn-soft); border: 1px solid var(--warn-line); border-radius: var(--r); padding: 12px 14px; }
.fb-warn h2 { color: var(--warn); }
.fb-warn p { font-size: 14px; color: #5E4100; }
.fb-source p, .fb-source ul { font-size: 13px; color: var(--text-2); }
.fb-source ul { margin: 0; padding-left: 18px; }

.focus-foot {
  position: sticky; bottom: 0; z-index: 10; background: rgba(255, 255, 255, .97);
  border-top: 1px solid var(--line); padding-bottom: var(--safe-b);
}
.foot-inner { display: flex; align-items: center; justify-content: flex-end; gap: 16px; min-height: 68px; }
.kbd-hint { font-size: 12px; color: var(--muted); }

/* ---------- Result ---------- */
.result { display: grid; gap: 16px; }
.result h1 { font-size: 22px; font-weight: 700; }
.result .eyebrow { margin-bottom: -12px; }
.result-score { display: flex; align-items: baseline; gap: 2px; }
.rs-num { font-size: 40px; font-weight: 700; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.rs-unit { font-size: 18px; font-weight: 600; }
.rs-label { margin-left: 10px; font-size: 13px; color: var(--muted); }
.result .bar { height: 6px; }
.answer-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.answer-list li { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; font-size: 14px; }
.answer-list li + li { border-top: 1px solid var(--line); }
.answer-list .status { flex: none; min-width: 52px; justify-content: center; margin-top: 1px; }
.al-q { flex: 1; min-width: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.tabbar { display: none; }

/* ---------- Tablet / phone ---------- */
@media (max-width: 899px) {
  html { scroll-padding-top: 64px; scroll-padding-bottom: 88px; }
  body { font-size: 15px; }
  .sidebar { display: none; }
  .main-col { margin-left: 0; }
  .topbar { padding: 0 16px; padding-top: var(--safe-t); height: calc(52px + var(--safe-t)); }
  .brand-sm { display: inline-flex; }
  .crumbs { min-width: 0; overflow: hidden; }
  .content { padding: 20px 16px calc(88px + var(--safe-b)); }

  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    position: fixed; inset: auto 0 0 0; z-index: 30;
    background: rgba(255, 255, 255, .98); border-top: 1px solid var(--line);
    padding: 4px 8px var(--safe-b);
  }
  .tabbar .nav-item {
    flex-direction: column; justify-content: center; gap: 2px; min-height: 56px;
    font-size: 11px; font-weight: 500; color: var(--muted); border-radius: var(--r);
  }
  .tabbar .nav-item .ico svg { width: 22px; height: 22px; }
  .tabbar .nav-item[aria-current="page"] { background: none; box-shadow: none; color: var(--accent); font-weight: 600; }
  .tabbar .nav-item[aria-current="page"] .ico { color: var(--accent); }
  .tabbar .nav-item:hover { background: none; }

  .table-head { display: none; }
  .unit-row { grid-template-columns: 44px minmax(0, 1fr) 16px; column-gap: 12px; min-height: 72px; padding: 12px 14px; }
  .unit-row .col-count, .unit-row .col-acc { display: none; }
  .unit-row .col-progress { grid-column: 2 / 3; grid-row: 2; margin-top: 8px; }
  .unit-row .col-go { grid-column: 3; grid-row: 1 / span 2; }
  .unit-row .col-no { grid-row: 1 / span 2; align-self: start; padding-top: 1px; }
  .unit-title { font-size: 15px; }
  .only-sm { display: inline; }

  .btn { min-height: 44px; }
  .btn-sm { min-height: 36px; }
  .btn-row .btn { flex: 1 1 calc(50% - 4px); }
  .course-grid { grid-template-columns: 1fr; }
  .icon-btn { width: 44px; height: 44px; }
  .seg-btn { min-height: 34px; }

  .sheet-backdrop { align-items: flex-end; padding: 0; }
  .sheet { max-width: none; border-radius: 12px 12px 0 0; border-bottom: 0; padding: 16px 16px calc(16px + var(--safe-b)); animation: rise .18s ease-out; }
  .menu-item { min-height: 60px; }
}

@media (max-width: 599px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(3) { border-left: 0; }
  .metric:nth-child(n+3) { border-top: 1px solid var(--line); }
  .metrics-3 { grid-template-columns: repeat(3, 1fr); }
  .metrics-3 .metric:nth-child(3) { border-left: 1px solid var(--line); border-top: 0; }
  .metric { padding: 12px 14px; }
  .metric-value { font-size: 18px; }

  .focus-inner { padding: 0 16px; }
  .focus-main { padding: 20px 0 32px; }
  .q-text { font-size: 17px; }
  .choice { font-size: 16px; min-height: 60px; }
  .kbd-hint { display: none; }
  .foot-inner { min-height: 0; padding-top: 10px; padding-bottom: 10px; }
  .foot-inner .btn { flex: 1; min-height: 50px; }
  .result .btn-row .btn { flex: 1 1 100%; }

  /* 科目別テーブルは行ごとの縦積みに */
  .data-table thead { display: none; }
  .data-table tbody tr { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 10px 12px; padding: 14px; }
  .data-table tbody tr + tr { border-top: 1px solid var(--line); }
  .data-table tbody tr.cat-row { display: block; padding: 8px 14px; background: var(--bg-subtle); }
  .data-table tbody tr.cat-row th { padding: 0; background: none; }
  .data-table tbody th, .data-table tbody td { display: block; padding: 0; border: 0; text-align: left; }
  .data-table tbody th, .data-table .td-progress { grid-column: 1 / -1; }
  .data-table td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 400; color: var(--muted); margin-bottom: 2px; }
  .data-table .num { text-align: left; }
  .data-table .act { width: auto; }
  .data-table .cell-progress { min-width: 0; }
  .section-tools { width: 100%; }
  .section-tools .seg { flex: 1; overflow-x: auto; }
  /* 科目ボタンは1行まるごと使い、「まとめて再挑戦」はその下に（ボタンが画面外に隠れないように） */
  .section-tools { flex-wrap: wrap; }
  .section-tools .seg { flex: 1 1 100%; }
  .section-tools .seg-btn { flex: 1 0 auto; padding: 0 8px; }
  .section-tools > .btn { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- 原本演習 ---------- */
.menu-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.menu-list li + li { border-top: 1px solid var(--line); }
.menu-row {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 60px; padding: 10px 16px;
  border: 0; background: none; text-align: left; text-decoration: none; cursor: pointer;
}
.menu-row:hover { background: var(--bg-subtle); }
.mr-kind {
  flex: none; min-width: 40px; height: 22px; padding: 0 6px; border-radius: 4px; display: grid; place-items: center;
  font-size: 11.5px; font-weight: 600; background: var(--bg-hover); color: var(--text-2);
}
.menu-list li + li .mr-kind { background: var(--accent-soft); color: var(--accent); }
.mr-body { flex: 1; min-width: 0; display: grid; }
.mr-title { font-weight: 600; font-size: 14px; }
.mr-sub { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
#normal-practice:focus { outline: none; }

.focus-inner.wide { max-width: 1120px; }
.orig-note { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.paper-count { display: flex; flex-direction: column; align-items: flex-end; gap: 0 12px; font-size: 12.5px; line-height: 1.35; }
@media (min-width: 600px) { .paper-count { flex-direction: row; align-items: baseline; font-size: 13px; } }
.timer { color: var(--muted); font-variant-numeric: tabular-nums; }
.timer.is-over { color: var(--ng); }
.page-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 14px; scrollbar-width: thin; }
.page-tab {
  flex: none; display: grid; justify-items: center; min-width: 76px; padding: 6px 10px;
  border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--bg); cursor: pointer; font-size: 13px; font-weight: 600; line-height: 1.35;
}
.page-tab:hover { background: var(--bg-subtle); }
.page-tab[aria-current="page"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.pt-range { font-size: 11px; font-weight: 400; color: var(--muted); }

.paper { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.orig-img {
  position: relative; display: block; width: 100%; padding: 0; border: 1px solid var(--line); border-radius: var(--r);
  background: #fff; cursor: zoom-in; overflow: hidden;
}
.orig-img img { display: block; width: 100%; height: auto; }
.orig-img:hover { border-color: var(--line-strong); }
.zoom-hint {
  position: absolute; right: 8px; bottom: 8px; padding: 2px 8px; border-radius: 4px;
  background: rgba(32, 35, 42, .72); color: #fff; font-size: 11.5px;
}
.img-missing { border: 1px dashed var(--line-strong); border-radius: var(--r); padding: 32px 16px; text-align: center; color: var(--muted); font-size: 13px; }

.paper-panel { position: sticky; top: 68px; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; max-height: calc(100vh - 160px); overflow-y: auto; }
.panel-title { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.q-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.q-row { padding: 8px 0; }
.q-row + .q-row { border-top: 1px solid var(--line); }
.q-row-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.q-no { font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; min-width: 40px; }
.q-state { margin-left: auto; font-size: 12px; color: var(--muted); }
.q-state.is-done { color: var(--text-2); }
.badge-plain { background: var(--bg-hover); color: var(--text-2); font-weight: 500; }
.opt-group { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.opt {
  min-height: 40px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--bg);
  font-size: 15px; font-weight: 600; cursor: pointer; font-family: var(--font);
}
.opt:hover:not(:disabled) { border-color: #AEB4C0; background: var(--bg-subtle); }
.opt[aria-pressed="true"], .opt[aria-pressed="true"]:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: #fff; }
.opt:disabled { color: #B8BCC4; background: var(--bg-subtle); cursor: not-allowed; }
.paper-foot { justify-content: flex-end; }
.paper-foot .btn-primary { margin-left: 8px; }

.res-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.res-row { padding: 10px 16px; }
.res-row + .res-row { border-top: 1px solid var(--line); }
.res-main { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 13px; }
.res-ans { color: var(--muted); }
.res-ans strong { color: var(--text); font-weight: 600; margin-left: 2px; }
.res-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.res-note { margin-top: 4px; color: var(--text-2); font-size: 13px; }
.status.is-pending { background: var(--warn-soft); color: var(--warn); }

.check-row { grid-template-columns: 56px minmax(0, 1fr) 20px; text-decoration: none; }
.check-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.field { display: grid; gap: 6px; }
.field-head { display: flex; justify-content: space-between; align-items: baseline; }
.field-head label { font-size: 13px; font-weight: 600; }
.save-hint { font-size: 12px; color: var(--muted); }
.answer-area {
  width: 100%; min-height: 140px; padding: 10px 12px; resize: vertical;
  border: 1px solid var(--line-strong); border-radius: var(--r); font: inherit; font-size: 15px; line-height: 1.7; color: var(--text);
}
.answer-area:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.answer-slot { margin-top: 16px; }
.reveal-box { border: 1px dashed var(--line-strong); border-radius: var(--r-lg); padding: 16px; display: grid; gap: 10px; justify-items: start; font-size: 13px; }
.answer-panel { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; display: grid; gap: 12px; }
.answer-panel-head { display: flex; justify-content: space-between; align-items: center; }
.answer-panel-head h2 { font-size: 15px; font-weight: 600; }
.answer-panel-head h2:focus { outline: none; }
.self-eval { display: grid; gap: 6px; }
.self-label { font-size: 12px; color: var(--muted); }
.self-btn[aria-pressed="true"], .self-btn[aria-pressed="true"]:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: #fff; }

.viewer-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(20, 23, 30, .55); display: flex; }
.viewer { flex: 1; display: flex; flex-direction: column; background: #fff; margin: 16px; border-radius: var(--r-lg); overflow: hidden; }
.viewer-bar { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 16px; border-bottom: 1px solid var(--line); }
.viewer-title { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-zoom { min-width: 44px; text-align: center; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.viewer-body { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; background: var(--bg-subtle); }
.viewer-body img { display: block; max-width: none; height: auto; margin: 0 auto; }

@media (max-width: 899px) {
  .paper, .check-layout { grid-template-columns: 1fr; }
  .paper-panel { position: static; max-height: none; }
  .viewer { margin: 0; border-radius: 0; padding-top: var(--safe-t); }
  .opt { min-height: 44px; }
}
@media (max-width: 599px) {
  .paper-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .paper-foot .btn-primary { grid-column: 1 / -1; margin-left: 0; order: -1; }
  .paper-foot .btn { min-height: 44px; }
  .menu-row { padding: 12px 14px; }
}

/* ---------- 開始前の注意・化学四択・生物結果の補足 ---------- */
.notice-dialog { max-width: 480px; display: grid; gap: 14px; }
.notice-title { font-size: 17px; font-weight: 600; }
.notice-text { display: grid; gap: 8px; font-size: 14px; line-height: 1.75; color: var(--text-2); }
.notice-extra { font-size: 13px; color: var(--muted); }
.notice-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.q-figure { margin-bottom: 14px; }
.q-figure .orig-img { max-height: 360px; overflow: hidden; }
.q-figure .orig-img img { max-height: 360px; object-fit: contain; object-position: top center; }
.res-flag { color: var(--warn); font-weight: 500; }
.res-expl { color: var(--text-2); font-size: 13px; margin-top: 2px; }
.rationale { margin: 4px 0; font-size: 12.5px; }
.rationale summary { cursor: pointer; color: var(--accent); min-height: 28px; display: flex; align-items: center; }
.rationale ul { margin: 2px 0 4px; padding-left: 18px; color: var(--text-2); }
@media (max-width: 599px) {
  .notice-actions .btn { flex: 1 1 calc(50% - 4px); }
  .notice-actions .btn-primary { order: -1; flex-basis: 100%; }
}

/* ---------- トップバー：ロゴ＋学習メニュー ---------- */
.brand-top { display: none; }
.user-wrap { position: relative; margin-left: auto; flex: none; }
.user-btn {
  display: grid; place-items: center; width: 36px; height: 36px; padding: 0; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: 50%; background: var(--bg); color: var(--text-2);
}
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--bg-hover); color: var(--text); }
.user-btn .ico svg { width: 20px; height: 20px; }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; width: 240px; max-width: calc(100vw - 24px);
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 6px;
  box-shadow: 0 8px 24px rgba(20, 23, 30, .10);
}
.um-item {
  display: flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: var(--r-sm);
  text-decoration: none; color: var(--text); font-size: 14px; font-weight: 500;
}
.um-item:hover, .um-item:focus { background: var(--bg-hover); outline: none; }
.um-item:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.um-note { margin: 4px 0 0; padding: 8px 12px 4px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

/* ---------- 学習履歴の保存・復元 ---------- */
.backup-box { border: 1px solid var(--line); border-radius: var(--r-lg); }
.backup-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px; }
.backup-row + .backup-row { border-top: 1px solid var(--line); }
.backup-row h2 { font-size: 15px; font-weight: 600; }
.backup-row p { font-size: 13px; margin-top: 2px; max-width: 560px; }
.backup-row .btn { flex: none; }
.backup-status { margin: 0; padding: 0 16px; font-size: 13px; }
.backup-status:not(:empty) { padding: 12px 16px; border-top: 1px solid var(--line); }
.backup-status.is-error { color: var(--ng); }
.backup-status.is-ok { color: var(--ok); }

@media (max-width: 899px) {
  .topbar.is-home .crumbs { display: none; }
  .topbar.is-home .brand-top { display: inline-flex; }
  .user-btn { width: 44px; height: 44px; border-color: transparent; }
  .topbar .user-wrap { margin-right: -6px; }
}
@media (max-width: 599px) {
  .backup-row { flex-direction: column; align-items: stretch; }
}

/* ---------- ロゴ画像 ---------- */
.brand-logo { display: block; height: 30px; width: auto; }
.brand-mark-img { display: block; width: 28px; height: auto; }
.sidebar > .brand .brand-logo { height: 32px; }
.fatal .brand-logo { height: 30px; }

/* ---------- 学習状況（ダッシュボード） ---------- */
:root { --navy: #17204B; --navy-ink: #A9B8F2; --goal: #8EA6FF; }
.study2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 10px; margin-bottom: 16px; }

.goal { background: var(--navy); color: #fff; border-radius: var(--r-lg); padding: 14px 16px; display: grid; gap: 8px; }
.goal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.goal-title { font-size: 12.5px; font-weight: 600; color: var(--navy-ink); }
.goal-state { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: rgba(255, 255, 255, .1); color: var(--navy-ink); white-space: nowrap; }
.goal-state.is-done { background: var(--goal); color: var(--navy); }
.goal-count { display: flex; align-items: baseline; gap: 2px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.goal-count strong { font-size: 32px; font-weight: 700; letter-spacing: -.02em; }
.goal-count span { font-size: 14px; color: var(--navy-ink); font-weight: 500; }
.goal-bar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .14); overflow: hidden; }
.goal-bar span { display: block; height: 100%; border-radius: inherit; background: var(--goal); transition: width .4s ease; }
.goal-msg { font-size: 12.5px; color: #D5DCF6; }
.goal-cta {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 6px 10px 6px 14px;
  border: 0; border-radius: var(--r); background: #fff; color: var(--navy); text-decoration: none; text-align: left; cursor: pointer;
}
.goal-cta:hover { background: #EEF1FB; }
.goal-cta:focus-visible { outline: 2px solid var(--goal); outline-offset: 2px; }
.goal-cta-text { flex: 1; min-width: 0; display: grid; }
.goal-cta-label { font-size: 14px; font-weight: 700; }
.goal-cta-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.quick-stats { display: grid; grid-template-rows: repeat(3, 1fr); border: 1px solid var(--line); border-radius: var(--r-lg); }
.qs { display: grid; grid-template-columns: 1fr auto; align-items: baseline; column-gap: 8px; padding: 10px 14px; }
.qs + .qs { border-top: 1px solid var(--line); }
.qs-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.qs-value { grid-row: span 2; align-self: center; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.qs-value strong { font-size: 24px; font-weight: 700; color: var(--text); margin-right: 2px; letter-spacing: -.01em; }
.qs-sub { font-size: 11.5px; color: var(--muted); }
.metrics-sub .metric-value { font-size: 17px; }
#courses:focus { outline: none; }

@media (max-width: 599px) {
  .study2 { grid-template-columns: 1fr; gap: 8px; }
  .quick-stats { grid-template-rows: none; grid-template-columns: repeat(3, 1fr); }
  .qs { grid-template-columns: 1fr; padding: 8px 12px; row-gap: 0; }
  .qs + .qs { border-top: 0; border-left: 1px solid var(--line); }
  .qs-value { grid-row: auto; }
  .qs-value strong { font-size: 20px; }
  .qs-sub { display: none; }
  .metrics-sub .metric-value { font-size: 16px; }
}
.brand-text { display: inline-flex; align-items: center; gap: 10px; }

/* ---------- プライバシーポリシー ---------- */
.policy { max-width: 720px; display: grid; gap: 24px; }
.policy-sec { display: grid; gap: 8px; }
.policy-sec h2 { font-size: 15px; font-weight: 600; }
.policy-sec p { font-size: 14px; line-height: 1.85; color: var(--text-2); }
.policy a, .side-note a { color: var(--accent); }
.policy-date { font-size: 12.5px; }
.policy-lead { font-size: 14px; line-height: 1.85; color: var(--text-2); }
.terms-list { margin: 0; padding-left: 1.6em; display: grid; gap: 6px; font-size: 14px; line-height: 1.85; color: var(--text-2); }
.terms-list li { padding-left: 2px; }

/* ---------- 公式LINE案内 ---------- */
.line-banner {
  display: flex; align-items: center; gap: 14px; min-height: 76px; margin: 0 0 16px; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 20px; background: var(--bg-subtle);
  text-decoration: none; color: var(--text); transition: border-color .12s, background .12s;
}
.line-banner:hover { border-color: var(--line-strong); background: #F3F5F8; }
.line-banner:hover .lb-btn { background: #DDF4E6; }
.lb-mark { flex: none; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: #06C755; color: #fff; }
.lb-mark svg { width: 20px; height: 20px; }
.lb-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.lb-title { font-size: 14px; font-weight: 600; color: var(--text); }
.lb-desc { font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.lb-btn {
  flex: none; display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 99px;
  background: #E9F8EF; color: #05A447; border: 1px solid #C8EDD6; font-size: 13px; font-weight: 600; white-space: nowrap;
  transition: background .12s;
}
@media (max-width: 599px) {
  .line-banner { gap: 12px; padding: 12px 14px; border-radius: 18px; }
  .lb-mark { width: 32px; height: 32px; border-radius: 10px; }
  .lb-btn { padding: 0 12px; min-height: 34px; font-size: 12.5px; }
}
@media (max-width: 399px) {
  .line-banner { gap: 10px; padding: 11px 12px; }
  .lb-mark { width: 28px; height: 28px; border-radius: 9px; }
  .lb-mark svg { width: 16px; height: 16px; }
  .lb-title { font-size: 13.5px; }
  .lb-desc { font-size: 11.5px; line-height: 1.45; }
  .lb-btn { padding: 0 10px; min-height: 32px; font-size: 12px; }
}

/* パンくず：長いコース名は末尾だけを省略し、前の項目と重ならないようにする */
.crumbs { flex: 1 1 auto; min-width: 0; }
.crumbs li { flex: 0 2 auto; min-width: 0; }
.crumbs li:first-child { flex-shrink: 0; }
.crumbs li:last-child { flex-shrink: 1; }
.crumbs li > a, .crumbs li > [aria-current] { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs li:not(:first-child):not(:last-child) { min-width: 4.2em; }
.lb-phrase { display: inline-block; }
@media (max-width: 340px) { .lb-phrase { display: inline; } }

/* 公式LINE案内：A（単元一覧）・F（復習・記録） */
.section > .line-banner { margin-bottom: 0; }
.line-banner.lb-a { background: var(--bg); }
.line-banner.lb-a:hover { background: var(--bg-subtle); }
.line-banner.lb-f {
  background: linear-gradient(120deg, #E8F7EE 0%, #F2FAF5 45%, #FBFDFC 100%);
  border-color: #D9EEE1;
}
.line-banner.lb-f:hover { border-color: #C6E6D2; background: linear-gradient(120deg, #E1F4E9 0%, #EEF8F2 45%, #F8FCFA 100%); }
.line-banner.lb-f .lb-btn { background: #fff; border-color: #CDEBD8; color: #059A43; box-shadow: 0 1px 2px rgba(5, 120, 60, .08); }
.line-banner.lb-f:hover .lb-btn { background: #F7FCF9; }
/* スマホ：CTAをタイトル行の右に置き、説明文は下段を全幅で使う（窮屈にしない） */
@media (max-width: 399px) {
  .line-banner { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; column-gap: 10px; row-gap: 3px; align-items: center; }
  .lb-mark { grid-column: 1; grid-row: 1 / 3; align-self: center; }
  .lb-text { display: contents; }
  .lb-title { grid-column: 2; grid-row: 1; align-self: center; }
  .lb-btn { grid-column: 3; grid-row: 1; min-height: 28px; padding: 0 10px; font-size: 11.5px; }
  .lb-desc { grid-column: 2 / 4; grid-row: 2; }
}
@media (max-width: 340px) {
  .line-banner { grid-template-columns: 24px minmax(0, 1fr) auto; column-gap: 8px; padding: 11px 10px; }
  .lb-mark { width: 24px; height: 24px; border-radius: 8px; }
  .lb-mark svg { width: 14px; height: 14px; }
  .lb-title { font-size: 13px; white-space: nowrap; }
  .lb-btn { padding: 0 8px; font-size: 11px; }
  .lb-phrase { display: inline-block; }
}

/* F（復習・記録）：ミントのグラデーションカード */
.line-banner.lb-f {
  gap: 16px; min-height: 96px; padding: 16px 18px; border-radius: 20px;
  background: linear-gradient(105deg, #DCF3E4 0%, #E9F7EE 42%, #F6FBF8 100%);
  border: 1px solid #DCEFE3; box-shadow: 0 1px 3px rgba(20, 60, 35, .05);
}
.line-banner.lb-f:hover { background: linear-gradient(105deg, #D4F0DE 0%, #E3F5EA 42%, #F2FAF5 100%); border-color: #CDE8D7; }
.lb-f .lb-mark { width: 54px; height: 54px; border-radius: 15px; background: #06C755; box-shadow: 0 2px 6px rgba(6, 140, 70, .18); }
.lb-f .lb-mark svg { width: 47px; height: 47px; }
.lb-f .lb-title { font-size: 17px; font-weight: 700; letter-spacing: .01em; }
.lb-f .lb-desc { font-size: 13px; color: #5F6B73; }
.line-banner.lb-f .lb-btn {
  gap: 6px; min-height: 44px; padding: 0 14px 0 20px; border: 0; border-radius: 99px;
  background: #fff; color: #05A447; font-size: 14px; font-weight: 700;
  box-shadow: 0 2px 8px rgba(20, 60, 35, .10), 0 0 0 1px rgba(6, 160, 70, .06);
}
.line-banner.lb-f:hover .lb-btn { background: #fff; box-shadow: 0 3px 10px rgba(20, 60, 35, .14), 0 0 0 1px rgba(6, 160, 70, .10); }
.lb-f .lb-btn .ico svg { width: 16px; height: 16px; stroke-width: 2.4; }
@media (max-width: 599px) {
  .line-banner.lb-f {
    display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; column-gap: 12px; row-gap: 4px;
    align-items: center; min-height: 0; padding: 12px 14px; border-radius: 18px;
  }
  .lb-f .lb-text { display: contents; }
  .lb-f .lb-mark { grid-column: 1; grid-row: 1 / 3; align-self: center; width: 44px; height: 44px; border-radius: 12px; }
  .lb-f .lb-mark svg { width: 39px; height: 39px; }
  .lb-f .lb-title { grid-column: 2; grid-row: 1; align-self: center; font-size: 15.5px; white-space: nowrap; }
  .lb-f .lb-desc { grid-column: 2 / 4; grid-row: 2; font-size: 12.5px; line-height: 1.45; }
  .line-banner.lb-f .lb-btn { grid-column: 3; grid-row: 1; min-height: 34px; padding: 0 8px 0 13px; font-size: 12.5px; gap: 2px; }
  .lb-f .lb-btn .ico svg { width: 14px; height: 14px; }
}
@media (max-width: 399px) {
  .line-banner.lb-f { grid-template-columns: 38px minmax(0, 1fr) auto; column-gap: 10px; padding: 12px; }
  .lb-f .lb-mark { width: 38px; height: 38px; border-radius: 11px; }
  .lb-f .lb-mark svg { width: 34px; height: 34px; }
  .lb-f .lb-title { font-size: 14px; }
  .lb-f .lb-desc { font-size: 11.5px; }
  .line-banner.lb-f .lb-btn { min-height: 30px; padding: 0 5px 0 10px; font-size: 11px; }
  .lb-f .lb-btn .ico svg { width: 12px; height: 12px; }
}
@media (max-width: 340px) {
  .line-banner.lb-f { grid-template-columns: 32px minmax(0, 1fr) auto; column-gap: 8px; padding: 11px 10px; }
  .lb-f .lb-mark { width: 32px; height: 32px; border-radius: 9px; }
  .lb-f .lb-mark svg { width: 28px; height: 28px; }
  .lb-f .lb-title { font-size: 13px; }
  .line-banner.lb-f .lb-btn { padding: 0 4px 0 8px; font-size: 10.5px; }
}

/* ---------- ログイン・アカウント（ログイン機能がある環境だけで表示） ---------- */
.auth-page { max-width: 440px; }
.auth-card { display: grid; gap: 16px; padding: 20px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg); }
.auth-form { display: grid; gap: 14px; }
.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-links { display: grid; gap: 6px; font-size: 13px; color: var(--text-2); }
.auth-links a, .auth-terms a, .auth-alert a { color: var(--accent); }
.auth-note { margin-top: 16px; font-size: 12px; line-height: 1.7; color: var(--muted); }
.auth-terms { font-size: 12px; color: var(--muted); }
.auth-lead { font-size: 14px; line-height: 1.75; color: var(--text-2); overflow-wrap: anywhere; }
.auth-alert { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 16px; padding: 12px 14px; border-radius: var(--r); font-size: 13px; line-height: 1.7; border: 1px solid; overflow-wrap: anywhere; }
.auth-alert > span { flex: 1 1 220px; }
.auth-alert.is-error { background: var(--ng-soft); border-color: #F0CFCC; color: #7E2621; }
.auth-alert.is-ok { background: var(--ok-soft); border-color: #CBE6D7; color: #155C3D; }
.auth-alert.is-info { background: var(--accent-soft); border-color: #D6DDF5; color: #2B3F8C; }
.auth-confirm { display: grid; gap: 10px; margin-bottom: 16px; padding: 14px; border: 1px solid #D6DDF5; background: var(--accent-soft); border-radius: var(--r); font-size: 14px; }
.btn-block { width: 100%; }
.btn-google { width: 100%; gap: 10px; background: var(--bg); }
.g-mark { display: inline-flex; width: 18px; height: 18px; }
.g-mark svg { width: 100%; height: 100%; }
.spinner-sm { width: 14px; height: 14px; border-width: 2px; }
.btn-primary .spinner-sm { border-color: rgba(255, 255, 255, .45); border-top-color: #fff; }
.notice-btn { justify-self: start; margin-top: 6px; }
.loading-inline { display: flex; gap: 10px; align-items: center; color: var(--muted); padding: 24px 0; }

.field { display: grid; gap: 6px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text); }
.field-input {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--bg); color: var(--text); font: inherit; font-size: 16px; /* 16px 未満だと iOS が入力時に拡大する */
}
.field-input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.field-input[aria-invalid="true"] { border-color: var(--ng); }
.field-pw { position: relative; }
.field-pw .field-input { padding-right: 64px; }
.field-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%); min-height: 36px; min-width: 52px; padding: 0 10px;
  border: 0; border-radius: var(--r-sm); background: transparent; color: var(--accent); font-size: 13px; font-weight: 600; cursor: pointer;
}
.field-toggle:hover { background: var(--bg-hover); }
.field-hint { font-size: 12px; color: var(--muted); }
.field-error { font-size: 12px; color: var(--ng); }
.pw-rules { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0; padding: 0; list-style: none; }
.pw-rules li::before { content: "・"; }
.pw-rules li[data-ok="true"] { color: var(--ok); }
.pw-rules li[data-ok="true"]::before { content: "✓ "; }

.acct-badge { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.acct-badge.is-ok { background: var(--ok-soft); color: var(--ok); }
.acct-badge.is-warn { background: var(--warn-soft); color: var(--warn); }
.acct-email { overflow-wrap: anywhere; }
.acct-pw-row { padding-top: 0; }
.acct-pw { width: 100%; max-width: 360px; }
.acct-pw .btn { justify-self: start; }
.acct-check:empty { display: none; }

.user-btn.is-signed-in { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.um-account { display: grid; gap: 2px; padding: 8px 12px 10px; min-width: 0; }
.um-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.um-mail { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.um-warn { font-size: 12px; color: var(--warn); }
.um-btn { width: 100%; border: 0; background: transparent; text-align: left; cursor: pointer; }
.um-sep { height: 1px; margin: 4px 6px; background: var(--line); }

@media (max-width: 599px) {
  .auth-page { max-width: none; }
  .auth-card { padding: 16px; }
}
.btn-danger { background: var(--ng); border-color: var(--ng); color: #fff; justify-self: start; }
.btn-danger:hover:not(:disabled) { background: #A8352F; border-color: #A8352F; }
.btn-danger .spinner-sm { border-color: rgba(255, 255, 255, .45); border-top-color: #fff; }
.btn-danger-outline { color: var(--ng); border-color: #E7B9B6; }
.btn-danger-outline:hover:not(:disabled) { background: var(--ng-soft); border-color: var(--ng); }
.acct-delete { width: 100%; max-width: 440px; }
.acct-delete-list { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.7; color: var(--text-2); display: grid; gap: 2px; }
.acct-agree { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; cursor: pointer; }
.acct-agree input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--ng); }

/* ---------- 学習記録の同期（ログイン中・同期が使える環境だけ） ---------- */
.sync-chip {
  margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 99px; background: var(--bg); color: var(--text-2); font-size: 12px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.sync-chip:not([hidden]) + .user-wrap { margin-left: 8px; }
.sync-chip:hover { background: var(--bg-hover); }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.sync-chip.is-pending .sync-dot, .sync-chip.is-syncing .sync-dot { background: var(--accent); animation: sync-pulse 1.2s ease-in-out infinite; }
.sync-chip.is-offline, .sync-chip.is-error { border-color: var(--warn-line); background: var(--warn-soft); color: var(--warn); }
.sync-chip.is-offline .sync-dot, .sync-chip.is-error .sync-dot { background: var(--warn); }
.sync-chip.is-unverified .sync-dot { background: var(--muted); }
.sync-retry { font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
@keyframes sync-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .sync-chip .sync-dot { animation: none !important; } }
@media (max-width: 599px) {
  .sync-chip { min-height: 30px; padding: 0 8px; }
  .sync-chip.is-saved .sync-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}
.migrate-summary { font-weight: 600; color: var(--text); }
.migrate-notes { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); display: grid; gap: 2px; }
.migrate-status { font-size: 13px; color: var(--text-2); min-height: 1em; }
.migrate-status:empty { display: none; }
.migrate-status.is-error { color: var(--ng); }
.focus-bar .sync-chip { margin-left: auto; margin-right: 4px; }
.focus-bar .sync-chip:not([hidden]) + * { margin-left: 0; }

/* ---------- Phase 4〜6：ノート・マイライブラリ・招待・管理者 ---------- */
.badge-limited { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 99px; font-size: 11px; font-weight: 600; color: #7A4B00; background: #FFF1D6; border: 1px solid #F1D49A; white-space: nowrap; }
.nav-course .badge-limited { margin-left: auto; }
.cc-head .badge-limited { margin-right: auto; margin-left: 6px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn-ghost:hover:not(:disabled) { background: var(--accent-soft); border-color: transparent; }
.btn .ico svg { width: 16px; height: 16px; }

.notes-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin: 4px 0 16px; }
.note-filter { min-height: 36px; max-width: 100%; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--bg); font: inherit; font-size: 14px; color: var(--text); }
.notes-status { margin: -6px 0 12px; font-size: 13px; }
/* ノートブック（コースごとの表紙を並べる本棚）：上半分が淡いコース色の表紙、下半分が白 */
.nb-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.nb-cover {
  display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg);
  color: var(--text); text-decoration: none; overflow: hidden;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04); transition: border-color .15s, box-shadow .15s, transform .15s;
}
.nb-cover:hover { border-color: var(--line-strong); box-shadow: 0 4px 14px rgba(16, 24, 40, .07); transform: translateY(-1px); text-decoration: none; }
.nb-cover:hover * { text-decoration: none; }
.nb-front {
  display: flex; align-items: center; justify-content: center; height: 104px;
  background: var(--bg-subtle); background: color-mix(in srgb, var(--c, var(--accent)) 9%, #FFFFFF);
  border-bottom: 1px solid var(--line); border-bottom-color: color-mix(in srgb, var(--c, var(--accent)) 16%, #FFFFFF);
}
.nb-mark { font-size: 34px; font-weight: 800; line-height: 1; letter-spacing: .04em; color: var(--muted); color: color-mix(in srgb, var(--c, var(--accent)) 45%, #FFFFFF); }
.nb-info { flex: 1; display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; }
.nb-sub { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.nb-title { font-size: 15px; font-weight: 700; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.nb-meta { margin-top: auto; padding-top: 8px; display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.nb-meta strong { color: var(--text-2); font-size: 13px; }
.nb-all, .nb-back { font-size: 13.5px; font-weight: 600; color: var(--accent); text-decoration: none; }
.nb-all:hover, .nb-back:hover { text-decoration: underline; }
.nb-head h1 { padding-left: 12px; border-left: 4px solid var(--c, var(--accent)); }
.nb-group { display: grid; gap: 10px; margin-bottom: 22px; }
.nb-group-head { display: flex; align-items: baseline; gap: 10px; font-size: 14px; font-weight: 700; color: var(--text-2); padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.nb-group-head .muted { font-size: 12px; font-weight: 500; }
@media (max-width: 599px) {
  .nb-shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .nb-front { height: 84px; }
  .nb-mark { font-size: 26px; }
  .nb-info { padding: 10px 12px; }
  .nb-title { font-size: 14px; }
}
.note-list { display: grid; gap: 12px; }
.note-card { display: grid; gap: 8px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg); }
.note-target { display: grid; gap: 2px; font-size: 12.5px; color: var(--muted); }
.note-target-label { font-weight: 600; color: var(--text-2); }
.note-target-q { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-body { white-space: pre-wrap; word-break: break-word; font-size: 15px; line-height: 1.75; display: -webkit-box; -webkit-line-clamp: 8; -webkit-box-orient: vertical; overflow: hidden; }
.note-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; font-size: 12.5px; }
.note-actions { display: flex; gap: 6px; }
.note-editor { display: grid; gap: 10px; }
.note-ref { font-size: 12.5px; margin-top: 2px; }
.note-input { width: 100%; min-height: 180px; resize: vertical; padding: 12px; border: 1px solid var(--line-strong); border-radius: var(--r); font: inherit; font-size: 16px; line-height: 1.7; color: var(--text); background: var(--bg); }
.note-input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.note-editor-foot { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.note-count { font-size: 12px; }
.fb-notes { display: grid; gap: 8px; justify-items: start; }
.fb-note { justify-self: stretch; display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; padding: 10px 12px; border-radius: var(--r); background: var(--bg-subtle); border: 1px solid var(--line); }
.fb-note-body { white-space: pre-wrap; word-break: break-word; font-size: 14.5px; line-height: 1.7; }

.invite-box { padding: 16px; }
.invite-form { display: grid; gap: 8px; }
.invite-row { display: flex; gap: 8px; flex-wrap: wrap; }
.invite-input { flex: 1 1 200px; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .06em; text-transform: uppercase; }
.invite-code-show strong { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .06em; }

.admin-box { padding: 16px; display: grid; gap: 14px; }
/* スマホ：グリッドの中身（表・長いリンク）が枠を押し広げないように。表は枠の中で横にスクロール */
.admin-box, .enrollees, .invite-result { grid-template-columns: minmax(0, 1fr); }
.admin-box > *, .enrollees > *, .invite-result > *, .admin-form > * { min-width: 0; }
.invite-link { overflow-wrap: anywhere; word-break: break-all; }
.admin-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; align-items: end; }
.admin-field { display: grid; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.admin-wide { grid-column: span 2; }
.invite-result { padding: 12px 14px; border-radius: var(--r); background: var(--ok-soft); border: 1px solid #CDE6D8; display: grid; gap: 8px; }
.invite-code-big { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 20px; letter-spacing: .08em; }
.invite-link { font-size: 13px; word-break: break-all; color: var(--text-2); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th, .admin-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.admin-table th { font-size: 12px; color: var(--muted); font-weight: 600; }
.invite-state { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--bg-hover); color: var(--muted); }
.invite-state.is-active { background: var(--ok-soft); color: var(--ok); }
.invite-state.is-disabled, .invite-state.is-expired { background: var(--ng-soft); color: var(--ng); }
@media (max-width: 599px) {
  .admin-wide { grid-column: auto; }
  .notes-toolbar .btn { flex: 1 1 auto; }
  .note-filter { flex: 1 1 100%; }
}
.admin-sub { font-size: 14px; font-weight: 700; margin: 0; }
.enrollees { display: grid; gap: 8px; padding-top: 6px; border-top: 1px solid var(--line); }
.enrollees-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.admin-table td.enr-email { white-space: normal; word-break: break-all; min-width: 160px; }
.invite-reveal td { background: var(--ok-soft); white-space: normal; }
.invite-reveal-box { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.admin-actions { flex-wrap: nowrap; }

/* ---------- 学習補助（英語コースのみ：和訳・ヒント・解答後の詳しい解説） ----------
 * 色で役割を分ける：和訳＝コースの色、ヒント＝淡い黄色、詳しい解説＝グレー（注意事項は従来の黄色の枠）
 */
.aid-slot:empty { display: none; }
.aid-slot { margin: 10px 0 16px; display: grid; gap: 10px; justify-items: start; }
.aid-slot:not(:empty) + .choices { margin-top: 0; } /* 和訳の行があるときだけ詰める（空のときは通常の間隔） */
.aid-tr-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px 0 9px;
  border: 1px solid var(--line-strong); border-radius: 99px; background: var(--bg); color: var(--text-2);
  font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
}
.aid-tr-btn .ico svg { width: 16px; height: 16px; }
.aid-tr-btn:hover { background: var(--bg-hover); }
.aid-tr-btn[aria-expanded="true"] { border-color: transparent; color: var(--c, var(--accent)); background: var(--accent-soft); background: color-mix(in srgb, var(--c, var(--accent)) 10%, #fff); }
.aid-tr-q { justify-self: stretch; padding: 1px 0 1px 12px; border-left: 3px solid var(--c, var(--accent)); color: var(--text-2); font-size: 15px; line-height: 1.75; }
.aid-tr-q[hidden], .ch-ja[hidden], .aid-hint[hidden] { display: none; }
.ch-ja { display: block; margin-top: 3px; font-size: 13.5px; line-height: 1.55; color: var(--muted); font-weight: 400; }
.aid-hint { justify-self: stretch; margin-top: 4px; padding: 12px 14px; border: 1px solid var(--warn-line); border-radius: var(--r-lg); background: #FFFAEE; }
.aid-hint-h { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--warn); }
.aid-hint-h .ico svg { width: 16px; height: 16px; }
.aid-hint dl { margin: 8px 0 0; display: grid; gap: 8px; }
.aid-hint dt { font-size: 12px; font-weight: 600; color: var(--muted); }
.aid-hint dd { margin: 2px 0 0; font-size: 15px; line-height: 1.7; color: var(--text); }
.aid-hint dd b { font-weight: 700; }
.aid-hint dd small { margin-left: 6px; font-size: 13px; color: var(--muted); }
/* 操作行の「ヒント」（左）。「回答する」と同じ高さ・角丸。開いているときは黄色 */
.foot-left { display: flex; align-items: center; gap: 12px; margin-right: auto; min-width: 0; }
.foot-left.has-aid .kbd-hint { display: none; }
.aid-btn-hint {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px;
  border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--bg); color: var(--text-2);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.aid-btn-hint .ico svg { width: 17px; height: 17px; }
.aid-btn-hint:hover { background: var(--bg-hover); }
.aid-btn-hint[aria-expanded="true"] { background: #FFFAEE; border-color: var(--warn-line); color: var(--warn); }
@media (max-width: 599px) {
  .foot-left.has-aid { flex: none; }
  .aid-btn-hint { min-height: 50px; }
}
/* 解答後の「詳しい解説」：全幅の折りたたみ行（矢印が回る） */
.fb-more { margin: 0 -16px -16px; border-top: 1px solid var(--line); }
.aid-acc-btn {
  display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 48px; padding: 0 16px;
  border: 0; background: none; color: var(--text); font: inherit; font-size: 15px; font-weight: 600; text-align: left; cursor: pointer;
}
.aid-acc-btn:hover { background: var(--bg-subtle); }
.aid-acc-btn .ico, .aid-fig-btn > .ico { color: var(--muted); transition: transform .15s; }
.aid-acc-btn .ico svg, .aid-fig-btn > .ico svg { width: 18px; height: 18px; }
.aid-acc-btn[aria-expanded="true"] > .ico, .aid-fig-btn[aria-expanded="true"] > .ico { transform: rotate(180deg); }
.aid-more-panel[hidden] { display: none !important; }
.aid-more-body { display: grid; gap: 16px; padding: 4px 16px 16px; }
.aid-sec { display: grid; grid-template-columns: 22px 1fr; column-gap: 10px; row-gap: 2px; }
.aid-sec-n { grid-row: span 2; width: 22px; height: 22px; margin-top: 1px; border-radius: 6px; display: grid; place-items: center; font-size: 12px; font-weight: 700;
  color: var(--c, var(--accent)); background: var(--accent-soft); background: color-mix(in srgb, var(--c, var(--accent)) 10%, #fff); }
.aid-sec h2 { font-size: 12px; font-weight: 600; color: var(--muted); }
.aid-sec p { font-size: 15px; line-height: 1.75; }
.aid-ref { display: flex; align-items: flex-start; gap: 8px; padding: 9px 12px; border-radius: var(--r); background: var(--bg-subtle); font-size: 13px; line-height: 1.6; color: var(--text-2); }
.aid-ref .ico { flex: none; margin-top: 2px; color: var(--muted); }
.aid-ref .ico svg { width: 15px; height: 15px; }
.aid-fig { display: grid; gap: 10px; }
.aid-fig-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  background: var(--bg); color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.aid-fig-btn:hover { background: var(--bg-subtle); }
.aid-fig-btn > .ico { margin-left: auto; }
.aid-fig-th { flex: none; width: 44px; height: 32px; border-radius: 6px; display: grid; place-items: center;
  color: var(--c, var(--accent)); background: var(--accent-soft); background: color-mix(in srgb, var(--c, var(--accent)) 10%, #fff); }
.aid-fig-th .ico svg { width: 22px; height: 22px; }
.aid-fig-t { display: grid; gap: 1px; min-width: 0; }
.aid-fig-t1 { font-size: 14px; font-weight: 600; }
.aid-fig-t2 { font-size: 12px; color: var(--muted); line-height: 1.45; }
.aid-ai { display: flex; align-items: flex-start; gap: 5px; }
.aid-ai .ico { flex: none; margin-top: 3px; }
.aid-ai .ico svg { width: 13px; height: 13px; }
.fig { margin: 0; display: grid; gap: 6px; }
.fig-img { display: block; width: 100%; max-width: 560px; height: auto; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
.fig-list { display: grid; gap: 18px; }
.fig-card { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); }
.fig-card h2 { margin: 0; font-size: 15px; font-weight: 600; }
.aid-note { font-size: 12px; color: var(--muted); line-height: 1.6; }

/* ノート一覧：関連付けた問題の全文・選択肢・正解（開閉式） */
.note-q-wrap { display: grid; gap: 8px; justify-items: start; }
.note-q-btn { display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 99px; background: var(--bg); color: var(--text-2); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.note-q-btn:hover { background: var(--bg-hover); }
.note-q-btn .ico svg { width: 15px; height: 15px; transition: transform .15s; }
.note-q-btn[aria-expanded="true"] .ico svg { transform: rotate(180deg); }
.note-q { justify-self: stretch; display: grid; gap: 8px; padding: 12px 14px; border-radius: var(--r); background: var(--bg-subtle); border: 1px solid var(--line); }
.note-q[hidden] { display: none; }
.note-q-text { font-size: 14.5px; font-weight: 600; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.note-q-choices { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.note-q-choices li { display: flex; align-items: flex-start; gap: 8px; padding: 6px 8px; border-radius: var(--r-sm); font-size: 14px; line-height: 1.6; }
.note-q-choices li.is-correct { background: var(--ok-soft); color: #145C3D; font-weight: 600; }
.note-q-key { flex: none; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--bg); font-size: 12px; font-weight: 700; color: var(--text-2); }
.note-q-choices li.is-correct .note-q-key { background: var(--ok); border-color: var(--ok); color: #fff; }
.note-q-ch { flex: 1; min-width: 0; word-break: break-word; }
.note-q-mark { flex: none; font-size: 12px; font-weight: 700; color: var(--ok); }

/* ノート：会員向けの案内（ゲスト）・メール確認のお願い */
.notes-login.is-compact { display: grid; gap: 8px; }
.notes-login.is-compact .btn-row { margin-top: 2px; }
.notes-verify a { font-weight: 600; }

/* 利用状況（管理者） */
.an-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 8px; }
.an-tile { display: grid; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg); }
.an-tile-label { font-size: 12px; color: var(--muted); }
.an-tile-value { font-size: 22px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.an-tile-sub { font-size: 12px; color: var(--muted); }
.an-plot { position: relative; padding: 14px 12px 26px 12px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg); }
.an-ymax { position: absolute; top: 4px; left: 12px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.an-bars { display: flex; align-items: flex-end; gap: 2px; height: 140px; border-bottom: 1px solid var(--line); margin-top: 10px; }
.an-col { position: relative; flex: 1; height: 100%; display: flex; align-items: flex-end; cursor: default; outline: none; }
.an-bar { width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; opacity: .85; transition: opacity .1s; }
.an-col:hover .an-bar, .an-col:focus .an-bar { opacity: 1; }
.an-x { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 6px; font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.an-tip { display: none; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); padding: 4px 8px; border-radius: 6px; background: #172033; color: #FFFFFF; font-size: 12px; white-space: nowrap; pointer-events: none; z-index: 2; }
.an-col:hover .an-tip, .an-col:focus .an-tip { display: block; }
.an-col:first-child .an-tip { left: 0; transform: none; }
.an-col:last-child .an-tip { left: auto; right: 0; transform: none; }
.an-table td .badge-limited { margin-left: 6px; }
.an-hard-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.an-hard { display: flex; gap: 12px; justify-content: space-between; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); }
.an-hard-main { display: grid; gap: 3px; min-width: 0; }
.an-hard-where { font-size: 12px; color: var(--muted); }
.an-hard-q { font-size: 13.5px; color: var(--text-2); overflow-wrap: anywhere; }
.an-hard-num { display: grid; justify-items: end; flex: none; font-variant-numeric: tabular-nums; }
.an-hard-num strong { font-size: 17px; color: var(--text); }
.an-hard-num .muted { font-size: 11.5px; }
.an-foot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-top: 8px; font-size: 12.5px; }
@media (max-width: 599px) {
  /* コース別の表：スマホでは1行ずつカード状に（数値が横スクロールに隠れないように） */
  .an-table thead { display: none; }
  .an-table, .an-table tbody, .an-table tr, .an-table td { display: block; width: 100%; }
  .an-table tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .admin-table.an-table td { padding: 2px 14px 2px 0; border: 0; text-align: left; }
  .an-table td[data-label] { display: inline-block; width: auto; font-size: 13px; }
  .admin-table.an-table td:first-child { font-weight: 700; color: var(--text); padding-bottom: 4px; }
  .an-table td[data-label]::before { content: attr(data-label) '：'; color: var(--muted); }
  .an-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* フラッシュカード（限定コース・見るだけ） */
.fc-chapters { display: grid; gap: 8px; }
.fc-chapter { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg); color: var(--text); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.fc-chapter:hover { border-color: var(--line-strong); box-shadow: 0 2px 10px rgba(16, 24, 40, .05); text-decoration: none; }
.fc-chapter.is-mode { background: var(--bg-subtle); }
.fc-ch-id { min-width: 32px; height: 26px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; background: var(--accent-soft); color: var(--accent-hover); font-size: 12px; font-weight: 700; }
.fc-ch-title { font-weight: 600; overflow-wrap: anywhere; }
.fc-ch-count { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.fc-ch-go { color: var(--muted); display: inline-flex; }
.fc-page.focus-inner { max-width: 728px; display: grid; gap: 12px; }
.fc-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fc-count { font-size: 13px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.fc-kbd { font-size: 12px; }
.fc-nav.foot-inner { display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: center; gap: 10px; max-width: 728px; }
.fc-card { position: relative; display: grid; gap: 14px; min-height: 260px; padding: 24px 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .05); cursor: pointer; outline: none; align-content: start; }
.fc-card:focus-visible { box-shadow: 0 0 0 3px var(--accent-ring); }
.fc-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.fc-mode, .fc-from { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.fc-mode { background: var(--accent-soft); color: var(--accent-hover); }
.fc-kind { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #FFF7E8; color: #8A5300; border: 1px solid #F3DDB0; }
.fc-kinds { padding-bottom: 2px; }
.fc-from { background: var(--bg-subtle); color: var(--muted); border: 1px solid var(--line); }
.fc-text { font-size: 20px; font-weight: 700; line-height: 1.6; color: var(--text); overflow-wrap: anywhere; }
.fc-front .fc-text { padding: 18px 0 6px; text-align: center; }
.fc-pre { white-space: pre-line; }
.fc-hint { text-align: center; font-size: 12.5px; }
.fc-back { display: grid; gap: 12px; padding-top: 14px; border-top: 1px dashed var(--line-strong); cursor: auto; }
.fc-back[hidden] { display: none; }
.fc-back h3 { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .04em; margin-bottom: 4px; }
.fc-answer .fc-text { font-size: 18px; color: var(--accent-hover); }
.fc-extra .fc-ex-ja { color: var(--muted); }
.fc-extra p { font-size: 14px; line-height: 1.8; color: var(--text-2); overflow-wrap: anywhere; }
.fc-source { font-size: 12px; }
.fc-nav .btn { min-height: 46px; }
.fc-end { font-size: 13px; text-align: center; }
@media (max-width: 599px) {
  .fc-card { min-height: 220px; padding: 18px 16px; }
  .fc-text { font-size: 18px; }
  .fc-chapter { grid-template-columns: auto 1fr auto; padding: 12px 14px; }
  .fc-ch-go { display: none; }
}

/* ノートブックの中：案A 見出し・案C 単元チップ・案B 本文が主役のカード */
.nb-hero { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--bg-subtle); background: color-mix(in srgb, var(--c, var(--accent)) 7%, #FFFFFF); border-color: color-mix(in srgb, var(--c, var(--accent)) 16%, #FFFFFF); }
.nb-hero-mark { flex: none; width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 800;
  background: var(--accent-soft); background: color-mix(in srgb, var(--c, var(--accent)) 14%, #FFFFFF); color: var(--text-2); color: color-mix(in srgb, var(--c, var(--accent)) 70%, #000000); }
.nb-hero-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.nb-hero-title { font-size: 18px; font-weight: 700; line-height: 1.4; color: var(--text); overflow-wrap: anywhere; }
.nb-hero-meta { font-size: 12.5px; color: var(--muted); }
.nb-hero-add { flex: none; }
.nb-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; margin-bottom: 4px; scrollbar-width: none; }
.nb-chips::-webkit-scrollbar { display: none; }
.nb-chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 99px; background: var(--bg);
  font: inherit; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.nb-chip span { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.nb-chip:hover { background: var(--bg-hover); }
.nb-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }
.nb-chip[aria-pressed="true"] span { color: rgba(255, 255, 255, .8); }
.note-card.is-v2 { display: grid; gap: 10px; cursor: pointer; }
.note-card.is-v2:hover { border-color: var(--line-strong); }
.note-open { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; width: 100%; padding: 0; border: 0; background: none; text-align: left;
  font: inherit; font-size: 15.5px; line-height: 1.75; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; cursor: pointer; }
.note-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.note-ref { display: grid; gap: 6px; padding: 10px 12px; border-radius: 10px; background: var(--bg-subtle); border: 1px solid var(--line); cursor: auto; }
.note-ref-label { font-size: 11.5px; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.note-ref-q { font-size: 14px; line-height: 1.7; color: var(--text-2); overflow-wrap: anywhere; }
.note-ref .note-q-wrap { margin: 0; }
.note-ref .note-q-text { display: none; } /* 問題文は上に出しているので、開いたときは選択肢と正解だけ */
.note-card.is-v2 .note-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; }
.note-solve { padding: 6px 0; border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600; color: var(--accent); cursor: pointer; }
.note-solve:hover { text-decoration: underline; }
@media (max-width: 599px) {
  .nb-hero { flex-wrap: wrap; }
  .nb-hero-text { flex: 1 1 calc(100% - 70px); }
  .nb-hero-title { font-size: 16px; }
  .nb-hero-mark { width: 46px; height: 46px; font-size: 16px; }
  .nb-hero-add { flex: 1 1 100%; min-height: 42px; }
}

/* 限定コースのカード：鍵つきのバッジ・フラッシュカードの下の段（四択の進み具合と同じ位置） */
.badge-limited .ico { width: 11px; height: 11px; margin-right: 3px; }
.badge-limited .ico svg { width: 11px; height: 11px; stroke-width: 2.2; }
.cc-flash { margin-top: auto; padding-top: 16px; display: grid; gap: 8px; }
.cc-flash-kind { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.cc-flash-kind .ico svg { width: 15px; height: 15px; color: var(--c, var(--accent)); }
.cc-flash-modes { display: flex; flex-wrap: wrap; gap: 6px; }
.cc-flash-mode { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 99px; font-size: 12px; color: var(--text-2);
  background: var(--bg-subtle); background: color-mix(in srgb, var(--c, var(--accent)) 8%, #FFFFFF); border: 1px solid color-mix(in srgb, var(--c, var(--accent)) 18%, #FFFFFF); }
.cc-flash-mode b { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.course-card.is-flash { display: flex; flex-direction: column; }
