:root {
  --bg: #f7f7f5;
  --panel: #ffffff;
  --text: #1d1d1f;
  --muted: #6b6b70;
  --border: #e2e2de;
  --accent: #b5532d;
  --accent-text: #ffffff;
  --accent-soft: #f7ebe5;
  --ok: #2f7d4f;
  --ng: #b3261e;
  --code-bg: #f2f2ef;
  --out-bg: #1e1f22;
  --out-text: #e6e6e6;
  --sidebar-w: 280px;
  /* フォント: IBM Plex の日本語と等幅 (Google Fonts。読めないときは端末のフォント)。コードの中の日本語は Plex Sans JP
     IBM Plex Mono は同じ px でも Consolas などより大きく見えるので、コードは本文より 2〜3px 小さくする */
  --font-sans: "IBM Plex Sans JP", system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, "IBM Plex Sans JP", monospace;
  color-scheme: light;
}
/* サイトごとの色は site.txt の color: (サーバが --accent を上書きする)。無ければ上の既定の色 (Java の茶色) */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.7 var(--font-sans);
}
code, pre, .CodeMirror { font-family: var(--font-mono); }
button { font: inherit; cursor: pointer; }

header.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  background: var(--panel); border-bottom: 1px solid var(--border);
}
header.top h1 { font-size: 16px; margin: 0; white-space: nowrap; }
header.top h1 a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
header.top { box-shadow: inset 0 3px 0 var(--accent); }
/* サイトのアイコン (favicon.svg。サイトの色で返る) */
.brand-mark { width: 22px; height: 22px; background: url(/favicon.svg) center / contain no-repeat; flex-shrink: 0; }
body.portal .brand-mark { background-image: url(/favicon-portal.svg); }
.menu-btn svg { display: block; }
header.top .progress { color: var(--muted); font-size: 13px; margin-left: auto; white-space: nowrap; text-decoration: none; }
header.top .progress:hover { color: var(--accent); }
header.top .progress strong { color: var(--text); }
header.top .user { font-size: 13px; color: var(--muted); white-space: nowrap; }
header.top a.user { color: var(--text); font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--code-bg); }
header.top a.user:hover { text-decoration: none; background: var(--accent-soft); }
.account { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.account form { margin: 0; }
.btn.small { padding: 2px 10px; font-size: 13px; white-space: nowrap; }
a.link-btn { font-size: 13px; }
.notice { background: var(--panel); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font-size: 14px; }
.save-status { background: none; border: 0; padding: 0; font-size: 12px; color: var(--muted); white-space: nowrap; cursor: default; }
.save-status.saving { color: var(--muted); }
.save-status.error { color: var(--ng); cursor: pointer; text-decoration: underline; }
.menu-btn { display: none; background: none; border: 1px solid var(--border); border-radius: 6px; padding: 2px 10px; color: var(--text); }
.link-btn { background: none; border: none; color: var(--muted); font-size: 13px; padding: 0; text-decoration: underline; white-space: nowrap; }

.layout { display: flex; min-height: calc(100vh - 49px); }
nav.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  border-right: 1px solid var(--border); background: var(--panel);
  padding: 12px 0; overflow-y: auto;
  position: sticky; top: 49px; height: calc(100vh - 49px);
}
nav.sidebar ul { list-style: none; margin: 0; padding: 0; }
nav.sidebar a { display: flex; gap: 8px; align-items: baseline; color: var(--text); text-decoration: none; }
nav.sidebar a .frac, nav.sidebar .ch-toggle .frac { margin-left: auto; font-variant-numeric: tabular-nums; }
nav.sidebar .name { min-width: 0; }
/* まとまり: 上のメニュー / 練習問題 / 単語問題 / 模擬試験。間を線で区切る */
.nav-group { padding: 6px 0 10px; }
.nav-group + .nav-group { border-top: 1px solid var(--border); }
.nav-head {
  display: flex; align-items: center; gap: 8px; width: 100%;
  margin: 0; padding: 10px 16px 6px; background: none; border: 0;
  font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--muted); text-align: left;
}
button.nav-head:hover { color: var(--text); }
.nav-head .frac { margin-left: auto; letter-spacing: 0; font-weight: normal; }
/* 進捗・間違えた問題・ナレッジ */
.nav-item { padding: 7px 16px; font-size: 14px; font-weight: 600; }
nav.sidebar .nav-item.dim { color: var(--muted); font-weight: normal; }
/* 選択中・ホバー */
nav.sidebar a:hover { background: var(--code-bg); }
nav.sidebar a.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); color: var(--text); }
/* 章 (開け閉めする) と、その中の中分類 */
.ch-toggle { display: flex; gap: 8px; align-items: baseline; width: 100%; background: none; border: 0; color: var(--text); text-align: left; padding: 7px 16px 2px; font-size: 13.5px; font-weight: 600; }
.ch-toggle:hover .ch-title { color: var(--accent); }
.ch-toggle .ch-title { flex: 1; }
.chev { flex-shrink: 0; width: 7px; height: 7px; margin: 0 2px; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(-45deg); transition: transform .12s; }
[aria-expanded="true"] > .chev { transform: translateY(-4px) rotate(45deg); }
.nav-head .chev { margin-left: 4px; }
nav.sidebar .deck-list a { padding: 5px 16px 5px 37px; font-size: 13.5px; }
nav.sidebar .flat-list a { padding: 6px 16px; font-size: 13.5px; }
/* 続きから */
nav.sidebar .resume {
  display: grid; grid-template-columns: 1fr auto; gap: 0 8px; align-items: baseline;
  margin: 4px 12px 8px; padding: 8px 12px; border-radius: 8px;
  background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent);
}
nav.sidebar .resume:hover { background: var(--accent-soft); filter: brightness(.97); }
nav.sidebar .resume-label { grid-column: 1 / -1; font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--accent); }
nav.sidebar .resume-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-bar { display: flex; height: 3px; margin: 3px 16px 6px 35px; background: var(--border); border-radius: 2px; overflow: hidden; }
.mini-bar .ok, .bar .ok { background: var(--ok); }
.mini-bar .ng, .bar .ng { background: var(--ng); }
.frac { color: var(--muted); font-size: 12px; font-weight: normal; white-space: nowrap; }
.ok-text { color: var(--ok); }
.ng-text { color: var(--ng); }

main { flex: 1; min-width: 0; padding: 20px 24px 60px; max-width: 980px; }
main h2.title { margin: 0 0 12px; font-size: 22px; }
.empty { color: var(--muted); }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; }
.quiz .q { font-weight: 600; margin-bottom: 8px; }
.q-body { line-height: 1.8; margin: 4px 0 12px; }
.q-body p { margin: .4em 0; }
.q-body table { border-collapse: collapse; margin: .6em 0; }
.q-body th, .q-body td { border: 1px solid var(--border); padding: 4px 10px; text-align: center; }
.q-body th { background: var(--bg); }
.q-body code, .choice code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
/* 問題の図 (スキャンした白黒の画像) */
img.fig { display: block; max-width: 100%; height: auto; margin: 6px 0; background: #fff; }
.choice img.fig { margin: 0; }
.quiz .choices { display: grid; gap: 6px; }
.choice {
  display: flex; gap: 10px; align-items: baseline;
  text-align: left; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px;
}
.choice .key, .choice-list .key { font-weight: 700; color: var(--muted); }
.choice:hover:not(:disabled) { border-color: var(--accent); }
.choice:disabled { cursor: default; }
.choice.picked { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--accent); }
.choice.picked .key { color: var(--accent); }
.choice.correct { border-color: var(--ok); box-shadow: inset 4px 0 0 var(--ok); }
.choice.wrong { border-color: var(--ng); box-shadow: inset 4px 0 0 var(--ng); }
.quiz .submit { margin-top: 10px; }
.multi { color: var(--accent); font-size: 13px; }
.quiz .verdict { margin-top: 8px; font-weight: 600; }
.quiz .verdict.ok { color: var(--ok); }
.quiz .verdict.ng { color: var(--ng); }
.hint { color: var(--muted); font-size: 13px; }

.editor-wrap { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--panel); }
.editor-wrap textarea { width: 100%; min-height: 260px; border: 0; padding: 10px; background: var(--panel); color: var(--text); font: 13px/1.6 var(--font-mono); }
.CodeMirror { height: auto; min-height: 120px; font-size: 13px; line-height: 1.6; background: var(--panel); color: var(--text); }
.CodeMirror-scroll { min-height: 120px; }
.CodeMirror-gutters { background: var(--bg); border-right: 1px solid var(--border); }
.CodeMirror-linenumber { color: var(--muted); }
.CodeMirror-cursor { border-left-color: var(--text); }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.btn { border: 1px solid var(--border); background: var(--panel); color: var(--text); border-radius: 8px; padding: 6px 14px; transition: background .12s, border-color .12s; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.danger { background: var(--ng); border-color: var(--ng); color: #fff; font-weight: 600; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.on { border-color: var(--accent); color: var(--accent); }
.toolbar .kbd { color: var(--muted); font-size: 12px; }
.toolbar .spacer { flex: 1; }

.stdin textarea { width: 100%; min-height: 60px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text); padding: 8px; font: 12px/1.6 var(--font-mono); }

.output { background: var(--out-bg); color: var(--out-text); border-radius: 10px; overflow: hidden; margin-bottom: 14px; }
.output .status { font-size: 12px; padding: 6px 12px; border-bottom: 1px solid #2c2d31; color: #a6a6aa; }
.output .status.ok { color: #7fd6a2; }
.output .status.ng { color: #ff9a92; }
.output pre { margin: 0; padding: 10px 12px; min-height: 3em; max-height: 420px; overflow: auto; white-space: pre-wrap; word-break: break-all; font-size: 12.5px; }

.explain { line-height: 1.8; }
.explain h3 { font-size: 16px; margin: 1.2em 0 .4em; }
.explain h3:first-child { margin-top: 0; }
.explain code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.explain pre { background: var(--code-bg); padding: 10px 12px; border-radius: 8px; overflow-x: auto; }
.explain pre code { background: none; padding: 0; }
.explain table { border-collapse: collapse; margin: .6em 0; display: block; overflow-x: auto; }
.explain th, .explain td { border: 1px solid var(--border); padding: 4px 10px; text-align: left; }
.explain th { background: var(--bg); }
.explain .locked { color: var(--muted); }


/* 選択肢ごとの説明 */
.choice-wrap { display: grid; gap: 4px; }
.why { font-size: 13px; color: var(--muted); padding: 2px 12px 6px 34px; line-height: 1.6; }
.why.is-correct { color: var(--ok); }
.why.is-picked { color: var(--ng); background: var(--code-bg); border-radius: 6px; padding: 6px 12px 6px 34px; }
.why strong { font-weight: 700; margin-right: 4px; }
.why-text { font-size: 13px; color: var(--muted); margin: 2px 0 0 1.4em; }
.choice-list li.correct .why-text { color: var(--ok); }
.choice-list li.wrong .why-text { color: var(--ng); }

/* AI教師に聞く・ナレッジ */
.ask h3, .notes h3 { margin: 0 0 6px; font-size: 16px; }
.field { display: block; font-size: 13px; color: var(--muted); margin: 8px 0; }
.field input, .field textarea { display: block; width: 100%; margin-top: 4px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text); padding: 8px 10px; font: 14px/1.6 inherit; font-family: inherit; }
.ask-preview { white-space: pre-wrap; background: var(--code-bg); border-radius: 8px; padding: 10px 12px; font-size: 12px; max-height: 320px; overflow: auto; }
.note { border-top: 1px solid var(--border); padding: 10px 0; }
.note:first-of-type { border-top: 0; }
.note-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.note-title { font-weight: 600; }
.note-q { font-weight: 600; margin: 4px 0; }
.note-body { font-size: 14px; }
.note-form summary { cursor: pointer; color: var(--accent); font-weight: 600; margin-top: 8px; }
.note-preview:not(:empty) { border: 1px dashed var(--border); border-radius: 8px; padding: 8px 12px; margin-top: 8px; }
.note-index { padding-top: 6px; padding-bottom: 6px; }
.note-index-item { border-top: 1px solid var(--border); padding: 10px 0; }
.note-index-item:first-child { border-top: 0; }
.note-index-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.note-index ul { list-style: none; margin: 6px 0 0; padding: 0 0 0 12px; }
.note-index li { display: flex; align-items: baseline; gap: 10px; padding: 3px 0; }
.note-index li a { flex: 1; }
.crumb a { color: inherit; }
.search { flex: 1; min-width: 200px; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; background: var(--panel); color: var(--text); font: inherit; }
.explain ol, .explain ul { padding-left: 1.4em; }
.explain blockquote { margin: .6em 0; padding: 2px 12px; border-left: 3px solid var(--border); color: var(--muted); }
.explain hr { border: 0; border-top: 1px solid var(--border); margin: 1em 0; }
.explain .table-wrap { overflow-x: auto; }
.explain h4 { font-size: 14px; margin: 1em 0 .3em; }

/* 共通パーツ */
.crumb { margin: 0 0 4px; color: var(--muted); font-size: 13px; min-height: 1em; }
.crumb a { color: var(--muted); }
/* 出典 (過去問題の年度と問番号) は右端に小さく */
.crumb { display: flex; flex-wrap: wrap; gap: 2px 12px; }
.crumb .source { margin-left: auto; font-size: 12px; }
.badge { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; vertical-align: middle; border: 1px solid; }
.badge.ok { color: var(--ok); }
.badge.ng { color: var(--ng); }
a.btn { display: inline-block; text-decoration: none !important; }
a.btn:not(.primary) { color: var(--text); }
.banner { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--accent); border-radius: 10px; padding: 8px 12px; margin-bottom: 14px; }
.spacer { flex: 1; }
h3.section { font-size: 16px; margin: 28px 0 10px; }
h3.section small { color: var(--muted); font-weight: normal; font-size: 12px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.tile { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.tile .label { color: var(--muted); font-size: 13px; }
.tile .num { font-size: 30px; font-weight: 700; line-height: 1.1; }
.tile .num small, .tile .big small { font-size: 13px; font-weight: normal; color: var(--muted); }
.tile .big { font-size: 18px; font-weight: 700; }
.tile .bar { width: 100%; }
.bar { display: flex; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; min-width: 80px; flex: 1; }
table.list { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; font-size: 14px; }
table.list th, table.list td { padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
table.list th { color: var(--muted); font-weight: 600; font-size: 12px; background: none; }
table.list tr:last-child td { border-bottom: 0; }
.cell-bar { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.footnote { margin-top: 32px; color: var(--muted); font-size: 13px; }

/* 模擬試験 */
.exam-bar { position: sticky; top: 49px; z-index: 5; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 600; }
.timer.warn { color: var(--ng); }
.qgrid { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.qgrid button { width: 34px; height: 30px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); color: var(--muted); font-size: 12px; padding: 0; position: relative; }
.qgrid button.answered { background: var(--code-bg); color: var(--text); font-weight: 600; }
.qgrid button.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.qgrid button.marked::after { content: '★'; position: absolute; top: -7px; right: -4px; font-size: 10px; color: var(--accent); }
.code-view { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin: 8px 0 12px; }
.code-view .CodeMirror { min-height: 0; }
.code-view .CodeMirror-scroll { min-height: 0; }
.plain-code { margin: 0; padding: 10px; font-size: 12px; overflow-x: auto; }
.rq { padding: 0; }
.rq summary { padding: 10px 16px; cursor: pointer; display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.rq summary .hint { margin-left: auto; }
.rq[open] { padding-bottom: 14px; }
.rq > :not(summary) { margin-left: 16px; margin-right: 16px; }
.rq .q { font-weight: 600; margin-top: 4px; }
.choice-list { list-style: none; padding: 0; display: grid; gap: 4px; }
.choice-list li { padding: 4px 10px; border-radius: 6px; border: 1px solid transparent; }
.choice-list li.correct { border-color: var(--ok); }
.choice-list li.wrong { border-color: var(--ng); }

/* ログイン画面 */

@media (max-width: 760px) {
  .menu-btn { display: inline-block; }
  nav.sidebar { position: fixed; left: 0; top: 49px; z-index: 20; transform: translateX(-100%); transition: transform .15s; box-shadow: 2px 0 12px rgba(0,0,0,.15); }
  nav.sidebar.open { transform: none; }
  main { padding: 16px 16px 60px; }
  header.top { gap: 8px; }
  header.top h1 { font-size: 15px; }
  header.top .progress { font-size: 12px; }
  header.top .user.guest, .save-status.saved, .save-status.saving { display: none; }
  header.top h1 { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .toolbar .kbd { display: none; }
  header.top .progress { display: none; }
}

@media (max-width: 760px) {
  table.list { display: block; overflow-x: auto; white-space: nowrap; }
  .exam-bar { top: 49px; gap: 8px; }
}
.tile .bar { flex: none; height: 8px; width: 100%; }

/* ---- 使いやすさの改善: 答えたらすぐ次へ・使わない欄は畳む・目次を短く ---- */
/* 正誤と「次の問題」を横に並べる */
.verdict-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.verdict-row[hidden] { display: none; }
.verdict-row .verdict { margin-top: 0; flex: 1; min-width: 10em; }
.quiz-hint { margin-top: 6px; }
.quiz-hint .link-btn { margin-left: 4px; }

/* AI教師に聞く・ナレッジは、ボタンを押したときだけ開く */
.extras { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.extras .btn { font-size: 14px; }
.extras .count { color: var(--accent); font-size: 12px; font-weight: 600; }

/* 画面の下に「前へ・位置 (または次の問題名)・次へ」を固定する */
.step-bar {
  display: flex; align-items: center; gap: 12px;
  position: fixed; left: var(--sidebar-w); right: 0; bottom: 0; z-index: 15;
  /* 中身は main の幅 (980px) に揃える */
  padding: 10px max(24px, calc(100% - 956px)) calc(10px + env(safe-area-inset-bottom)) 24px;
  background: var(--panel); border-top: 1px solid var(--border);
}
.step-bar .step-pos { flex: 1; min-width: 0; text-align: center; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-bar .step-next { min-width: 9em; }
.step-bar .btn:disabled { visibility: hidden; }
main:has(.step-bar) { padding-bottom: 90px; }

/* 目次: 続きから */

/* 進捗ページ: 続きから */
.resume-card {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center;
  background: var(--panel); border: 1px solid var(--accent); border-radius: 10px;
  padding: 12px 16px; margin-bottom: 14px; color: var(--text); text-decoration: none;
}
.resume-card:hover { box-shadow: inset 4px 0 0 var(--accent); }
.resume-card .label { grid-column: 1; font-size: 12px; font-weight: 700; color: var(--accent); }
.resume-card .title { grid-column: 1; font-size: 17px; font-weight: 700; }
.resume-card .frac { grid-column: 1; }
.resume-card .go { grid-column: 2; grid-row: 1 / 4; background: var(--accent); color: var(--accent-text); font-weight: 600; border-radius: 8px; padding: 8px 14px; white-space: nowrap; }

@media (max-width: 760px) {
  .step-bar { left: 0; gap: 8px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); }
  .step-bar .btn { padding: 8px 14px; }
  .step-bar .wide { display: none; }
}

/* ---- 見た目の手直し (docs/design-review-2026-10.md) ---- */
/* リンクはサイトの色。下線はマウスを乗せたときだけ */
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
/* キーボードで操作しているときの枠 (マウスでは出ない) */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent) !important; box-shadow: 0 0 0 3px var(--accent-soft); }
.field select { display: block; margin-top: 4px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text); font: inherit; }
.card { border-radius: 12px; }

/* ゲストの案内 (閉じられる) */
.guest-notice { display: flex; align-items: flex-start; gap: 8px; }
.guest-notice span { flex: 1; }
.close-btn { background: none; border: 0; color: var(--muted); font-size: 18px; line-height: 1; padding: 0 4px; }
.close-btn:hover { color: var(--text); }

/* 空のとき */
.empty-box { background: var(--panel); border: 1px dashed var(--border); border-radius: 12px; padding: 16px 18px; color: var(--muted); margin: 0; }
.empty-box strong { color: var(--text); }
.empty-box ol { margin: 8px 0 0; padding-left: 1.4em; }

/* 行のリスト (進捗ページの章・単語問題・間違えた問題・模擬試験)。スマホでは折り返して縦に積む */
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: grid; grid-template-columns: minmax(0, 1fr) 180px 120px auto; gap: 4px 16px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 14px; }
.rows li:first-child { border-top: 0; }
.rows .row-main { min-width: 0; }
.rows .row-sub { color: var(--muted); font-size: 12px; }
.rows .row-bar { display: flex; align-items: center; gap: 8px; }
.rows .row-stat { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; }
.rows .row-act { display: flex; gap: 8px; align-items: center; justify-content: flex-end; white-space: nowrap; }
.rows .row-act .link-btn { font-size: 12px; }
.card-rows { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; }
.card-rows li { grid-template-columns: minmax(0, 1fr) auto auto; }
.card-rows li:has(.row-bar) { grid-template-columns: minmax(0, 1fr) 180px 120px auto; }
.wrong-rows li { grid-template-columns: minmax(0, 1fr) auto; }
.ng-link { color: var(--ng); }
.show-more { margin-top: 8px; font-size: 13px; }
.btn.small small { opacity: .85; font-size: 11px; }

/* 章のカード (押すと中分類が開く) */
.ch-cards { display: grid; gap: 8px; }
.ch-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.ch-card > summary { display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; list-style: none; font-weight: 600; }
.ch-card > summary::-webkit-details-marker { display: none; }
.ch-card > summary:hover { background: var(--code-bg); }
.ch-card .ch-name { flex: 1; min-width: 0; }
.ch-card .ch-meta { display: flex; align-items: center; gap: 8px; width: 240px; font-weight: normal; }
.ch-card[open] > summary { border-bottom: 1px solid var(--border); }
.ch-card[open] > summary .chev, .qgrid-wrap[open] > summary .chev { transform: translateY(-4px) rotate(45deg); }

/* 模擬試験: 問題一覧 (畳める) */
.qgrid-wrap { margin-bottom: 12px; }
.qgrid-wrap > summary { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; font-size: 14px; font-weight: 600; padding: 4px 0 8px; }
.qgrid-wrap > summary::-webkit-details-marker { display: none; }
.qgrid-wrap .qgrid { margin-bottom: 0; }
.start-card { margin-top: 12px; }

/* 模擬試験の結果: すべて / 不正解 / 未回答 / 正解 の切り替え */
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--code-bg); border-radius: 10px; margin-bottom: 12px; }
.seg button { border: 0; background: none; color: var(--muted); border-radius: 7px; padding: 5px 12px; font-size: 13px; }
.seg button[aria-selected="true"] { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg .n { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: normal; margin-left: 2px; }
.review-list[data-show="ok"] .rq:not(.is-ok), .review-list[data-show="ng"] .rq:not(.is-ng), .review-list[data-show="skip"] .rq:not(.is-skip) { display: none; }
.mark-ok { color: var(--ok); font-weight: 700; }
.mark-ng { color: var(--ng); font-weight: 700; }
.mark-skip { color: var(--muted); font-weight: 700; }

/* アカウント */
.facts-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 14px; font-size: 14px; }
.facts-list dt { color: var(--muted); }
.facts-list dd { margin: 0; }
.danger-zone { border-color: color-mix(in srgb, var(--ng) 40%, var(--border)); }

/* 問題の画面: 出典と「誤りを報告」 */
.crumb .source a { color: var(--muted); text-decoration: underline; }

/* サイドバーの一番下のリンク */
.side-footer { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 14px 16px 20px; border-top: 1px solid var(--border); font-size: 12px; }
nav.sidebar .side-footer a { display: inline; padding: 0; color: var(--muted); }
nav.sidebar .side-footer a:hover { background: none; color: var(--text); text-decoration: underline; }

/* このサイトについて・利用規約などのページ */
.doc-body header.top .back { margin-left: auto; }
main.doc { max-width: 760px; margin: 0 auto; padding: 28px 20px 40px; line-height: 1.85; }
main.doc h3 { font-size: 17px; margin: 2em 0 .5em; padding-top: 1em; border-top: 1px solid var(--border); }
main.doc .lead { font-size: 16px; }
main.doc ul, main.doc ol { padding-left: 1.4em; }
main.doc table { border-collapse: collapse; width: 100%; font-size: 14px; }
main.doc th, main.doc td { border-bottom: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
main.doc th { color: var(--muted); font-size: 12px; }
main.doc .table-wrap { overflow-x: auto; }
.contact-form { margin: 16px 0; }
.contact-form textarea { min-height: 160px; }
.contact-form .sent { font-size: 16px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
/* サイトにある機能によって出し分ける文面 (サーバが <html data-run data-vocab> を付ける) */
:root:not([data-run]) [data-if="run"], :root:not([data-vocab]) [data-if="vocab"] { display: none; }
.site-footer { border-top: 1px solid var(--border); padding: 20px 16px 28px; text-align: center; color: var(--muted); font-size: 12px; }
.site-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin-bottom: 6px; }
.site-footer a { color: var(--muted); }
.site-footer p { margin: 0; }

/* ログイン・新規登録 */
.auth-body { display: flex; flex-direction: column; min-height: 100vh; }
.auth { flex: 1; width: 100%; max-width: 400px; margin: 0 auto; padding: 12vh 16px 32px; }
.auth-brand { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-weight: 700; font-size: 17px; margin-bottom: 14px; }
.auth-brand:hover { text-decoration: none; }
.login.card { padding: 22px 22px 18px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.login h1 { font-size: 20px; margin: 0 0 14px; }
.login label { display: block; font-size: 14px; margin-bottom: 4px; }
.login input { display: block; margin-top: 4px; width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text); font: inherit; margin-bottom: 12px; }
.login .btn.primary { width: 100%; padding: 9px 14px; margin: 4px 0 6px; }
.login .error { color: var(--ng); font-size: 14px; background: color-mix(in srgb, var(--ng) 10%, transparent); padding: 6px 10px; border-radius: 6px; }
.auth-alt { text-align: center; margin-top: 14px; }

@media (max-width: 760px) {
  /* 行のリスト: 1 行目に名前、2 行目にバー・数・ボタン */
  .rows li, .card-rows li, .card-rows li:has(.row-bar) { grid-template-columns: minmax(0, 1fr) auto; padding: 10px 14px; }
  .rows .row-main { grid-column: 1 / -1; }
  .rows .row-bar { grid-column: 1; }
  .rows .row-stat { grid-column: 1; grid-row: 3; }
  .rows .row-act { grid-column: 2; grid-row: 2 / 4; }
  .card-rows li:not(:has(.row-bar)) .row-stat { grid-row: auto; }
  .card-rows li:not(:has(.row-bar)) .row-act { grid-row: 2; }
  .ch-card > summary { flex-wrap: wrap; padding: 12px 14px; }
  .ch-card .ch-meta { width: 100%; padding-left: 20px; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .tiles .tile:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .tile .num { font-size: 24px; }
  main.doc { padding: 20px 16px 32px; }
}
nav.sidebar a:hover, .resume-card:hover, .ch-card a.btn:hover, header.top h1 a:hover { text-decoration: none; }

/* 直前チェック */
.cheat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cheat-filter { display: block; width: 100%; box-sizing: border-box; margin: 4px 0 10px; }
.cheat-toc { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.cheat-toc .chip { border: 1px solid var(--border); background: var(--panel); color: var(--text); border-radius: 99px; padding: 3px 12px; font: inherit; font-size: 13px; }
.cheat-toc .chip:hover { border-color: var(--accent); color: var(--accent); }
.cheat-sec { scroll-margin-top: 70px; min-width: 0; }
.cheat-sec :not(pre) > code { overflow-wrap: anywhere; }
.cheat-sec > h2 { font-size: 18px; margin: 0 0 .6em; padding-bottom: .3em; border-bottom: 2px solid var(--accent); }
.cheat-sec [hidden], .cheat-toc [hidden] { display: none !important; }
@media print {
  header.top, #sidebar, .cheat-head .btn, .cheat-filter, .cheat-toc, .site-footer { display: none !important; }
  .cheat-sec { break-inside: auto; border: 0; padding: 0; }
  .cheat-sec > h2 { break-after: avoid; }
}

/* 広告 (参考書の紹介・AdSense)。「広告」と分かるように印を付ける */
.ad-box { margin-top: 28px; }
.ad-label { display: inline-block; font-size: 11px; font-weight: 600; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 6px; margin-left: 6px; vertical-align: middle; }
.ad-box > .ad-label { margin: 0 0 4px; }
/* AdSense が読み込まれていない (広告ブロッカーなど)・広告が無いときは、「広告」の印ごと隠す */
.ad-box:has(ins.adsbygoogle:not([data-adsbygoogle-status])), .ad-box:has(ins[data-ad-status="unfilled"]) { display: none; }
:root:not([data-adsense]) [data-if="adsense"], :root[data-adsense] [data-if="no-adsense"],
:root:not([data-affiliate]) [data-if="affiliate"], :root:not([data-adsense]):not([data-affiliate]) [data-if="adsense-or-affiliate"] { display: none; }
@media print { .ad-box { display: none !important; } }
/* ---- 単語帳 ---- */
.seg button.on { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg.small { margin-bottom: 0; }
.vocab-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 14px 0 6px; }
.vocab-action { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); color: var(--text); text-decoration: none !important; }
.vocab-action:hover { border-color: var(--accent); }
.vocab-action.primary { background: var(--accent-soft); border-color: transparent; box-shadow: inset 3px 0 0 var(--accent); }
.vocab-action .label { font-size: 13px; color: var(--muted); }
.vocab-action .num { font-size: 28px; font-weight: 700; line-height: 1.1; }
.vocab-action .num small { font-size: 13px; font-weight: normal; color: var(--muted); }
.vocab-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.vocab-head .seg { margin-bottom: 0; }
.vocab-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 0 8px; flex-wrap: wrap; }
.v-count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; margin: 6px 0 4px; }
.v-progress { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; margin-bottom: 12px; }
.v-progress span { display: block; height: 100%; background: var(--accent); transition: width .15s; }
.v-card {
  display: flex; flex-direction: column; justify-content: center; gap: 6px; width: 100%; min-height: 220px;
  padding: 28px 24px; text-align: center; color: var(--text); font: inherit;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.05); cursor: pointer;
}
.v-card:hover { border-color: var(--accent); }
.v-card hr { width: 48px; margin: 14px auto; border: 0; border-top: 2px solid var(--accent-soft); }
.v-term { font-size: 26px; font-weight: 700; line-height: 1.35; word-break: break-word; }
.v-sub { color: var(--muted); font-size: 14px; }
.v-meaning { font-size: 16px; line-height: 1.8; text-align: left; max-width: 36em; margin: 0 auto; }
.v-card .v-meaning { text-align: center; }
.v-meaning strong, .v-list-meaning strong { color: var(--accent); }
.v-tap { margin-top: 14px; }
.v-under { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0; }
.v-check { display: inline-flex; align-items: center; gap: 8px; }
.v-check.on { border-color: var(--ng); color: var(--ng); background: #fdf3f2; font-weight: 600; }
.v-check .box, .v-box { display: inline-block; flex: none; width: 18px; height: 18px; border: 1.5px solid var(--muted); border-radius: 5px; position: relative; background: var(--panel); }
.v-check.on .box, .v-box.on { border-color: var(--ng); background: var(--ng); }
.v-check.on .box::after, .v-box.on::after { content: ""; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.v-box { padding: 0; cursor: pointer; margin-top: 3px; }
.v-probs a { color: var(--accent); }
.vocab-step .v-keys { flex: 1; text-align: center; font-size: 12px; }
.vocab-list { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 8px; }
.vocab-list li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; }
.vocab-list li.is-ng { box-shadow: inset 3px 0 0 var(--ng); }
.v-list-term { font-weight: 700; margin-bottom: 2px; }
.v-list-meaning { font-size: 14px; line-height: 1.7; }
.vocab-start { max-width: 560px; }
.vocab-start select { width: 100%; }
.vocab-start .field > span { display: block; margin-bottom: 4px; }
.vocab-start .seg { margin-bottom: 4px; }
.btn.big { padding: 10px 28px; font-size: 15px; margin-top: 8px; }
.vt-q { text-align: center; padding: 22px 20px; }
.vt-q .hint { margin-bottom: 10px; }
.vt-choices { display: grid; gap: 8px; }
.vt-choices .choice { padding: 10px 14px; line-height: 1.6; }
.vocab-end { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0; }
@media (max-width: 760px) {
  .v-card { min-height: 200px; padding: 22px 16px; }
  .v-term { font-size: 22px; }
  .vocab-step .v-keys { visibility: hidden; }
}

/* 使い方 */
.guide-sec { scroll-margin-top: 70px; }
.guide-sec > h2 { font-size: 18px; margin: 0 0 .6em; padding-bottom: .3em; border-bottom: 2px solid var(--accent); }

/* 試験 (サイト) の切り替え: サイドバーの一番上 */
.site-switch { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 12px; margin-bottom: 10px; border-bottom: 1px solid var(--border); }
.site-chip { font-size: 12.5px; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--border); color: var(--muted); text-decoration: none; background: var(--panel); }
.site-chip:hover { color: var(--text); border-color: var(--text); }
.site-chip.current { color: var(--accent-text, #fff); background: var(--accent); border-color: var(--accent); font-weight: 600; }

/* 入口のページ (portal.html): どの試験の色でもない、共通の色 */
body.portal { --accent: #3d4a5c; --accent-soft: #eef0f3; }
.portal-list { list-style: none; padding: 0; display: grid; gap: 12px; }
.portal-site { display: block; padding: 18px 20px; border: 1px solid var(--border); border-radius: 10px; text-decoration: none; font-size: 1.1rem; }
.portal-site:hover { border-color: var(--accent); background: var(--accent-soft); }

/* 問題のページ (/q/。検索エンジン向けに 1 問 1 ページ) */
.crumbs { font-size: 13px; color: var(--muted, #666); margin-bottom: 6px; }
.q-choices { list-style: none; padding: 0; margin-left: 0; display: grid; gap: 8px; margin-top: 14px; }
.q-choices li { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.q-label { display: inline-block; min-width: 1.6em; font-weight: 700; color: var(--accent); }
.q-answer summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.q-answer[open] summary { margin-bottom: 10px; }
.q-cta { margin: 20px 0; }
.q-list { columns: 2 260px; padding-left: 1.2em; }
.q-list li { break-inside: avoid; margin-bottom: 4px; }

/* 会員の仕組み: Google でログイン・有料プラン (設定が無ければ出さない) */
:root:not([data-analytics]) [data-if="analytics"], :root[data-analytics] [data-if="no-analytics"],
:root:not([data-google]) [data-if="google"], :root:not([data-billing]) [data-if="billing"],
:root[data-billing] [data-if="no-billing"] { display: none; }
.login .google-btn, .google-btn { display: flex; width: 100%; box-sizing: border-box; padding: 10px 14px; align-items: center; justify-content: center; gap: 10px; background: #fff; color: var(--text); border: 1px solid var(--border); font-weight: 600; }
.google-btn:hover { background: #f5f5f5; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 4px 0; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 18px 0; }
.plan { display: flex; flex-direction: column; gap: 10px; }
.plan.featured { border: 2px solid var(--accent); }
main.doc .plan h3 { margin: 0; padding: 0; border: 0; }
.doc .plan p { margin: 0; }
.plan .price { font-size: 28px; font-weight: 700; }
.plan .price small { font-size: 14px; font-weight: 400; color: var(--muted); }
.plan ul { padding-left: 1.2em; margin: 0; flex: 1; }
.plan li { margin: 4px 0; }
.plan .btn { text-align: center; }
.upgrade-note { border-left: 4px solid var(--accent); }
