/* iPhone で素早く2回押すと画面が拡大されるのを止める(選んだボタンを押し直したときなどに起きていた。2026-10-19 マスター)。
   指2本で広げる拡大はそのまま使える */
html { touch-action: manipulation; }
:root {
  --bg: #ffffff;
  --fg: #1f2328;
  --muted: #656d76;
  --line: #d0d7de;
  --card: #f6f8fa;
  --ng: #cf222e;
  --ng-bg: #ffebe9;
  --ok: #1a7f37;
  --ok-bg: #dafbe1;
  --accent: #0969da;
}
@media (prefers-color-scheme: dark) {
  html:not([data-mode="light"]) {
    --bg: #0d1117;
    --fg: #e6edf3;
    --muted: #8d96a0;
    --line: #30363d;
    --card: #161b22;
    --ng: #ff7b72;
    --ng-bg: #3d1214;
    --ok: #56d364;
    --ok-bg: #12261e;
    --accent: #4493f8;
  }
}
/* 「使い方・設定」で「暗い」を選んだとき(上と同じ色) */
html[data-mode="dark"] {
    --bg: #0d1117;
    --fg: #e6edf3;
    --muted: #8d96a0;
    --line: #30363d;
    --card: #161b22;
    --ng: #ff7b72;
    --ng-bg: #3d1214;
    --ok: #56d364;
    --ok-bg: #12261e;
    --accent: #4493f8;
  }

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  line-height: 1.6;
}
main { max-width: 720px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.25rem; margin: 0 0 8px; }
h2 { font-size: 1.1rem; margin: 24px 0 8px; padding-top: 8px; border-top: 1px solid var(--line); }
a { color: var(--accent); }
.muted, .note { color: var(--muted); font-size: 0.85rem; }
.howto { margin: 8px 0 12px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.howto summary { cursor: pointer; font-weight: 600; }
.howto ul { margin: 8px 0 0; padding-left: 1.2em; font-size: 0.9rem; }
.howto li { margin: 2px 0; }
.exam-list { padding-left: 1.2em; }
.exam-list li { margin: 8px 0; }
.jump { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.jump a { padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; }
.item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; margin: 8px 0; background: var(--card); border-radius: 8px;
}
.item .label { font-weight: 600; }
.buttons { display: flex; gap: 6px; flex-shrink: 0; }
button {
  font: inherit; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--fg); cursor: pointer; min-height: 44px;
}
button:disabled { opacity: 0.6; }
.vote.wakaranai.on { background: var(--ng-bg); border-color: var(--ng); color: var(--ng); font-weight: 700; }
.vote.wakatta.on { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); font-weight: 700; }
/* 選んだボタンは色だけでなく ✓ でも分かるように(色の見え方の個人差のため) */
.vote.on::before { content: '✓ '; }
/* 生徒用ページの「分からない」は、間違い・警告を連想させる赤ではなく温かいオレンジにする */
body.student .vote.wakaranai.on { background: var(--hmm-bg); border-color: var(--hmm); color: var(--hmm); }
.toast {
  position: fixed; left: 16px; right: 16px; bottom: 16px; margin: 0 auto; max-width: 480px;
  padding: 12px 16px; border-radius: 8px; background: var(--fg); color: var(--bg); text-align: center;
}

/* ---- 管理画面 ---- */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
select, input { font: inherit; padding: 6px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); max-width: 100%; }
.error { color: var(--ng); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; }
td:nth-child(n+2), th:nth-child(n+2) { text-align: right; }
tr.daimon th { background: var(--card); text-align: left; }
tr.hot td { background: var(--ng-bg); color: var(--ng); font-weight: 700; }
details { margin-top: 24px; }
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; margin-top: 12px; }
.qr-grid figure { margin: 0; text-align: center; }
.qr-grid svg { width: 100%; height: auto; background: #fff; }
.qr-grid figcaption { font-size: 0.8rem; }
/* 印刷: QR だけを A4 1枚の真ん中に大きく出す(ほかの要素は場所も取らないよう display: none) */
@page { size: A4; margin: 15mm; }
@media print {
  body { background: #fff; }
  main { max-width: none; padding: 0; }
  #login, #panel > *:not(#qr-box):not(.admin-main), #qr-box > summary, #print { display: none !important; }
  /* 管理画面(admin-questions.html)では、印刷のボタンで選んだ QR だけを出す(body[data-print]) */
  body[data-print] .admin-view, body[data-print] .toast { display: none !important; }
  body[data-print="qr"] #view-contents { display: block !important; }
  body[data-print="qr"] #view-contents > :not(#qr-box), body[data-print="qr"] #qr-box > :not(#qr) { display: none !important; }
  body[data-print="st-qr"] #view-stats, body[data-print="st-qr"] #stats-wakaranai, body[data-print="st-qr"] #st-wb-body { display: block !important; }
  body[data-print="st-qr"] #view-stats > :not(#stats-wakaranai), body[data-print="st-qr"] #stats-wakaranai > :not(#st-wb-body),
  body[data-print="st-qr"] #st-wb-body > :not(#st-qr-box), body[data-print="st-qr"] #st-qr-box > :not(#st-qr) { display: none !important; }
  body[data-print="st-qr"] #st-qr { display: block; margin: 0; }
  body[data-print="st-qr"] #st-qr svg { display: block; width: 160mm; height: 160mm; margin: 20mm auto 0; }
  body[data-print="st-qr"] #st-qr figcaption { margin-top: 8mm; font-size: 20pt; text-align: center; }
  body[data-print="st-qr"] #st-qr a { color: #000; text-decoration: none; }
  #qr { display: block; margin: 0; }
  #qr figure { margin: 0; page-break-inside: avoid; }
  #qr svg { display: block; width: 160mm; height: 160mm; margin: 20mm auto 0; }
  #qr figcaption { margin-top: 8mm; font-size: 20pt; text-align: center; }
  #qr a { color: #000; text-decoration: none; }
}

/* ---- 生徒用ページのテーマ(白に近い空色の地+大問ごとのアクセント色)。管理画面には効かない ----
   標準は空色。「使い方・設定」のページでミント・ラベンダー・ピーチ・クリームに切り替えられる(theme.js が <html data-theme> を付ける)。
   2026-10-17 にクリームから空色へ(マスター: クリームの暖色の地は AI が作ったページっぽく見える。白基調のパステルで爽やかに) */
body.student {
  --bg: #eef5fd;
  --card: #ffffff;
  --line: #d4e3f4;
  --fg: #1f2a37;
  --muted: #56657a; /* 補足の灰色。空色の地で薄く見えたので一段濃くした(2026-10-17) */
  --accent: #2f80d1;
  --shadow: 0 1px 3px rgba(40, 80, 140, 0.10);
  /* 大問の色。7色を虹の順(赤系 → 黄系 → 緑系 → 青 → 紺 → 紫 → 灰)に並べ、第7問まで色がかぶらないようにしている。
     「分かった」の緑・「分からない」のオレンジと紛れないよう、赤はピンク寄り、黄はからし色、緑は青緑にして、どれも落ち着いた濃さにそろえた */
  --c1: #db2777; --c2: #a16207; --c3: #0d9488; --c4: #3b82f6; --c5: #3730a3; --c6: #8b5cf6; --c7: #64748b;
  --hmm: #c2410c; --hmm-bg: #ffedd5;
}
@media (prefers-color-scheme: dark) {
  html:not([data-mode="light"]) body.student {
    --bg: #0f1722;
    --card: #18212d;
    --line: #2a3647;
    --fg: #e6edf3;
    --muted: #8d9bb0;
    --accent: #58a6ff;
    --shadow: none;
    --c1: #f472b6; --c2: #eab308; --c3: #2dd4bf; --c4: #60a5fa; --c5: #818cf8; --c6: #c084fc; --c7: #94a3b8;
    --hmm: #fb923c; --hmm-bg: #3a2412;
  }
}
/* 「使い方・設定」で「暗い」を選んだとき(上と同じ色) */
html[data-mode="dark"] body.student {
    --bg: #0f1722;
    --card: #18212d;
    --line: #2a3647;
    --fg: #e6edf3;
    --muted: #8d9bb0;
    --accent: #58a6ff;
    --shadow: none;
    --c1: #f472b6; --c2: #eab308; --c3: #2dd4bf; --c4: #60a5fa; --c5: #818cf8; --c6: #c084fc; --c7: #94a3b8;
    --hmm: #fb923c; --hmm-bg: #3a2412;
  }

/* 選べるテーマ。地・線・文字・アクセントだけを替え、カードは白(暗いときは地より少し明るい色)のまま。
   端末のダークモードのときは、それぞれの色味を残した暗い版にする。暗い版のアクセントは明るいので、
   アクセントの地に乗せる文字(「最新」・ボタン)は --on-accent で暗い色にする(ほかは白のまま) */
html[data-theme="mint"] body.student { --bg: #ebf7f2; --line: #cfe8dd; --fg: #1f2d29; --muted: #506a63; --accent: #11957f; --shadow: 0 1px 3px rgba(30, 110, 90, 0.10); }
html[data-theme="lavender"] body.student { --bg: #f2f0fd; --line: #dedaf3; --fg: #25223a; --muted: #5f5a7a; --accent: #6c5ce0; --shadow: 0 1px 3px rgba(80, 60, 160, 0.10); }
html[data-theme="peach"] body.student { --bg: #fff1ec; --line: #f4dcd3; --fg: #2f2624; --muted: #74605b; --accent: #e0584c; --shadow: 0 1px 3px rgba(160, 80, 60, 0.10); }
html[data-theme="cream"] body.student { --bg: #fdf8ef; --line: #eadfcb; --fg: #3a3227; --muted: #76695a; --accent: #94602f; --shadow: 0 1px 3px rgba(90, 70, 40, 0.10); } /* クリームのアクセントは茶色(キャラメル)。以前の青のままだと地とちぐはぐだった(2026-10-17 マスター) */
@media (prefers-color-scheme: dark) {
  html[data-theme="mint"]:not([data-mode="light"]) body.student { --bg: #0e1a17; --card: #17241f; --line: #283a33; --fg: #e3efea; --muted: #8ba69d; --accent: #34d3b4; --on-accent: #0b1f1a; --shadow: none; }
  html[data-theme="lavender"]:not([data-mode="light"]) body.student { --bg: #15131f; --card: #1e1b2b; --line: #322e45; --fg: #ebe8f5; --muted: #9a95b3; --accent: #a99bff; --on-accent: #17132b; --shadow: none; }
  html[data-theme="peach"]:not([data-mode="light"]) body.student { --bg: #1d1615; --card: #2a201e; --line: #3d2f2c; --fg: #f3e7e4; --muted: #b09a95; --accent: #ff8f84; --on-accent: #2a1210; --shadow: none; }
  html[data-theme="cream"]:not([data-mode="light"]) body.student { --bg: #1d1a16; --card: #2a261f; --line: #3d362c; --fg: #efe6d8; --muted: #a99b86; --accent: #d9a066; --on-accent: #2a1a0c; --shadow: none; }
}
/* 「使い方・設定」で「暗い」を選んだとき(上と同じ色) */
html[data-theme="mint"][data-mode="dark"] body.student { --bg: #0e1a17; --card: #17241f; --line: #283a33; --fg: #e3efea; --muted: #8ba69d; --accent: #34d3b4; --on-accent: #0b1f1a; --shadow: none; }
html[data-theme="lavender"][data-mode="dark"] body.student { --bg: #15131f; --card: #1e1b2b; --line: #322e45; --fg: #ebe8f5; --muted: #9a95b3; --accent: #a99bff; --on-accent: #17132b; --shadow: none; }
html[data-theme="peach"][data-mode="dark"] body.student { --bg: #1d1615; --card: #2a201e; --line: #3d2f2c; --fg: #f3e7e4; --muted: #b09a95; --accent: #ff8f84; --on-accent: #2a1210; --shadow: none; }
html[data-theme="cream"][data-mode="dark"] body.student { --bg: #1d1a16; --card: #2a261f; --line: #3d362c; --fg: #efe6d8; --muted: #a99b86; --accent: #d9a066; --on-accent: #2a1a0c; --shadow: none; }

.student h1 { font-size: 1.3rem; }
.student .howto { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); }
.student .c1 { --accent-d: var(--c1); }
.student .c2 { --accent-d: var(--c2); }
.student .c3 { --accent-d: var(--c3); }
.student .c4 { --accent-d: var(--c4); }
.student .c5 { --accent-d: var(--c5); }
.student .c6 { --accent-d: var(--c6); }
.student .c7 { --accent-d: var(--c7); }
.student .jump a { border: 2px solid var(--accent-d); color: var(--accent-d); background: var(--card); font-weight: 600; }
.student section.daimon h2 {
  border-top: none; padding: 6px 12px; border-radius: 10px;
  background: color-mix(in srgb, var(--accent-d) 14%, var(--card)); color: var(--fg);
  border-left: 6px solid var(--accent-d);
}
.student .item {
  background: var(--card); border-radius: 14px; box-shadow: var(--shadow);
  border-left: 4px solid color-mix(in srgb, var(--accent-d) 55%, transparent);
}
.student button { border-radius: 999px; position: relative; }

/* 進み具合バー+大問へのジャンプ(スクロールしても上に残る) */
.sticky-head {
  position: sticky; top: 0; z-index: 5;
  margin: 8px -16px 4px; padding: 8px 16px 2px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(6px);
}
.sticky-head .jump { margin: 8px 0 4px; }
.sticky-head .jump a { padding: 2px 10px; font-size: 0.9rem; }
/* 上に残る帯で大問の見出しが隠れないように、ジャンプ先を帯の高さぶん下げる */
.student section.daimon { scroll-margin-top: 96px; }

/* 名前が出ないことの常時表示 */
.privacy { margin: 4px 0 8px; font-size: 0.85rem; color: var(--muted); }
.progress-label { font-size: 0.9rem; font-weight: 700; }
.progress-track { height: 10px; margin-top: 4px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress-fill {
  height: 100%; width: 0; border-radius: 999px;
  background: var(--c4); /* 「確認した」数なので、分かった/分からないの色(緑・オレンジ)とは別の1色(青) */
  transition: width 0.4s ease;
}
.progress.clear .progress-fill { background: linear-gradient(90deg, var(--c6), var(--c1), var(--c7)); }

/* 「分かった」を押したときのぽよん+✨ */
.vote.pop { animation: pop 0.35s ease; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.15); } 100% { transform: scale(1); } }
.sparkle {
  position: absolute; right: -4px; top: -6px; pointer-events: none;
  animation: sparkle 0.7s ease-out forwards;
}
@keyframes sparkle { 0% { opacity: 0; transform: translateY(4px) scale(0.6); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px) scale(1.2); } }
@media (prefers-reduced-motion: reduce) {
  .vote.pop, .sparkle { animation: none; }
  .sparkle { display: none; }
  .progress-fill { transition: none; }
}

/* 管理画面: 回ごとの比較で「分からない」がある欄 */
td.hot-cell { background: var(--ng-bg); color: var(--ng); font-weight: 700; }
#summary[hidden] { display: none; }
.howto-lead { margin: 8px 0 0; font-size: 0.9rem; font-weight: 600; }

/* 管理画面: スマホで試験名の長いプルダウンが画面からはみ出さないように */
.controls label { display: flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; white-space: nowrap; }
.controls select { min-width: 0; width: 100%; text-overflow: ellipsis; }
@media (max-width: 600px) {
  .controls label { flex: 1 1 100%; }
  .controls #new-round { flex: 1 1 100%; }
}

/* ---- 質問箱 ---- */
h3 { font-size: 1rem; margin: 16px 0 6px; }
textarea { font: inherit; width: 100%; box-sizing: border-box; padding: 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); }
label.block { display: block; margin: 10px 0; }
.ask label { display: block; margin: 8px 0; }
.ask select { width: 100%; }
button.primary { background: var(--accent); color: var(--on-accent, #fff); border-color: var(--accent); }
button.danger { color: var(--ng); }
.qa { margin: 10px 0; padding: 10px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
.qa-head { display: flex; justify-content: space-between; gap: 8px; font-size: 0.85rem; margin-bottom: 6px; }
.qa-where { font-weight: 600; }
/* カードの頭の右: 日付と「あとで見返す」のボタン(線だけの栞。入れると塗る) */
.qa-head-end { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.qa-new { margin-right: 6px; vertical-align: 1px; }
/* 講師が付けた単元(public/units.js)。カードの頭の名前の後ろに、枠だけの小さな札 */
.qa-unit { display: inline-block; margin-left: 6px; padding: 0 8px; border: 1px solid var(--line); border-radius: 999px; font-size: 0.75rem; font-weight: 400; color: var(--muted); vertical-align: 1px; }
.finder-unit { width: 100%; min-height: 38px; margin-top: 6px; }
button.bm-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; min-height: 32px; margin: -6px -6px -6px 0; padding: 0;
  border: 0; background: transparent; color: var(--muted); }
button.bm-btn svg { width: 18px; height: 18px; }
button.bm-btn.on { color: var(--accent); }
button.bm-btn.on .f { fill: currentColor; }
.qa-q, .qa-a { display: flex; gap: 8px; align-items: flex-start; }
.qa-a { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.qa-mark { flex-shrink: 0; width: 1.6em; height: 1.6em; line-height: 1.6em; text-align: center; border-radius: 50%; font-weight: 700; font-size: 0.85rem; }
.qa-q .qa-mark { background: color-mix(in srgb, var(--accent) 14%, var(--card)); color: var(--accent); } /* Q はテーマの色(赤はエラー専用。2026-10-17) */
.qa-a .qa-mark { background: var(--ok-bg); color: var(--ok); }
.qa-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; overflow-x: auto; overflow-y: hidden; padding-block: 0.15em; }
/* overflow-x: auto だけだと縦も auto 扱いになり、根号や指数がわずかにはみ出しただけで回答の中に縦のスクロールバーが出ていた。
   横(長い数式)だけスクロールを許し、縦は出さない。数式(KaTeX)は既定で本文の 1.21 倍と大きく行間が乱れるので 1.08 倍に(天秤AIレビュー 2026-10-17) */
.qa-text .katex, .preview .katex, .mine-body .katex { font-size: 1.08em; }
.mine { padding-left: 0; list-style: none; }
.mine li { margin: 6px 0; overflow-wrap: anywhere; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.8rem; }
.badge.pending { background: var(--card); border: 1px solid var(--line); color: var(--muted); }
.badge.published { background: var(--ok-bg); color: var(--ok); }
.stat { font-size: 1.1rem; font-weight: 600; }
.preview { white-space: pre-wrap; padding: 8px; border: 1px dashed var(--line); border-radius: 6px; min-height: 2em; overflow-x: auto; overflow-y: hidden; }
.actions { display: flex; gap: 8px; margin-top: 10px; }
.admin-qa summary { cursor: pointer; }

/* ---- 質問箱の写真(フェーズ2) ---- */
input.file { display: none; }
.qa-body { min-width: 0; flex: 1; }
.qa-images, .thumbs, .admin-images { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.qa-images img { display: block; max-width: 100%; max-height: 240px; border-radius: 6px; border: 1px solid var(--line); background: #fff; }
.photo-pick { margin: 8px 0; }
.thumb { position: relative; }
.thumb img { display: block; width: 88px; height: 88px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.thumb-remove { position: absolute; top: -8px; right: -8px; min-height: 0; width: 28px; height: 28px; padding: 0; border-radius: 50%; line-height: 1; }
.admin-image { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.admin-image .qa-images img { max-height: 160px; }
button.small { padding: 4px 8px; min-height: 0; font-size: 0.85rem; }

/* ---- 分からないボタン → 質問箱のリンク ---- */
.item { flex-wrap: wrap; }
.ask-link { flex-basis: 100%; font-size: 0.85rem; }
/* 「分からない」の理由(任意)。押した子だけに、ボタンの下へ小さく出す */
.reason-row { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.reason-row[hidden] { display: none; }
.reason-q { flex-basis: 100%; font-size: 0.8rem; color: var(--muted); }
button.reason-chip { min-height: 32px; padding: 2px 12px; border-radius: 999px; font-size: 0.85rem; }
button.reason-chip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent, #fff); font-weight: 600; }
.qa-link { margin: 8px 0; }

/* ---- 質問箱の見直し(2026-10-09、AIレビューを受けて) ---- */
.back { margin: 0 0 4px; font-size: 0.9rem; }
.back a { color: var(--muted); }
button.wide { display: block; width: 100%; min-height: 48px; font-size: 1rem; }
button.primary.wide { font-weight: 600; margin-top: 8px; }
button.photo { border: 1.5px solid var(--accent); color: var(--accent); background: var(--bg); }
.hint { margin: 4px 0 10px; font-size: 0.9rem; color: var(--fg); opacity: 0.8; }
.field-error { margin: 4px 0; font-size: 0.9rem; color: var(--ng); }
.preview.small { font-size: 0.95rem; margin: 4px 0 10px; }
.preview.small > .note { display: block; margin-bottom: 4px; }
.classify { margin: 12px 0; padding: 8px 12px; border: 1px dashed var(--line); border-radius: 8px; }
.classify label { display: block; margin: 6px 0; font-size: 0.9rem; }
.classify select { width: 100%; }
/* 送信ボタンのすぐ上の1行: 公開するかどうかの結果(チェックで切り替わる) */
.assure { margin: 12px 0 10px; font-size: 0.95rem; }
.send-status { margin: 10px 0; padding: 10px 12px; border-radius: 8px; font-size: 0.95rem; }
.send-status.ok { background: var(--ok-bg); color: var(--ok); }
.send-status.ng { background: var(--ng-bg); color: var(--ng); }
.footnote { margin-top: 14px; font-size: 0.875rem; color: var(--fg); opacity: 0.75; }
.footnote p { margin: 4px 0; }
.mine .see-answer { margin-left: 8px; white-space: nowrap; }
.round-list { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.round-card { display: flex; flex-direction: column; gap: 2px; min-height: 56px; padding: 12px 16px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--card); color: var(--fg); text-decoration: none; }
.round-card:active { transform: scale(0.99); }
.round-title { font-weight: 600; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.round-sub { font-size: 0.9rem; opacity: 0.75; }
.badge.new { background: var(--accent); color: var(--on-accent, #fff); font-size: 0.75rem; font-weight: 600; }

/* ---- 質問箱の管理画面(左右2列) ---- */
main.wide { max-width: 1200px; }
.qa-grid { display: grid; gap: 16px; margin-top: 8px; }
@media (min-width: 900px) {
  .qa-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); align-items: start; }
  .qa-left { position: sticky; top: 8px; }
}
.col-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.question-view { margin: 0 0 8px; padding: 10px 12px; border-left: 3px solid var(--ng); background: var(--bg); border-radius: 4px;
  white-space: pre-wrap; overflow-wrap: anywhere; }
textarea.mono { font-family: Consolas, "Courier New", monospace; font-size: 0.95rem; }
.snippets { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.snippets button { font-family: Consolas, "Courier New", monospace; }
.preview.readonly { background: var(--card); border-style: solid; }
.draft-status { font-size: 0.8rem; color: var(--ok); }
.sticky-actions { position: sticky; bottom: 0; padding: 8px 0; background: var(--card); }
a.button-link { display: inline-block; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; }

/* ---- 質問箱のゴミ箱 ---- */
.trash-box { margin: 24px 0; padding: 8px 12px; border: 1px dashed var(--line); border-radius: 8px; }
.trash-box summary { cursor: pointer; font-weight: 600; }
.trash-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.trash-body { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; opacity: 0.8; }

/* ---- 質問箱の見直し 第2弾(2026-10-09、6つのAIの再レビューを受けて) ---- */
/* 送信前の説明は落ち着いた色に。緑は「受け付けました」(成功)だけに使う */
.send-done { margin: 8px 0 16px; padding: 14px 16px; border-radius: 10px; background: var(--ok-bg); border: 1px solid var(--ok); }
.send-done p { margin: 4px 0; }
.send-done-title { font-weight: 700; font-size: 1.1rem; color: var(--ok); }
.send-done button { margin-top: 10px; }
.jump-link { margin: 0 0 8px; font-size: 0.95rem; }
textarea#q-body { resize: none; overflow: hidden; min-height: 6.5em; }
/* 薄すぎた文字を少し濃く */
.back a { color: var(--fg); opacity: 0.75; }
.badge.pending { color: var(--fg); }
.hint { opacity: 0.85; }
/* 入口のカードに「›」 */
.round-card { position: relative; padding-right: 36px; }
.round-card::after { content: '›'; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 1.6rem; opacity: 0.5; }
/* 管理画面 */
.question-view { border-left-color: var(--line); }
.summary-snippet { display: block; margin: 2px 0 0 1.2em; font-size: 0.85rem; font-weight: normal; opacity: 0.75; }
.push-right { margin-left: auto; }
.sticky-actions { align-items: center; }
.toast-action { margin-left: 12px; padding: 4px 10px; min-height: 0; border-radius: 6px; font-weight: 600; }

/* 質問箱の管理画面の QR 印刷: 説明文と通知は印刷しない */
@media print {
  #qr-box > p, .toast { display: none !important; }
}

/* 印刷の余白を 0 にすると、Chrome がページの端に付ける「ヘッダーとフッター」(管理画面の URL・タイトル・日付)が出なくなる。
   余白の代わりに中身の側で間をあける(QR の上の 20mm は #qr svg の margin) */
@media print {
  @page { margin: 0; }
  main { padding: 15mm; }
}

/* hidden 属性を付けた要素は、display を指定したクラス(.classify label など)より優先して必ず隠す */
[hidden] { display: none !important; }
.zoom-hint { flex-basis: 100%; margin: 0; font-size: 0.8rem; opacity: 0.7; }
.mine button.withdraw { margin-left: 8px; color: var(--ng); }
.admin-classify { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 10px; }
.admin-classify select { max-width: 100%; }

/* ---- 受付番号と非公開 ---- */
.private-check { display: flex; align-items: center; gap: 6px; margin: 12px 0 0; font-size: 0.95rem; }
.private-check input { width: 20px; height: 20px; }
.badge.private { background: var(--card); border: 1px solid var(--line); color: var(--fg); }
.receipt-small { display: block; font-size: 0.8rem; opacity: 0.7; }
.receipt-box { margin: 10px 0; padding: 10px 12px; border-radius: 8px; background: var(--bg); border: 1px dashed var(--ok); }
.receipt-code { margin: 2px 0; font-family: Consolas, "Courier New", monospace; font-size: 1.6rem; font-weight: 700; letter-spacing: 0.08em; color: var(--fg); }
.receipt-form { display: flex; gap: 8px; margin: 12px 0; }
.receipt-input { flex: 1; font-family: Consolas, "Courier New", monospace; font-size: 1.2rem; text-transform: uppercase; letter-spacing: 0.06em; }
.stat-sub { margin: -4px 0 12px; opacity: 0.8; }
.private-note { margin: 2px 0 0 26px; font-size: 0.85rem; }
.rewrite-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 8px; }

/* ---- あなたの質問を1件ずつ角丸の枠に(2026-10-09) ---- */
.mine { display: flex; flex-direction: column; gap: 8px; }
.mine li.mine-item { margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.mine-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.mine-head .receipt-small { display: inline; margin-left: auto; }
.mine-body { margin: 6px 0 0; overflow-wrap: anywhere; overflow-x: auto; overflow-y: hidden; white-space: pre-wrap; }
/* 長い質問の「全文を見る」。ボタンの形にすると目立ちすぎるので、文字だけ(2026-10-20) */
.mine .mine-more { background: none; border: none; padding: 4px 0; margin: 2px 0 0; min-height: 0; color: var(--accent); font-size: 0.9rem; text-decoration: underline; box-shadow: none; }
/* 別行の長い式($$…$$)は折り返せないので、その式だけ横にスクロールさせる(文章まで一緒に横へ動かないように。2026-10-19) */
.katex-display { overflow-x: auto; overflow-y: hidden; padding-block: 0.2em; }
.mine-actions { display: flex; justify-content: flex-end; margin-top: 6px; }
.mine-actions:empty { display: none; }
.mine .see-answer { margin-left: 0; font-weight: 600; }
.mine button.withdraw { margin-left: 0; }

/* ---- みんなの質問と回答の並べ替え ---- */
.sort-toggle { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 10px; }
.sort-btn { min-height: 0; padding: 4px 12px; border-radius: 999px; font-size: 0.9rem; }
.sort-btn.on { background: var(--accent); color: var(--on-accent, #fff); border-color: var(--accent); }

/* 管理画面: 「公開をやめる」と「ゴミ箱へ」が並ぶとき */
.push-right + .push-right { margin-left: 8px; }

/* 非公開の質問の受付番号は、なくすと回答を見られなくなるので赤で強調 */
.receipt-warn { margin: 8px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--ng-bg); color: var(--ng); font-weight: 600; font-size: 0.9rem; }
.receipt-small.important { color: var(--ng); font-weight: 600; opacity: 1; }

/* 管理画面: 「分からない」の人数で濃さを3段階に(いちばん多い小問に対する割合) */
tr.hot.heat1 td, td.hot-cell.heat1 { background: color-mix(in srgb, var(--ng-bg) 45%, transparent); }
tr.hot.heat2 td, td.hot-cell.heat2 { background: var(--ng-bg); }
tr.hot.heat3 td, td.hot-cell.heat3 { background: color-mix(in srgb, var(--ng) 28%, var(--ng-bg)); }
td.big { font-size: 1.5rem; line-height: 1.2; }
.legend { margin: 4px 0; font-size: 0.9rem; }

/* ---- 2026-10-10 初めて触った人の感想を受けて: 文字を減らし、質問を書く欄を主役に ---- */
h2.ask-title { font-size: 1.45rem; font-weight: 700; margin-top: 28px; }
.ask label.block { margin: 4px 0 6px; font-size: 1.05rem; font-weight: 600; }
textarea#q-body { min-height: 9em; padding: 12px; font-size: 1.05rem; line-height: 1.7; border-width: 1.5px; border-radius: 10px; }
textarea#q-body:focus { border-color: var(--accent); outline: none; }
/* 写真を選んだあとだけ出る注意。赤にしない(赤はエラー専用) */
.photo-caution { margin: 6px 0 4px; font-size: 0.9rem; }
.private-note { margin: 4px 0 0 26px; font-size: 0.85rem; opacity: 0.85; }
.private-note p { margin: 2px 0; }
/* 「回答を見る」は文字のリンクではなく、押せると分かるボタンの形に */
.mine a.see-answer { display: inline-block; padding: 8px 18px; border-radius: 8px; background: var(--accent); color: var(--on-accent, #fff); font-size: 1rem; font-weight: 700; text-decoration: none; }
.mine a.see-answer::after { content: " →"; }
button.check-answer { margin: 4px 0 10px; }
.qr-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media print { .qr-actions { display: none !important; } }

/* ---- 2026-10-10 その2: 入口に送った件数、「あなたの質問」は折りたたみ、質問を書く欄は白 ---- */
.round-mine { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; font-size: 0.85rem; font-weight: 600; }
details.mine-box { margin: 16px 0 0; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
details.mine-box > summary { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 36px 12px 14px; cursor: pointer; list-style: none; }
details.mine-box > summary::-webkit-details-marker { display: none; }
details.mine-box > summary::after { content: '▼'; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 0.75rem; opacity: 0.6; }
details.mine-box[open] > summary::after { content: '▲'; }
details.mine-box .mine-title { font-size: 1.05rem; font-weight: 700; }
details.mine-box .mine-count { font-size: 0.9rem; opacity: 0.8; }
details.mine-box > :not(summary) { margin-left: 14px; margin-right: 14px; }
details.mine-box > ul.mine { margin-bottom: 14px; }
details.mine-box .mine li.mine-item { background: var(--bg); }
textarea#q-body { background: #fff; color: #1f2328; }
@media (prefers-color-scheme: dark) {
  html:not([data-mode="light"]) textarea#q-body { background: var(--card); color: var(--fg); }
}
/* 「使い方・設定」で「暗い」を選んだとき(上と同じ色) */
html[data-mode="dark"] textarea#q-body { background: var(--card); color: var(--fg); }

details.mine-box > button.wide { width: calc(100% - 28px); }

/* ---- 2026-10-10 その3: 使い方ガイド、受付番号ページの行分け ---- */
details.guide { margin: 20px 0 0; font-size: 0.95rem; }
details.guide > summary { cursor: pointer; color: var(--accent); text-decoration: underline; }
details.guide ol { margin: 8px 0; padding-left: 1.4em; }
details.guide li { margin: 6px 0; }
.receipt-badges { margin: 12px 0 2px; }
.receipt-where { margin: 0 0 8px; font-weight: 600; }
.round-all { font-weight: 400; }
.round-all + .round-mine { margin-top: 2px; }

/* 入口へ戻るリンクは、押せると分かるボタンの形に(文字だけだと目立たない、とマスター指摘) */
.back { margin: 0 0 14px; font-size: 0.95rem; }
.back a { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 16px; border: 1.5px solid var(--accent); border-radius: 999px; background: var(--card); color: var(--accent); font-weight: 600; text-decoration: none; opacity: 1; }
.back a:active { transform: scale(0.98); }

/* ---- 入口に共テ解説の質問箱(畳んだ一覧)。採点の回のカードより控えめに ---- */
.back { display: flex; flex-wrap: wrap; gap: 8px; }
details.kyotsu-box { margin: 16px 0; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
details.kyotsu-box > summary { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 36px 12px 16px; cursor: pointer; list-style: none; }
details.kyotsu-box > summary::-webkit-details-marker { display: none; }
details.kyotsu-box > summary::after { content: '▼'; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 0.75rem; opacity: 0.6; }
details.kyotsu-box[open] > summary::after { content: '▲'; }
.kyotsu-title { font-weight: 600; font-size: 1.05rem; }
details.kyotsu-box > .round-list { margin: 0 12px 12px; gap: 6px; }
.round-card.compact { min-height: 44px; padding: 8px 32px 8px 12px; background: var(--bg); box-shadow: none; justify-content: center; }
.round-card.compact .round-title { font-size: 0.95rem; font-weight: 500; }
.round-card.compact::after { right: 12px; font-size: 1.3rem; }

/* ---- 管理画面: 生徒に見せる質問箱 ---- */
#boxes h3, #pdfs h3 { margin: 12px 0 4px; font-size: 0.95rem; }
.box-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.box-row input { width: 18px; height: 18px; }
@media print { #boxes-box, #pdfs-box { display: none !important; } }
/* 生徒に見せる質問箱: 変更をためて、確認画面で違いを見てから保存する */
.box-row.changed { background: var(--ng-bg); border-radius: 6px; font-weight: 600; }
.box-row.changed::after { content: '変更あり(未保存)'; margin-left: 8px; font-size: 0.8rem; color: var(--ng); }
.box-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
#boxes-confirm { max-width: min(560px, 92vw); padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--fg); }
#boxes-confirm::backdrop { background: rgba(0, 0, 0, 0.45); }
#boxes-confirm h2 { margin: 0 0 6px; padding: 0; border: 0; }
.box-diff { width: 100%; margin: 12px 0; border-collapse: collapse; }
.box-diff th, .box-diff td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.box-diff th { font-size: 0.85rem; font-weight: 600; }
.vis { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.9rem; font-weight: 600; white-space: nowrap; }
.vis.on { background: var(--ok-bg); color: var(--ok); }
.vis.off { background: var(--card); border: 1px solid var(--line); color: var(--muted); }

/* ---- 解説 PDF(配布用・問題文なし)を開くリンク ---- */
.pdf-link { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 10px 0; }
.pdf-link a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 18px; border: 1.5px solid var(--accent); border-radius: 10px; background: var(--card); color: var(--accent); font-weight: 700; text-decoration: none; }
.pdf-link a:active { transform: scale(0.98); }
.pdf-link .note { font-size: 0.8rem; }

/* ---- 管理画面: 生徒に見せるもの(質問箱・解説PDF)を1つの表で ---- */
.vis-table { width: 100%; max-width: 640px; border-collapse: collapse; margin-top: 8px; }
.vis-table th, .vis-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.vis-table thead th { font-size: 0.9rem; text-align: center; vertical-align: bottom; }
.vis-table thead th .note { display: block; font-weight: 400; font-size: 0.75rem; }
.vis-table .vis-group th { padding-top: 14px; font-size: 0.9rem; border-bottom: 2px solid var(--line); }
.vis-table .vis-cell { width: 7.5em; text-align: center; }
.vis-table .vis-cell label { display: flex; justify-content: center; align-items: center; min-height: 32px; cursor: pointer; }
.vis-table .vis-cell input { width: 20px; height: 20px; }
.vis-table .vis-cell.none { color: var(--muted); }
.vis-table .vis-cell.changed { background: var(--ng-bg); }
.vis-table .vis-cell.changed label::after { content: '未保存'; margin-left: 6px; font-size: 0.75rem; font-weight: 600; color: var(--ng); }
/* スマホの幅では、チェックの列を細くして題名の列に幅を回す(7.5em × 2列で画面の大半を取り、題名がつぶれていた。2026-10-20 マスターの報告) */
@media (max-width: 600px) {
  .vis-table th, .vis-table td { padding: 6px 4px; }
  .vis-table tbody td:first-child { min-width: 9em; overflow-wrap: anywhere; }
  .vis-table .vis-cell { width: 4.2em; }
  .vis-table thead th { font-size: 0.8rem; }
  .vis-table thead th .note { display: none; }
  /* 「未保存」の字は横に並べず、色だけで示す(下の「まだ保存していない変更が◯件」で分かる) */
  .vis-table .vis-cell.changed label::after { content: none; }
}
.box-diff td:nth-child(2), .box-diff th:nth-child(2) { white-space: nowrap; }

/* ---- 入口の下の3つ(まとめて見る・受付番号・使い方ガイド)を、文字リンクからボタンの形に ---- */
.sub-links { display: flex; flex-direction: column; gap: 8px; margin: 20px 0 8px; }
.sub-link { position: relative; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 10px 36px 10px 14px; border: 1.5px solid var(--accent); border-radius: 12px; background: var(--card); color: var(--accent); font-size: 0.98rem; font-weight: 600; text-decoration: none; cursor: pointer; }
.sub-link::after { content: '›'; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 1.4rem; opacity: 0.6; }
.sub-link:active { transform: scale(0.99); }
.sub-icon { font-size: 1.1rem; }
details.guide { margin: 0; }
details.guide > summary.sub-link { list-style: none; text-decoration: none; }
details.guide > summary.sub-link::-webkit-details-marker { display: none; }
details.guide > summary.sub-link::after { content: '▼'; font-size: 0.75rem; }
details.guide[open] > summary.sub-link::after { content: '▲'; }
details.guide[open] > summary.sub-link { border-radius: 12px 12px 0 0; }
details.guide[open] { border-radius: 12px; background: var(--card); }
details.guide > ol { margin: 0; padding: 10px 14px 4px 2.4em; border: 1.5px solid var(--accent); border-top: 0; }
details.guide > .hint { margin: 0; padding: 4px 14px 12px; border: 1.5px solid var(--accent); border-top: 0; border-radius: 0 0 12px 12px; }

/* 入口: 質問箱(上)と、そのほかの用事(下)を横線で区切り、下のボタンは回を選ぶカードより控えめにする。
   枠は薄い色・影なし・文字はふつうの色と太さ・少し小さめ。アイコンと › で「押せる」ことは伝える */
h2.sub-title { margin: 28px 0 10px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.sub-links { margin: 24px 0 8px; } /* 「そのほか」の見出しを外したので、上のカードとの間は余白だけで区切る(2026-10-17) */
.sub-link { min-height: 44px; padding: 8px 34px 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--fg); font-size: 0.93rem; font-weight: 500; }
.sub-link::after { opacity: 0.4; }
details.guide[open] > summary.sub-link { border-radius: 10px 10px 0 0; }
details.guide[open] { border-radius: 10px; background: transparent; }
details.guide > ol { border: 1px solid var(--line); border-top: 0; font-size: 0.93rem; }
details.guide > .hint { border: 1px solid var(--line); border-top: 0; border-radius: 0 0 10px 10px; }
details.guide > summary.sub-link { color: var(--fg); }
.receipt-form { margin-bottom: 4px; }
.receipt-rule { margin: 0 0 14px; font-size: 0.8rem; }

/* 質問を書く欄の下: 左にひとこと、右に「今の文字数 / 上限」 */
.hint-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.char-count { flex: none; font-size: 0.8rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.char-count.near { color: var(--ng); font-weight: 600; opacity: 1; }
.long-hint { margin-top: -6px; color: var(--ng); opacity: 1; font-size: 0.85rem; }

/* 入力欄の上の「名前は送られません」と、送信ボタンの下の「回答は〜に出ます」 */
.ask-privacy { margin: 0 0 8px; }
.after-send { margin: 8px 0 0; }
/* 管理画面: 送り主の呼び名と「止める」 */
.sender-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 10px 0 0; padding-top: 8px; border-top: 1px dashed var(--line); }
.sender-confirm { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.badge.blocked { background: var(--ng-bg); color: var(--ng); font-weight: 600; }

/* 質問フォーム: 押せるところ(写真ボタン・「どの問題か」の選択)は、背景のクリーム色に沈まないよう白地にそろえる */
button.photo { background: var(--card); }
.classify select { background: var(--card); min-height: 44px; }
.entrance-about { margin: -2px 0 14px; font-size: 0.9rem; color: var(--muted); }

/* ---- 生徒用ページのフッター ----
   iPhone の Safari は、画面のいちばん下あたりを押すと、ボタンではなく Safari のメニュー(戻る・共有など)が出てしまう。
   ページの最後のボタン(使い方ガイドなど)が画面の下の端に来ないように、最後に押せないフッターを置いて、ボタンを上へ押し上げる。
   以前はページの終わりを示す「・ ・ ・」を置いていたが、読み込み中や続きがある印に見えるので点は消し、余白だけ残す
   (天秤AIレビュー2回目・マスター 2026-10-17)。下のタブがあるので、何もない余白でも終わりは分かる。
   ここにリンクは置かない(同じ理由で押しにくくなる) */
body.student main::after {
  content: '';
  display: block;
  height: calc(36px + 1.4em + 64px);
}
/* 下のタブがあるページでは要らない(タブが画面の下の端をふさぐので、最後のボタンが下の端に来ることはない。
   ページの下にはタブの分の余白も別に取ってある)。タブのないページ(先生用など)だけに残す(マスター 2026-10-17) */
body.student.has-tabs main::after { display: none; }

/* ---- 管理画面: アクセス数 ---- */
#access h3 { margin: 14px 0 4px; font-size: 0.9rem; }
.access-table { width: 100%; max-width: 560px; border-collapse: collapse; font-size: 0.95rem; }
.access-table th, .access-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.access-table th { font-size: 0.8rem; font-weight: 600; }
.access-table .num, .access-table th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.access-table th.left { text-align: left; } /* 文字の列は見出しも左に(2026-10-18) */
.access-day { cursor: pointer; }
.access-day:hover, .access-day.open { background: var(--card); }
.access-detail td { padding: 8px; background: var(--card); }
.access-chip { display: inline-block; margin: 2px 6px 2px 0; padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; font-size: 0.8rem; font-variant-numeric: tabular-nums; }
@media print { #access-box { display: none !important; } }
/* アクセス数: 送り主に付けた名前 */
.name-cell { white-space: nowrap; }
.sender-name { font-weight: 600; }
.name-input { width: 9em; padding: 4px 6px; margin-right: 4px; }
.access-period { display: inline-flex; align-items: center; gap: 6px; margin: 6px 0 2px; font-size: 0.9rem; }

/* 入口: タイトルを大きく。共有しないでください、は赤字で短く(手嶋さんの感想を受けて) */
.student h1.entrance-title { font-size: 1.7rem; margin-bottom: 6px; }
.entrance-rule { margin: 24px 0 0; } /* 入口のいちばん下の「塾生専用です」。灰色の小さい字(.privacy) */
/* アクセス数: 講師の端末(合計に入れない分)は薄く見せる */
.access-chip.excluded, .access-table tr.excluded td { opacity: 0.55; }
/* 公開された回答への「分かった / まだ分からない」。分からないボタンより小さく、回答の下に控えめに置く */
.qa-react { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); }
.react-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.vote.react { min-height: 36px; padding: 4px 12px; border-radius: 999px; font-size: 0.9rem; background: var(--card); }
.react-hint { margin: 8px 0 0; font-size: 0.9rem; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.react-hint[hidden] { display: none; }
a.react-ask { display: inline-block; padding: 5px 14px; border-radius: 999px; border: 1.5px solid var(--accent); background: var(--card); color: var(--accent); font-weight: 600; text-decoration: none; white-space: nowrap; }
.react-count { margin: 8px 0 0; }
/* 管理画面: 質問の見出しに出す数。「まだ分からない」が1つでもあれば色を付けて目に留まるようにする */
.react-badge { margin-left: 8px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); font-size: 0.8rem; font-weight: normal; white-space: nowrap; }
.react-badge.has-ng { border-color: var(--ng); color: var(--ng); background: var(--ng-bg); }
/* 追加の質問(公開された質問の続き)。元の質問のカードの中に、左に線を引いて一段下げて並べる */
.qa-follow { margin: 12px 0 0 10px; padding: 8px 0 0 12px; border-left: 3px solid var(--line); }
.follow-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; padding: 8px 12px; border: 1.5px solid var(--accent); border-radius: 8px; background: var(--card); }
.follow-bar[hidden] { display: none; }
.follow-bar .note { display: block; }
.follow-text { font-size: 0.9rem; overflow-wrap: anywhere; }
button.follow-cancel { min-height: 36px; padding: 4px 12px; font-size: 0.85rem; flex-shrink: 0; }
/* 書き出しのボタン(押すと入力欄に一文が入る)。スマホでは折り返して並ぶ */
.starters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 8px; }
.starters .note { flex-basis: 100%; font-size: 0.8rem; }
button.starter { min-height: 32px; padding: 3px 12px; border-radius: 999px; font-size: 0.85rem; text-align: left; }
/* 記述の見本集: 載せておく期間の選択(question.js の keepChoice) */
.keep-choice { margin: 6px 0 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; }
.keep-choice legend { padding: 0 4px; font-size: 0.85rem; font-weight: 600; }
.keep-choice label { display: flex; align-items: center; gap: 6px; min-height: 36px; font-size: 0.9rem; }
.keep-choice input { width: 18px; height: 18px; margin: 0; }
/* 書きかけの質問を戻したときの一言(draft.js)。要らなければ「消す」 */
.draft-note { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 8px; font-size: 0.9rem; color: var(--muted); }
.draft-note[hidden] { display: none; }
button.draft-discard { min-height: 32px; padding: 2px 12px; font-size: 0.85rem; flex-shrink: 0; }
/* 管理画面: 何の続きか */
.follow-of { margin: 4px 0; font-size: 0.85rem; color: var(--muted); overflow-wrap: anywhere; }
/* 「この回答で」は1行使って上に置き、ボタン2つを横に並べる(数が付くとスマホで2行に割れていたため) */
.react-buttons .note { flex-basis: 100%; }
.vote.react { padding: 4px 11px; white-space: nowrap; }
/* 受付番号をコピーする小さなボタン(印だけ。文字は足さない) */
button.copy-code { min-height: 0; padding: 4px; border: 0; background: transparent; color: var(--muted); line-height: 0; vertical-align: middle; }
button.copy-code:active { transform: scale(0.9); }
.receipt-wrap { display: inline-flex; align-items: center; gap: 2px; margin-left: auto; }
.mine-head .receipt-wrap .receipt-small { margin-left: 0; }
.receipt-line { display: flex; align-items: center; gap: 6px; }
.receipt-line .copy-code { padding: 8px; }
.receipt-line .copy-code svg { width: 20px; height: 20px; }
/* 受け付けましたの箱: 番号とコピーの印の高さをそろえる(番号の段落の余白と行の高さで、印が下にずれていた) */
.receipt-line .receipt-code { margin: 0; line-height: 1.2; }
/* 使い方・設定の「スマホを買い替えたとき」(引き継ぎコード) */
.transfer-code { margin: 6px 0 0; }
.transfer-row { display: flex; gap: 8px; }
.transfer-input { flex: 1; min-width: 0; min-height: 40px; padding: 6px 12px; border: 1.5px solid var(--line); border-radius: 8px; font: inherit; letter-spacing: 0.05em; background: var(--card); color: var(--fg); }
.receipt-line .copy-code { align-self: center; position: relative; top: -6px; }
/* ---- チャレンジ問題(/s/<KEY>/c/) ---- */
.ch-lead { margin: 0 0 14px; }
.ch-card { position: relative; margin: 12px 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.ch-latest { border: 2px solid var(--accent); }
.student button.link-button.ch-giveup { display: block; margin: 10px auto 0; padding: 8px 4px; font-size: 0.9rem; } /* 解けなかったので解説を見る(控えめに、でも押しやすく) */
.ch-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.ch-no { font-weight: 700; color: var(--accent); }
/* お気に入りのしおり(題名の行の右端。2026-10-28) */
.ch-head button.ch-fav { margin-left: auto; align-self: center; }
/* 「すべて」「お気に入り」の切りかえ。押している方を塗る */
.ch-filter { display: inline-flex; margin: 10px 0 4px; border: 1.5px solid var(--accent); border-radius: 999px; overflow: hidden; }
.ch-filter button { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 4px 14px; border: 0; border-radius: 0; background: var(--card); color: var(--accent); font-size: 0.9rem; font-weight: 600; }
.ch-filter button + button { border-left: 1.5px solid var(--accent); }
.ch-filter button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent, #fff); }
.ch-filter button svg { width: 16px; height: 16px; }
.ch-fav-empty { margin: 12px 0; color: var(--muted); }
.ch-name { font-size: 1.1rem; font-weight: 700; }
.ch-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex-basis: 100%; font-size: 0.85rem; }
.ch-star-on { color: var(--muted); letter-spacing: 0.05em; }
.ch-meta .ch-stars { font-size: 0.8rem; }
.ch-star-off { color: var(--line); letter-spacing: 0.05em; }
/* 理系向けの回の印(題名の横)。「最新」と並んでも区別できるよう、塗らずに枠だけ */
.badge.rikei { border: 1px solid var(--accent); color: var(--accent); font-size: 0.75rem; font-weight: 600; }
details.ch-old > summary { cursor: pointer; list-style: none; padding-right: 22px; position: relative; }
details.ch-old > summary::-webkit-details-marker { display: none; }
details.ch-old > summary::after { content: '▼'; position: absolute; right: 0; top: 4px; font-size: 0.75rem; opacity: 0.6; }
details.ch-old[open] > summary::after { content: '▲'; }
.ch-body { margin-top: 12px; }
/* 問題文の画像は白い紙として見せる(ダークモードでも読めるように) */
.ch-image { display: block; width: 100%; height: auto; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.ch-form { margin-top: 14px; }
.ch-blanks { display: flex; flex-wrap: wrap; gap: 10px 16px; }
.ch-blank { display: inline-flex; align-items: center; gap: 8px; }
.ch-blank-label { min-width: 2.6em; padding: 4px 8px; border: 1.5px solid var(--fg); border-radius: 4px; text-align: center; font-weight: 700; background: #fff; color: #1f2328; }
.ch-input { width: 6.5em; min-height: 44px; padding: 6px 10px; border: 1.5px solid var(--line); border-radius: 8px; font: inherit; font-size: 1.1rem; background: var(--card); color: var(--fg); }
.ch-mark { min-width: 1.2em; font-size: 1.3rem; font-weight: 700; }
.ch-mark.ok { color: var(--ok); }
.ch-mark.ng { color: var(--hmm, var(--ng)); }
.ch-form .hint { margin: 8px 0; }
.ch-result { margin: 12px 0 0; padding: 10px 12px; border-radius: 8px; font-weight: 600; }
.ch-result.ok { background: var(--ok-bg); color: var(--ok); }
.ch-result.ng { background: var(--hmm-bg, var(--ng-bg)); color: var(--hmm, var(--ng)); }
.ch-after { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.ch-after .note { flex-basis: 100%; margin: 0; }
a.ch-link { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px; border: 1.5px solid var(--accent); border-radius: 999px; background: var(--card); color: var(--accent); font-weight: 600; text-decoration: none; }
a.ch-link-main { background: var(--accent); color: var(--on-accent, #fff); }
/* 枠は他のカードと同じ。色はトロフィーだけに残す(オレンジの枠だけ浮いていた。天秤AIレビュー 2026-10-17) */
/* 問題文の画像を保存するボタン(画像のすぐ下、右寄せで小さく。主役は答えの欄なので控えめに) */
.ch-save-row { display: flex; justify-content: flex-end; margin-top: 4px; }
button.ch-save { min-height: 32px; padding: 2px 10px; border-radius: 999px; background: transparent; color: var(--muted); font-size: 0.8rem; }
/* 保存の矢印は線の SVG(Lucide の download)を文字の色で塗る。⬇ は iPhone で絵文字になるため */
button.ch-save::before { content: ''; display: inline-block; width: 1.1em; height: 1.1em; margin-right: 0.3em; vertical-align: -0.2em;
  background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='7 10 12 15 17 10'/%3E%3Cline x1='12' x2='12' y1='15' y2='3'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='7 10 12 15 17 10'/%3E%3Cline x1='12' x2='12' y1='15' y2='3'/%3E%3C/svg%3E") center / contain no-repeat; }
/* 管理画面: チャレンジ問題の難しさを選び直す欄 */
.star-cell { white-space: nowrap; }
.star-cell select { font: inherit; padding: 4px 6px; }
.star-cell .note { margin: 0 6px; }
button.star-save { min-height: 32px; padding: 2px 12px; }
/* チャレンジ問題の結果の表: 欄の中で折り返さない(狭い画面では横にスクロール) */
#challenges { overflow-x: auto; }
#challenges th, #challenges td { white-space: nowrap; }
/* チャレンジ問題の段階的なヒント(challenge.js の hintBox)。問題文の下、答えの欄の上 */
.ch-hint-box { margin: 8px 0; }
.ch-hint { margin: 8px 0; padding: 8px; border: 1.5px dashed var(--line); border-radius: 8px; background: var(--card); }
.ch-hint figcaption { font-size: 0.85rem; font-weight: 600; color: var(--accent); margin-bottom: 4px; }
.ch-hint img { display: block; max-width: 100%; height: auto; margin: 0 auto; }
button.ch-hint-btn { min-height: 36px; padding: 4px 14px; border-radius: 999px; font-size: 0.9rem; }
/* チャレンジ問題の間違いの答え(講師だけ) */
.ch-wrong { margin-top: 10px; }
.ch-wrong summary { cursor: pointer; font-weight: 600; }
.ch-wrong-item { margin: 8px 0; }
.ch-wrong-item ul { margin: 4px 0 0; padding-left: 1.2em; }
.ch-wrong-label { font-weight: 600; }
/* 並べ方のボタン: 4つ(大問順・新しい順・古い順・分かったが多い順)が、スマホでも1行に収まる大きさにする */
.sort-toggle { gap: 5px; }
.sort-btn { padding: 4px 9px; font-size: 0.85rem; white-space: nowrap; }
/* 「参考になった / もう少し説明がほしい」: 追加の質問の中(幅が少し狭い)でも、数が2桁でも1行に収まるように詰める */
.vote.react { padding: 4px 8px; font-size: 0.85rem; }
/* アクセス数の送り主ごとの表: 管理者の印の付け外しと、記録の削除のボタン */
.access-actions { white-space: nowrap; }
button.access-delete { min-height: 30px; padding: 2px 10px; margin: 2px; font-size: 0.8rem; }
/* みんなの質問と回答の「探す」欄と絞り込み(質問が5件以上のときだけ出る) */
.finder { margin: 4px 0 6px; }
.finder-input { width: 100%; min-height: 40px; padding: 6px 12px; border: 1.5px solid var(--line); border-radius: 999px; font: inherit; background: var(--card); color: var(--fg); }
.finder .sort-toggle { margin-top: 6px; }
/* 分からないボタン: 「分かった」を押した小問にだけ出す「分かったけど、授業でも説明してほしい」 */
.explain-row { flex-basis: 100%; display: flex; align-items: center; gap: 6px; font-size: 0.85rem; cursor: pointer; }
.explain-row input { width: 18px; height: 18px; margin: 0; }
/* 管理画面の集計: 「分かったけど説明してほしい」が1人以上の欄はオレンジ(「分からない」の赤と見分けるため。行が赤くても、この欄だけはオレンジ) */
tr td.explain-cell, tr.hot td.explain-cell, tr.hot.heat1 td.explain-cell, tr.hot.heat2 td.explain-cell, tr.hot.heat3 td.explain-cell {
  background: #ffedd5; color: #c2410c; font-weight: 700;
}
@media (prefers-color-scheme: dark) {
  html:not([data-mode="light"]) tr td.explain-cell, html:not([data-mode="light"]) tr.hot td.explain-cell, html:not([data-mode="light"]) tr.hot.heat1 td.explain-cell, html:not([data-mode="light"]) tr.hot.heat2 td.explain-cell, html:not([data-mode="light"]) tr.hot.heat3 td.explain-cell {
    background: #3a2412; color: #fb923c;
  }
}
/* 「使い方・設定」で「暗い」を選んだとき(上と同じ色) */
html[data-mode="dark"] tr td.explain-cell, html[data-mode="dark"] tr.hot td.explain-cell, html[data-mode="dark"] tr.hot.heat1 td.explain-cell, html[data-mode="dark"] tr.hot.heat2 td.explain-cell, html[data-mode="dark"] tr.hot.heat3 td.explain-cell {
    background: #3a2412; color: #fb923c;
  }

/* 写真の見本の「✏️ 直す」(下に重ねて置く) */
.thumb-edit { position: absolute; left: 4px; bottom: 4px; min-height: 0; padding: 2px 8px; border-radius: 999px; font-size: 0.75rem; background: rgba(255, 255, 255, 0.92); color: #1f2328; border: 1px solid var(--line); }
/* 写真を直す画面(photo-editor.js) */
dialog.pe { width: min(680px, calc(100vw - 16px)); max-height: calc(100vh - 16px); padding: 12px; border: 0; border-radius: 12px; background: var(--card); color: var(--fg); }
dialog.pe::backdrop { background: rgba(0, 0, 0, 0.6); }
.pe-title { margin: 0 0 8px; font-weight: 700; }
.pe-modes { display: flex; gap: 6px; }
.pe-mode { flex: 1; min-height: 40px; }
.pe-mode.on { background: var(--accent); color: var(--on-accent, #fff); border-color: var(--accent); }
.pe-hint { margin: 8px 0; font-size: 0.85rem; color: var(--muted); }
.pe-stage { display: flex; justify-content: center; background: #222; border-radius: 8px; padding: 6px; }
.pe-canvas { display: block; touch-action: none; cursor: crosshair; max-width: 100%; }
.pe-actions { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.pe-spacer { flex: 1; }
/* 写真の見本の「×」と「✏️ 編集」: どちらも写真の内側、同じ白い丸い形にそろえる(×は右上、編集は下に横いっぱい) */
.thumb img { width: 96px; height: 96px; }
.thumb-remove { top: 4px; right: 4px; width: 26px; height: 26px; background: rgba(255, 255, 255, 0.92); color: #1f2328; border: 1px solid var(--line); font-size: 0.9rem; }
.thumb-edit { left: 4px; right: 4px; bottom: 4px; padding: 3px 0; text-align: center; }
/* 写真を編集する画面: スマホでは画面いっぱいに広げる */
dialog.pe { width: calc(100vw - 8px); max-width: 760px; max-height: calc(100vh - 8px); padding: 10px; overflow: auto; }
.pe-modes { gap: 4px; }
.pe-mode { padding: 6px 4px; font-size: 0.9rem; }
.pe-stage { display: block; overflow: auto; text-align: center; padding: 4px; }
.pe-canvas { display: inline-block; max-width: none; vertical-align: top; }
.pe-tools { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
/* 管理画面: 生徒の写真を見やすくする(表示だけに filter を掛ける。admin-q.js の viewTuner) */
.admin-images img { filter: var(--photo-filter, none); }
/* 「調整」は「見やすくする」の下に(横に並ぶと位置がずれて見えるため。2026-10-19 マスター) */
.photo-tune { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin: 6px 0 0; }
/* 押しているときは青地に白字。管理画面のボタン全体の決まり(.admin-page .admin-main button:not(...))に負けないよう、同じ強さで書く */
button.tune-auto.on, .admin-page .admin-main .admin-qa .photo-tune button.tune-auto.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tune-more summary { cursor: pointer; font-size: 0.85rem; padding: 4px 0; }
.tune-more[open] { width: 100%; }
.tune-slider { display: grid; grid-template-columns: 7em 1fr; align-items: center; gap: 8px; margin: 4px 0; font-size: 0.85rem; }
.tune-slider input { width: 100%; }
.pe-zoom { min-height: 40px; min-width: 44px; padding: 0; font-size: 1.2rem; font-weight: 700; }
.pe-zoom-label { min-width: 3.2em; text-align: center; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.pe-actions { justify-content: flex-end; flex-wrap: wrap; }
/* 生徒用ページのボタン全体に付けている position: relative が、写真の上のボタンの位置指定を打ち消していた(×と編集が写真の下にずれていた原因) */
.student .thumb > button.thumb-remove, .student .thumb > button.thumb-edit { position: absolute; }
/* 写真の編集画面: 画面の左右に余白を取り(iPhone の端からのスワイプと重ならないように)、ボタンはダブルタップで拡大しないように */
dialog.pe { width: calc(100vw - 40px); }
dialog.pe button { touch-action: manipulation; }
/* 写真の編集画面(iPhone 対策の続き)
   - 高さは見えている範囲(dvh)で決める。vh だと Safari の上下の帯の下まで含んでしまい、画面が隠れる
   - 画面全体でダブルタップの拡大をしない。押せないボタンは disabled ではなく .off で薄くするだけ(disabled だと指の操作が下のページに抜ける) */
dialog.pe { max-height: calc(100dvh - 24px); touch-action: manipulation; }
dialog.pe .pe-hint { margin: 6px 0; font-size: 0.8rem; }
dialog.pe button.off { opacity: 0.35; }
/* 管理画面の写真: 「✏️ 編集」と「この画像を消す」を横に並べる */
.admin-image-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
/* ホーム画面のアプリで開いたとき(public/device.js)。
   上の端は時計や電池の表示の下でぼやけるので、少し空ける。見出しの隣に再読み込みの「↻」 */
@media (display-mode: standalone) {
  main { padding-top: max(38px, calc(env(safe-area-inset-top, 0px) + 18px)); }
  /* アプリらしく、ボタン・タブ・見出し・カードなどの部品は長押ししても文字が選ばれないようにする(マスター 2026-10-18)。
     質問文・回答・使い方の本文・受付番号は、引用やメモに使うので選べるまま。ブラウザで開いたときは今までどおり */
  body.student :is(button, .tabbar, summary, h1, h2, h3, label, .badge, .round-card,
    .sort-toggle, .page-kind, .page-grade, .sub-link, .back, .pdf-link, .ask-link, .theme-choice, .vote) {
    -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  }
}
.student h1.with-reload { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.student h1.with-reload > span { min-width: 0; }
.student h1 .reload-button {
  flex: none; min-height: 0; width: 36px; height: 36px; padding: 0;
  border: 1px solid var(--line); border-radius: 50%; background: var(--card); color: var(--fg);
  font-size: 1.1rem; line-height: 1; font-weight: 400;
}
/* 回答の通知(public/push.js)。送ったあとの箱と「あなたの質問」の中に置く */
.push-panel { margin: 8px 0 10px; }
.push-panel .push-button { border-color: var(--accent); color: var(--accent); background: var(--bg); font-weight: 600; }
.push-panel .push-button.off { opacity: 0.6; }
.push-panel .ng { color: var(--ng); }
.push-on { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 4px 0; font-size: 0.92rem; }
.student button.link-button { min-height: 0; padding: 0; border: 0; background: none; color: var(--muted); font-size: 0.85rem; text-decoration: underline; }
details.push-guide { margin: 8px 0 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font-size: 0.92rem; }
details.push-guide > summary { cursor: pointer; font-weight: 600; color: var(--accent); }
details.push-guide ol { margin: 6px 0; padding-left: 1.4em; }
details.push-guide li { margin: 4px 0; }
details.push-guide p { margin: 6px 0; }
/* 自分の「分からない」リスト(public/student.js の renderMine)。/s/<KEY>/mine */
.wk-actions .ask-link { flex-basis: auto; }
.wk-stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 6px; }
.wk-stat { padding: 6px 12px; border-radius: 999px; font-size: 0.92rem; }
.wk-stat strong { font-size: 1.15rem; }
.wk-stat.ng { background: var(--hmm-bg); color: var(--hmm); } /* 「分からない」は分からないボタンと同じオレンジ(赤はエラー専用。2026-10-17) */
.wk-stat.ok { background: var(--ok-bg); color: var(--ok); }
.wk-group h2 { font-size: 1rem; }
.wk-list { list-style: none; margin: 0; padding: 0; }
.wk-item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.wk-name { font-weight: 600; }
.wk-actions { display: flex; align-items: center; gap: 12px; }
.student button.wk-done { min-height: 0; padding: 6px 14px; font-size: 0.9rem; }
.wk-done.off { opacity: 0.5; }
.wk-exam { width: 100%; font-size: 0.8rem; color: var(--muted); }
details.wk-done-box { margin: 18px 0 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; }
details.wk-done-box > summary { cursor: pointer; color: var(--ok); font-weight: 600; }
details.wk-done-box .wk-item { padding: 6px 0; }
/* リストから飛んできた小問を、少しだけ光らせる */
.item.flash, .qa.flash { animation: item-flash 2s ease-out; }
/* 復習リストの「あとで見返す」 */
.bm-group h2 { display: flex; align-items: center; gap: 6px; }
.bm-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bm-link { display: flex; flex-direction: column; min-width: 0; text-decoration: none; color: inherit; }
.bm-text { overflow-wrap: anywhere; color: var(--accent); }
button.bm-remove { flex-shrink: 0; min-height: 32px; padding: 2px 12px; font-size: 0.85rem; }
@keyframes item-flash { 0%, 30% { background: var(--ok-bg); } 100% { background: transparent; } }
details.push-guide .push-steps li { margin: 10px 0 14px; }
.push-step-img { display: block; width: 100%; max-width: 220px; height: auto; margin-top: 6px; border: 1px solid var(--line); border-radius: 12px; }
.push-step-sub { display: block; margin-top: 12px; }
details.push-guide p.push-carry { font-weight: 700; color: var(--fg); }
/* ブラウザで開いたときの「ホーム画面に追加」の帯(public/install.js)。ページの中身より上に出す */
.install-banner { max-width: 688px; margin: 12px auto 0; margin-left: max(16px, calc((100% - 688px) / 2)); margin-right: max(16px, calc((100% - 688px) / 2)); padding: 12px 14px; border: 1.5px solid var(--accent); border-radius: 12px; background: var(--card); }
.install-banner p { margin: 0 0 6px; }
.install-title { font-weight: 700; color: var(--accent); }
.install-sub { font-size: 0.9rem; }
.install-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.install-banner button { min-height: 40px; padding: 6px 16px; font-size: 0.95rem; }
.install-banner .install-go { border: 1.5px solid var(--accent); background: var(--accent); color: var(--on-accent, #fff); font-weight: 700; }
.install-banner .install-later { border: 1px solid var(--line); background: var(--bg); color: var(--muted); }
.install-more { margin-top: 10px; font-size: 0.92rem; }
.install-more ol { margin: 6px 0; padding-left: 1.4em; }
.install-more p.push-carry { font-weight: 700; }
.install-more .push-steps li { margin: 10px 0 14px; }
.install-hint { font-size: 0.9rem; font-weight: 600; }
/* 文字の前の小さなアイコン(public/icons.js の icon / withIcon)。文字と同じ大きさ・色で、線だけの SVG */
.ic { display: inline-block; width: 1.15em; height: 1.15em; vertical-align: -0.2em; margin-right: 0.35em; flex-shrink: 0; }
.ic svg { display: block; width: 100%; height: 100%; }
.round-title .ic, .sub-icon .ic { margin-right: 0; }
.challenge-card .round-title .ic { color: #d97706; } /* トロフィーだけオレンジ */
.sparkle .ic { margin: 0; color: #eab308; }

/* 下のタブ(public/nav.js)。いつも画面の下に出す。iPhone の下のホームバーに重ならないよう、その分だけ下を空ける */
body.has-tabs { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: flex; justify-content: center;
  padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  background: var(--card); border-top: 1px solid var(--line); }
.tabbar .tab { flex: 1; max-width: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-height: 56px; padding: 6px 2px; color: var(--muted); text-decoration: none; -webkit-tap-highlight-color: transparent; }
.tabbar .tab-icon { display: flex; }
.tabbar .tab-icon svg { width: 24px; height: 24px; }
.tabbar .tab-icon .f { fill: none; }
.tabbar .tab-label { font-size: 0.7rem; line-height: 1.2; white-space: nowrap; }
.tabbar .tab.on { color: var(--accent); font-weight: 700; }
.tabbar .tab.on .tab-icon .f { fill: currentColor; fill-opacity: 0.18; }
body.has-tabs .toast { bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
@media print { .tabbar { display: none; } }
/* 初めて開いた人への吹き出し(nav.js の showWelcome)。「使い方・設定」のタブの真上に、三角でタブを指す */
.welcome-tip { position: fixed; z-index: 51; bottom: calc(68px + env(safe-area-inset-bottom, 0px)); right: 8px; max-width: min(300px, calc(100vw - 16px));
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border: 2px solid var(--accent); border-radius: 12px;
  background: var(--card); color: var(--fg); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2); font-size: 0.9rem; line-height: 1.5; }
.welcome-tip p { margin: 0; }
/* 三角は、枠の色の三角の上に地の色の三角を重ねて、枠つきに見せる(テーマの色が変わっても読めるように、地はカードの色) */
.welcome-tip::before, .welcome-tip::after { content: ''; position: absolute; right: var(--arrow-right, 24px); border: 8px solid transparent; border-bottom: 0; }
.welcome-tip::before { bottom: -10px; border-top-color: var(--accent); }
.welcome-tip::after { bottom: -7px; border-top-color: var(--card); }
button.welcome-close { flex-shrink: 0; min-height: 32px; padding: 2px 12px; font-size: 0.85rem; }
@media print { .welcome-tip { display: none; } }
/* カードを画像にするときの台紙(public/share-image.js)。画面の外に置き、テーマや暗い表示に関係なく白い地・決まった幅で描く */
.export-frame { position: fixed; left: -10000px; top: 0; width: 600px; padding: 20px 20px 10px;
  --bg: #ffffff; --card: #ffffff; --fg: #1f2328; --muted: #656d76; --line: #d0d7de; --accent: #2f80d1;
  background: #ffffff; color: #1f2328; }
.export-frame .qa { margin: 0; box-shadow: none; }
.export-foot { margin: 8px 0 0; text-align: right; font-size: 0.8rem; color: #656d76; }
/* 自分の質問と回答をまとめて印刷・PDF(question.js の renderPrint)。ボタン類は紙に出さず、カードの途中でページを分けない */
@media print {
  .no-print, .install-banner, .qa-head-end button, .reload-button { display: none !important; }
  .print-list .qa { break-inside: avoid; box-shadow: none; }
}
/* 使い方のページ(question.js の renderGuide) */
/* 「使い方・設定」の設定(テーマの色)。色の見本は丸の中に地の色、ふちにアクセントの色 */
.settings { margin-top: 28px; }
.settings h2 { font-size: 1.1rem; margin: 0 0 8px; }
.settings-label { margin: 0 0 8px; font-weight: 600; }
.theme-choices { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.theme-choice { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px; min-height: 44px;
  background: var(--card); color: var(--fg); border: 1px solid var(--line); border-radius: 12px; font-size: 0.75rem; cursor: pointer; }
.theme-swatch { width: 28px; height: 28px; border-radius: 50%; background: var(--sw-bg); border: 4px solid var(--sw-accent); }
.theme-choice[aria-pressed="true"] { border: 2px solid var(--accent); font-weight: 700; padding: 7px 1px; }
.settings-note { font-size: 0.8rem; margin-top: 8px; }
/* どの通知を受け取るかのチェック(押しやすいよう、1行ずつ高さを取る) */
.notice-prefs { margin: 10px 0 12px; }
.notice-pref { display: flex; align-items: center; gap: 10px; min-height: 40px; font-size: 0.95rem; }
.notice-pref input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.guide-sec ul, .guide-sec ol { margin: 6px 0; padding-left: 1.3em; }
.guide-sec li { margin: 6px 0; }
.guide-sec .push-steps li { margin: 10px 0 14px; }
.caution-inline { color: inherit; } /* 太字だけ。赤はエラー専用にした(2026-10-17) */
/* 使い方のページは、見出しを押すと開く形(2026-10-16 マスター) */
details.guide-sec { margin: 10px 0; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
details.guide-sec > summary { position: relative; padding: 14px 36px 14px 14px; font-weight: 700; font-size: 1.02rem; cursor: pointer; list-style: none; }
details.guide-sec > summary::-webkit-details-marker { display: none; }
details.guide-sec > summary::after { content: '▼'; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 0.75rem; opacity: 0.6; }
details.guide-sec[open] > summary::after { content: '▲'; }
details.guide-sec > :not(summary) { margin-left: 14px; margin-right: 14px; }
details.guide-sec > :last-child { margin-bottom: 12px; }
/* タブが5つになったので、字を少し小さく */
.tabbar .tab-label { font-size: 0.66rem; letter-spacing: -0.02em; } /* タブが5つなので、字を少し小さく */
/* 分からないボタンの一覧(student.js の renderList)。質問箱の入口と同じカードを、科目ごとに */
.badge.ng-badge { background: var(--hmm-bg); color: var(--hmm); font-weight: 600; }
section.subject h2.sub-title { margin-top: 18px; font-size: 1rem; font-weight: 700; color: var(--fg); }
/* チャレンジ問題の難しさの目安(public/challenge.js の LEVELS) */
details.ch-levels { margin: -6px 0 14px; font-size: 0.88rem; }
details.ch-levels > summary { cursor: pointer; color: var(--accent); }
details.ch-levels ul { margin: 6px 0 0; padding-left: 0; list-style: none; }
details.ch-levels li { margin: 2px 0; }

/* みんなの質問と回答: 回の見出しの横の「この回に質問する」(2026-10-17) */
.qa-round-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px;
  margin: 24px 0 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.qa-round-head h2 { margin: 0 auto 0 0; padding: 0; border: none; }
.qa-ask-link { display: inline-flex; align-items: center; min-height: 40px; padding: 4px 14px; border: 1.5px solid var(--accent); border-radius: 999px;
  background: var(--card); color: var(--accent); font-size: 0.9rem; font-weight: 600; white-space: nowrap; text-decoration: none; }

/* ---- 開け閉め・ページ移動の記号を、線のアイコン(Lucide の chevron)にそろえる(2026-10-17、天秤AIレビュー) ----
   以前は ▼▲(右端)・▶(左端、ブラウザの既定)・›(文字)が混ざっていた。
   開け閉めは右(または文の後ろ)の下向き矢印で、開くと上向きに回る。ページ移動は右端の右向き矢印。色は文字の色に合わせる */
body.student { --chev-down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); --chev-right: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E"); }
body.student summary { list-style: none; }
body.student summary::-webkit-details-marker { display: none; }
/* 右端に置くもの(カードの形の箱) */
body.student details.mine-box > summary::after,
body.student details.kyotsu-box > summary::after,
body.student details.guide-sec > summary::after,
body.student details.ch-old > summary::after,
body.student details.guide > summary.sub-link::after,
body.student details.howto > summary::after,
body.student details.wk-done-box > summary::after {
  content: ''; width: 18px; height: 18px; font-size: 0; opacity: 0.6; background: currentColor;
  -webkit-mask: var(--chev-down) center / contain no-repeat; mask: var(--chev-down) center / contain no-repeat;
  transition: transform 0.2s;
}
body.student details[open].mine-box > summary::after,
body.student details[open].kyotsu-box > summary::after,
body.student details[open].guide-sec > summary::after,
body.student details[open].ch-old > summary::after,
body.student details[open].guide > summary.sub-link::after,
body.student details[open].howto > summary::after,
body.student details[open].wk-done-box > summary::after { content: ''; transform: translateY(-50%) rotate(180deg); }
body.student details.ch-old > summary::after { top: 2px; }
body.student details[open].ch-old > summary::after { transform: rotate(180deg); }
body.student details.howto > summary, body.student details.wk-done-box > summary { position: relative; padding-right: 32px; }
body.student details.howto > summary::after, body.student details.wk-done-box > summary::after { position: absolute; right: 0; top: 50%; transform: translateY(-50%); }
/* 文の後ろに置くもの(リンクのような小さい開け閉め) */
body.student details.ch-levels > summary::after,
body.student details.push-guide > summary::after {
  content: ''; display: inline-block; width: 1em; height: 1em; margin-left: 0.3em; vertical-align: -0.15em; background: currentColor;
  -webkit-mask: var(--chev-down) center / contain no-repeat; mask: var(--chev-down) center / contain no-repeat; transition: transform 0.2s;
}
body.student details[open].ch-levels > summary::after,
body.student details[open].push-guide > summary::after { transform: rotate(180deg); }
/* ページ移動(入口のカード・「受付番号で回答を見る」) */
body.student .round-card::after, body.student .sub-link::after {
  content: ''; width: 20px; height: 20px; font-size: 0; background: currentColor;
  -webkit-mask: var(--chev-right) center / contain no-repeat; mask: var(--chev-right) center / contain no-repeat;
}
body.student details.guide > summary.sub-link::after { width: 18px; height: 18px; }

/* ---- 折り返しはブラウザに任せる ----
   2026-10-17 に見出しや短い説明文へ text-wrap: pretty を付けたが、iPhone の Safari では日本語の行が途中で不自然に切れ、
   右側が大きく空いた(マスター)。外して、ふつうの折り返しに戻した。
   改行の位置を自分で決める(<br> や折り返さない指定)のもしない。端末ごとに横幅が違い、かえって変な所で割れるため */

/* 見出しの上の小さい灰色の字(ページの種類: 「質問箱」「分からないボタン」)。見出しは名前だけにする(2026-10-17) */
.page-kind { margin: 0 0 2px; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
/* どの学年のページか(「高1のページ」)。見出しの上に小さく。ほかの学年の URL に気づけるように(2026-11-17) */
.page-grade { margin: 0 0 2px; font-size: 0.85rem; font-weight: 600; color: var(--muted); }

/* 「使い方・設定」で明るさを選んだとき、入力欄やスクロールバーなどブラウザが描く部品の色もそろえる */
html[data-mode="dark"] { color-scheme: dark; }
html[data-mode="light"] { color-scheme: light; }
.settings-label + .theme-choices + .settings-label { margin-top: 16px; }
.mode-choices { grid-template-columns: repeat(3, 1fr); }
.mode-choice { min-height: 44px; font-size: 0.9rem; }

/* 添削の回の「この回の問題」(round-notes.js)。見出しの下に小さく折りたたんで出す */
details.round-notes { margin: 0 0 12px; font-size: 0.9rem; color: var(--muted); }
details.round-notes > summary { cursor: pointer; font-weight: 600; }
body.student details.round-notes > summary::after {
  content: ''; display: inline-block; width: 1em; height: 1em; margin-left: 0.3em; vertical-align: -0.15em; background: currentColor;
  -webkit-mask: var(--chev-down) center / contain no-repeat; mask: var(--chev-down) center / contain no-repeat; transition: transform 0.2s;
}
body.student details[open].round-notes > summary::after { transform: rotate(180deg); }
details.round-notes ul { margin: 6px 0 0; padding-left: 1.2em; color: var(--fg); }
details.round-notes li { margin: 3px 0; }
/* みんなの質問と回答の「質問箱への要望・不具合も表示する」(2026-10-17) */
.qa-include { display: flex; align-items: center; gap: 6px; margin: 6px 0 10px; font-size: 0.9rem; color: var(--muted); }
.qa-include input { width: 18px; height: 18px; }
.test-push { margin-top: 8px; }

/* 講師のアカウント(2026-10-18)。講師でログインしたときは、管理者だけの欄・ボタンを隠す(サーバーの側でも断る) */
body.role-teacher .owner-only { display: none !important; }
/* 設定の「合言葉を変える」(講師だけ) */
.pw-field { display: grid; gap: 4px; margin: 0 0 10px; max-width: 22em; font-size: 0.9rem; }
.pw-input { min-height: 38px; padding: 4px 10px; }
/* 講師だけに見せる欄(設定の「あなたの Discord」) */
body:not(.role-teacher) .teacher-only { display: none !important; }
/* 回答の下の「解説のこの問題のページ」(qa.js の pageLinkOf。2026-10-19) */
.qa-page-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; font-size: 0.85rem; }
/* 設定の Discord の通知: ユーザーIDの欄(admin-settings.js の renderDiscord) */
.discord-id { width: 100%; max-width: 22em; min-height: 36px; padding: 4px 10px; font-variant-numeric: tabular-nums; }
/* 管理画面: ほかの人が回答を書いているときの一言(admin-q.js の writingNote。2026-10-19) */
.writing-note { margin: 6px 0; padding: 8px 12px; border: 1.5px solid var(--accent); border-radius: 8px; background: var(--card); font-size: 0.9rem; }
.issued-box { margin: 8px 0 12px; padding: 10px 12px; border: 2px solid var(--accent); border-radius: 10px; background: var(--card); }
.issued-box pre { margin: 6px 0; padding: 8px; background: var(--bg); border-radius: 6px; font-size: 1rem; white-space: pre-wrap; }
.issued-box button { margin-right: 6px; }
.teacher-add { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.teacher-add input { flex: 1 1 140px; min-width: 0; }
/* 講師の申し込み(2026-10-20、admin-settings.js の renderApplications) */
.apply-box { margin: 8px 0 14px; padding: 10px 12px; border: 2px solid var(--accent); border-radius: 10px; background: var(--card); }
.apply-box h3 { margin: 0 0 4px; font-size: 1rem; }
.apply-row { padding: 8px 0; border-top: 1px solid var(--line); }
.apply-row p { margin: 4px 0; }
.apply-who { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.apply-avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; }
.apply-avatar.none { display: inline-flex; align-items: center; justify-content: center; background: var(--bg); color: var(--muted); font-weight: 700; }
.apply-row .teacher-add { margin-top: 6px; }
.apply-row > div:last-child { margin-top: 6px; }
#login-form label { display: block; margin-bottom: 8px; }

/* 入口の教科の見出し(数学以外の教科の質問箱があるときだけ出る。2026-10-18) */
.subject-head { margin: 22px 0 8px; font-size: 1.05rem; color: var(--muted); }
.subject-head.small { margin: 18px 0 4px; font-size: 1rem; color: var(--text, inherit); }
/* 講師ごとのフォルダと月の見出し(2026-10-20) */
.lesson-head { margin: 14px 0 6px; font-size: 0.9rem; color: var(--muted); }
.folder-box { border: 1px solid var(--line); border-radius: 12px; background: var(--card); margin: 8px 0; padding: 0 12px; }
.folder-box > summary { padding: 12px 0; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.folder-title { font-weight: 600; }
.month-box > summary { padding: 6px 0; color: var(--muted); font-size: 0.9rem; cursor: pointer; }
.month-box .round-list { margin-bottom: 8px; }
.folder-box .pinned-list { margin-bottom: 8px; }
/* 講師のフォルダは右端に、月の見出しは文の後ろに、開け閉めの印(ほかの畳む箱と同じ形。押せると分かるように) */
.folder-box > summary, .month-box > summary { list-style: none; }
.folder-box > summary::-webkit-details-marker, .month-box > summary::-webkit-details-marker { display: none; }
.folder-box > summary { position: relative; padding-right: 32px; }
.folder-box > summary::after {
  content: ''; position: absolute; right: 2px; top: 50%; width: 18px; height: 18px; opacity: 0.6; background: currentColor;
  -webkit-mask: var(--chev-down) center / contain no-repeat; mask: var(--chev-down) center / contain no-repeat;
  transform: translateY(-50%); transition: transform 0.2s;
}
.folder-box[open] > summary::after { transform: translateY(-50%) rotate(180deg); }
.month-box > summary::after {
  content: ''; display: inline-block; width: 1em; height: 1em; margin-left: 0.3em; vertical-align: -0.15em; background: currentColor;
  -webkit-mask: var(--chev-down) center / contain no-repeat; mask: var(--chev-down) center / contain no-repeat; transition: transform 0.2s;
}
.month-box[open] > summary::after { transform: rotate(180deg); }

/* 教材を足す(管理画面。public/admin-contents.js、2026-10-18) */
.cc-form { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.cc-form h3 { font-size: 1rem; margin: 0 0 8px; }
.cc-field { margin: 12px 0; }
.cc-label { font-weight: 600; font-size: 0.9rem; margin-bottom: 4px; }
.cc-radios { display: flex; flex-direction: column; gap: 4px; }
.cc-radio .note { display: block; margin-left: 1.6em; }
.cc-wide { width: 100%; }
.cc-num { width: 5em; }
.cc-daimon-row { margin: 8px 0; padding: 8px; border-radius: 8px; background: var(--bg); }
.cc-labels, .cc-sample-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }
.cc-label-input { width: 6em; }
.cc-blank-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; align-items: center; }
.cc-blank-row input:not(.cc-label-input) { flex: 1 1 8em; min-width: 0; }
.cc-sample { padding: 8px 10px; border-radius: 8px; background: var(--bg); border: 1px dashed var(--line); }
.cc-sample p { margin: 4px 0; }
.cc-sample-daimon { font-weight: 600; min-width: 4.5em; }
.cc-chip { padding: 2px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 0.9rem; }
.teacher-subjects label { display: inline-flex; align-items: center; gap: 2px; margin-right: 8px; }
#teachers .access-table { max-width: none; }
.teacher-display { width: 9em; }
.access-table.cc-table { max-width: none; }
/* 教材の一覧と講師の表は数の表ではないので、見出しも左にそろえる(.access-table は2列目から右寄せにしている) */
.access-table.cc-table th, #teachers .access-table th { text-align: left; }

/* 解説 PDF を指定のページから読む画面(public/viewer.js、2026-10-18) */
body.viewer { background: #525659; }
.viewer-bar { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top)); background: var(--bg); border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.viewer-raw { font-size: 0.85rem; }
.viewer-pages { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 10px 0 40px; }
.viewer-frame { width: min(100%, 900px); background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); scroll-margin-top: 48px; }
.viewer-frame canvas { display: block; width: 100%; height: auto; }
.viewer-msg { color: #fff; padding: 24px 16px; }

/* 管理画面の骨組み(2026-10-18 作り直し)。900px 以上は左の縦メニュー、未満は画面の下の4つのボタン(生徒画面の下のタブと同じ形) */
.admin-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; }
.admin-bar h1 { margin: 0; }
.admin-me { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.admin-nav a { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 8px; color: var(--fg); text-decoration: none; font-weight: 600; }
.admin-nav a[aria-current="page"] { background: var(--accent); color: #fff; }
.nav-icon { display: flex; }
.nav-icon svg { width: 22px; height: 22px; }
.nav-icon .f { fill: none; }
.nav-badge { min-width: 1.5em; padding: 0 6px; border-radius: 999px; background: var(--ng); color: #fff; font-size: 0.75rem; line-height: 1.5; text-align: center; }
.admin-view > h2:first-child, .admin-view > :first-child { margin-top: 0; }
.note-more summary { cursor: pointer; color: var(--muted); font-size: 0.85rem; }
@media (min-width: 900px) {
  #panel { display: grid; grid-template-columns: 170px minmax(0, 1fr); grid-template-areas: "bar bar" "nav main"; gap: 16px 24px; }
  #panel[hidden] { display: none; }
  .admin-bar { grid-area: bar; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
  .admin-nav { grid-area: nav; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 12px; align-self: start; }
  .admin-main { grid-area: main; min-width: 0; }
}
@media (max-width: 899.98px) {
  .admin-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(var(--nav-n, 5), 1fr);
    padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
    background: var(--card); border-top: 1px solid var(--line); }
  .admin-nav a { position: relative; flex-direction: column; justify-content: center; gap: 1px; min-height: 56px; padding: 6px 2px; border-radius: 0;
    color: var(--muted); font-size: 0.75rem; -webkit-tap-highlight-color: transparent; }
  .admin-nav a[aria-current="page"] { background: none; color: var(--accent); font-weight: 700; }
  .admin-nav a[aria-current="page"] .nav-icon .f { fill: currentColor; fill-opacity: 0.18; }
  .admin-nav .nav-badge { position: absolute; top: 4px; left: calc(50% + 6px); }
  .admin-main { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
  body:has(#panel:not([hidden])) .toast { bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
  .admin-bar h1 { font-size: 1.2rem; }
  /* 幅の足りない表は、表の中だけ横に送る(ページ全体ははみ出さない) */
  .admin-main table { display: block; max-width: 100%; overflow-x: auto; }
}
@media print { .admin-nav, .admin-bar { display: none !important; } }

/* 質問: 1件1行の一覧と中身(900px 以上は左右に並べる。未満は中身を画面いっぱいに。2026-10-18) */
.q-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.q-tabs button { border-radius: 999px; min-height: 40px; padding: 6px 14px; }
.q-tabs button[aria-selected="true"] { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.q-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.q-filters select { max-width: 100%; }
.q-filters input[type="search"] { flex: 1 1 220px; min-width: 0; }
.q-list { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.q-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; width: 100%; text-align: left; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--fg); font: inherit; cursor: pointer; }
.q-row:hover { border-color: var(--accent); }
.q-row.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.q-row-where { font-weight: 600; overflow-wrap: anywhere; }
.q-row-date { color: var(--muted); font-size: 0.8rem; }
.q-row-body { grid-column: 1 / -1; color: var(--muted); font-size: 0.9rem; overflow-wrap: anywhere; }
.q-row-marks { grid-column: 1 / -1; color: var(--accent); font-size: 0.8rem; }
.q-more { margin-top: 4px; }
.q-back { margin-bottom: 8px; }
.q-detail { min-width: 0; }
.q-detail .qa { margin-top: 0; }
.q-detail-head { margin-bottom: 6px; overflow-wrap: anywhere; }
/* 中身の画面は狭いので、質問の上に回答を重ねる(左右に並べない) */
.q-detail .qa-grid { grid-template-columns: minmax(0, 1fr); }
.q-detail .qa-left { position: static; }
.q-student-link { margin-top: 16px; }
@media (min-width: 900px) {
  #view-questions.has-detail .q-split { display: grid; grid-template-columns: minmax(240px, 2fr) minmax(0, 3fr); gap: 16px; align-items: start; }
  #view-questions.has-detail .q-detail { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
  .q-back { display: none; }
}
@media (max-width: 899.98px) {
  #view-questions.has-detail :is(.q-tabs, .q-filters, .q-list, .q-student-link) { display: none; }
  /* 「回答して公開」は画面の下に固定(下のメニューの上) */
  .q-detail .sticky-actions { bottom: calc(57px + env(safe-area-inset-bottom, 0px)); z-index: 5; flex-wrap: wrap; }
}
/* 上のバーのログアウトは文字のリンクの形で小さく(2026-10-18) */
.admin-me .link-button { min-height: 32px; padding: 2px 4px; border: 0; background: none; color: var(--accent); font-size: 0.85rem; text-decoration: underline; }
@media (max-width: 899.98px) {
  /* スマホ・縦向きでは「ほかの端末のログインを切る」は設定の中に置く(上のバーを短く) */
  .admin-me #logout-others { display: none; }
}

/* 教材(2026-10-18)。一覧は 700px 未満で1件1枚のカード(表は横にはみ出すため)。
   足す・直すフォームは 900px 以上なら一覧の右、未満なら画面いっぱいに開く */
.pane-tabs button[aria-selected="true"] { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.cc-back { margin-bottom: 8px; }
.cc-form-box .cc-form { margin-top: 0; }
@media (max-width: 699.98px) {
  .cc-table thead { display: none; }
  .admin-main .cc-table, .cc-table tbody, .cc-table tr, .cc-table td { display: block; overflow: visible; }
  .cc-table tr { margin-bottom: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
  .cc-table td { border: 0; padding: 2px 0; text-align: left; }
  .cc-table td.cc-title { font-weight: 600; }
  .cc-table td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 0.8rem; margin-right: 8px; }
  .cc-table td.access-actions { margin-top: 6px; }
}
@media (min-width: 900px) {
  #contents.cc-open { display: grid; grid-template-columns: minmax(0, 2fr) minmax(360px, 3fr); gap: 16px; align-items: start; }
  #contents.cc-open .cc-form-box { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
  .cc-back { display: none; }
  /* フォームを開いているあいだは、左の一覧もカードの形に(表のままだと狭い) */
  #contents.cc-open .cc-table thead { display: none; }
  #contents.cc-open :is(.cc-table, .cc-table tbody, .cc-table tr, .cc-table td) { display: block; }
  #contents.cc-open .cc-table tr { margin-bottom: 8px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
  #contents.cc-open .cc-table td { border: 0; padding: 2px 0; text-align: left; }
  #contents.cc-open .cc-table td.cc-title { font-weight: 600; }
  #contents.cc-open .cc-table td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 0.8rem; margin-right: 8px; }
}
@media (max-width: 899.98px) {
  #contents.cc-open .cc-form-box { position: fixed; inset: 0; z-index: 30; overflow: auto; background: var(--bg);
    padding: max(12px, env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom, 0px)); }
  #contents.cc-open .cc-form-box .cc-form { border: 0; padding: 0; background: none; }
}
.cc-add { margin: 8px 0 10px; }

/* 集計: 分からないボタン(2026-10-18 に /admin から移した)。横棒は 分からない=オレンジ・分かった=青 */
#st-summary[hidden] { display: none; }
.st-table { width: 100%; border-collapse: collapse; }
.st-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.st-table th:not(:first-child) { text-align: right; }
.st-bar { width: 30%; min-width: 60px; }
.st-table tr > :first-child { min-width: 3em; }
.st-bar-line { display: block; height: 7px; min-width: 0; border-radius: 4px; margin: 2px 0; }
.st-bar-line.ng { background: #f08c00; }
.st-bar-line.ok { background: var(--accent); }
/* スマホの幅では横棒の列をやめ、小問の字の下に横棒を出す(列が多いと、小問や見出しの字が変な所で折り返すため。2026-10-18 マスター) */
.st-bar-inline { display: none; }
.st-reasons { display: block; margin-top: 2px; font-size: 0.78rem; font-weight: 400; color: var(--muted); }
/* 集計の表は横いっぱいに広げる(はみ出すとき=回ごとに比べる表示は、外の .table-wrap の中だけ横に送る) */
.admin-main .st-table { display: table; }
@media (max-width: 599.98px) {
  .st-table :is(.st-bar, .st-bar-head) { display: none; }
  .st-bar-inline { display: block; margin-top: 4px; }
  /* 欄の左右の余白を詰める(iPhone の字は幅が広く、見出しが2行になりやすい) */
  .st-table :is(th, td) { padding-left: 4px; padding-right: 4px; }
}
.st-qr-box { margin-top: 16px; }
.st-qr-box summary { cursor: pointer; font-weight: 600; }
.st-report-link { margin-top: 20px; }

/* 設定(2026-10-18)。欄を上から並べる。講師の表は 700px 未満で1人1枚のカード(.cc-table) */
.settings-block { margin: 0 0 28px; }
.settings-block > h2 { margin-top: 0; }
.note-more { margin: 2px 0 10px; }
.note-more[open] summary { margin-bottom: 4px; }
.teacher-table td[data-label="担当の教科"]::before { display: block; }
@media (max-width: 699.98px) {
  .teacher-table .teacher-display { width: 100%; max-width: 16em; }
  .teacher-table td.teacher-subjects label { min-height: 40px; margin-right: 14px; }
  .teacher-table td.teacher-subjects input { width: 20px; height: 20px; margin: 0 4px 0 0; }
}

/* ---- 管理画面の見た目を整える(2026-10-18 マスター「右側が無骨」)。薄い灰色の地に、白い枠(パネル)を並べる ---- */
body.admin-page { --page: #f3f5f8; --panel: #ffffff; --panel-shadow: 0 1px 2px rgba(31, 35, 40, 0.05), 0 2px 6px rgba(31, 35, 40, 0.06); background: var(--page); }
@media (prefers-color-scheme: dark) {
  html:not([data-mode="light"]) body.admin-page { --page: #0d1117; --panel: #161b22; --panel-shadow: none; }
}
html[data-mode="dark"] body.admin-page { --page: #0d1117; --panel: #161b22; --panel-shadow: none; }
.admin-page .admin-bar { border-bottom-color: transparent; }
.admin-page .admin-bar h1 { font-size: 1.3rem; letter-spacing: 0.02em; }
.admin-page .student-link { padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); font-size: 0.85rem; text-decoration: none; }
/* 再読み込み(上のバー。生徒画面を見るの札と同じ形) */
.admin-page .reload-button { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--accent); font-size: 0.85rem; font-weight: 600; }
.admin-page .reload-button svg { width: 16px; height: 16px; }
/* 表示ごとの見出し */
.view-head { margin: 0 0 14px; }
.view-head h2 { margin: 0; padding: 0; border: 0; font-size: 1.35rem; }
.view-head .note { margin: 2px 0 0; }
/* 枠(パネル) */
.admin-page :is(.contents-pane, .settings-block) { margin: 0 0 16px; padding: 16px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--panel-shadow); }
.admin-page .settings-block > h2 { font-size: 1.05rem; }
/* 切り替え(質問・教材・集計の中)は、左のメニューと見分けやすいよう、灰色の溝に白い札の形(セグメント) */
.admin-page .q-tabs { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 4px; margin: 0 0 12px; border-radius: 12px; background: color-mix(in srgb, var(--line) 55%, transparent); }
.admin-page .q-tabs button { min-height: 36px; padding: 4px 14px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 600; }
/* 選んでいるものは青く塗る(白い札だと分かりにくかった。2026-10-18 マスター) */
.admin-page .q-tabs button[aria-selected="true"] { background: var(--accent); color: #fff; box-shadow: 0 1px 3px rgba(31, 35, 40, 0.15); }
/* 入力欄・選ぶ欄・ボタンの高さと角をそろえる */
.admin-page .admin-main :is(select, input[type="text"], input[type="search"], input[type="url"], input[type="number"], input[type="date"], textarea) { min-height: 38px; border-radius: 8px; background: var(--panel); }
.admin-page .admin-main button:not(.q-row):not(.small):not(.link-button) { min-height: 38px; }
/* 切り替えのボタン(role=tab)は除く。含めると、選んでいるものの青がこの白で消えてしまう(2026-10-18 マスター指摘) */
.admin-page .admin-main button:not(.primary):not(.q-row):not([role="tab"]) { background: var(--panel); }
/* 質問の一覧と中身 */
.admin-page .q-row { background: var(--panel); border-color: var(--line); box-shadow: var(--panel-shadow); border-radius: 12px; }
.admin-page .q-row.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.admin-page .q-detail .qa { padding: 14px 16px; background: var(--panel); border-radius: 14px; box-shadow: var(--panel-shadow); }
.admin-page .q-detail .sticky-actions { background: var(--panel); }
.admin-page .q-detail-head strong { font-size: 1.05rem; }
/* 表: 見出しは小さく灰色、行の区切りは薄く */
.admin-page .admin-main table th { color: var(--muted); font-weight: 600; font-size: 0.8rem; }
.admin-page .admin-main tbody tr:hover > td { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.admin-page .note-more summary { display: inline-block; padding: 2px 0; color: var(--accent); }
@media (max-width: 899.98px) {
  .admin-page .admin-nav { background: var(--panel); }
  .admin-page :is(.contents-pane, .settings-block) { padding: 14px; }
  .admin-page #contents.cc-open .cc-form-box { background: var(--page); }
  /* 切り替えは折り返さず、横に並べる(字が長いときはボタンの中で折り返す) */
  /* 横いっぱいに並べ、字の長いボタンほど広くする(同じ幅にすると「分からないボタン」が2行になったため。2026-10-18 マスター) */
  .admin-page .q-tabs { display: flex; flex-wrap: nowrap; width: 100%; }
  .admin-page .q-tabs button { flex: 1 1 auto; }
  .admin-page .q-tabs button { padding: 4px 6px; font-size: 0.85rem; line-height: 1.3; }
  .admin-page .view-head { margin-top: 12px; }
}

/* Q&A の蔵(過去の質問と回答。question.js の renderArchive、2026-10-19) */
.archive-card { margin: 8px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.archive-card .note { margin: 0 0 6px; }
.archive-q, .archive-a { margin: 4px 0; line-height: 1.7; white-space: pre-wrap; }

/* パスキーのボタン(2026-10-21、ログイン画面とリンクのページ)。押しやすい大きさで、幅いっぱい */
.pk-login { display: block; width: 100%; font-size: 1.1rem; padding: 14px; margin: 16px 0 8px; }
.owner-pw { margin-top: 20px; }
.owner-pw summary { cursor: pointer; color: var(--muted); }
.passkey-list { padding-left: 1.2em; }
.passkey-row { margin: 6px 0; }
.passkey-row .small { margin-left: 4px; }
/* 定期テスト前の質問箱の札(2026-10-25)。入口のいちばん上で目立たせる */
.teiki-list .round-card { border: 2px solid var(--accent); background: var(--card); }

/* 先生のページ(2026-10-25)。管理者と先生の印の講師だけに出す */
body:not(.can-head) .head-only { display: none !important; }
.head-grade { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 14px 0; background: var(--bg); }
.head-grade h3 { margin: 0 0 8px; }
.head-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.head-tile { background: var(--card); border-radius: 8px; padding: 8px 10px; }
.head-tile .big { font-size: 1.4rem; font-weight: bold; }
/* 札の「先月 ◯」と、何を数えたかの一言(2026-11-02) */
.head-tile-prev { font-size: 0.8rem; color: var(--muted); }
.head-tile-sub { font-size: 0.75rem; color: var(--muted); margin-top: 2px; line-height: 1.4; }
/* 今の回答待ち。あるときは枠で目立たせる */
.head-pending { margin: 0 0 8px; font-size: 0.9rem; }
.head-pending.has { padding: 6px 10px; border: 1.5px solid var(--accent); border-radius: 8px; background: var(--card); }
.head-report-link { margin: 0 0 10px; }
/* 生徒の様子の「授業アンケート」のタブ(2026-11-02 の組み直し)。ダークモードでも紙の色(report.css の色に合わせる) */
.admin-page #enquete-body { color-scheme: light; --bg: #ffffff; --fg: #1f2328; --muted: #5c6470; --line: #d9dee4; --card: #f6f8fa; --accent: #2a78d6;
  background: #fff; color: var(--fg); border-radius: 10px; }
.admin-page #enquete-body .r-body { padding: 14px 16px; }
.admin-page #enquete-body h1 { font-size: 1.4rem; }
/* 中の欄に枠がある箱は、外の枠を消す(二重の枠にしない) */
.admin-page :is(#settings-you, #settings-admin, #sheets-pane) { padding: 0; background: none; border: 0; box-shadow: none; }
/* ホーム(2026-11-02 の組み直し) */
.home-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 0 0 12px; background: var(--card); }
.home-card h3 { margin: 0 0 6px; font-size: 1rem; }
.home-now-todo { border: 1.5px solid var(--accent); }
.home-todo { margin: 0 0 8px; }
.home-card-head { display: flex; justify-content: space-between; align-items: baseline; }
.home-start ol { margin: 4px 0 0; padding-left: 1.4em; line-height: 1.9; }
.home-shortcuts { display: flex; flex-wrap: wrap; gap: 8px; }
/* ホームの中の「今の様子」は、外の枠(home-card)があるので、内側の枠線を消す */
.home-now-wrap .head-now { border: 0; padding: 0; margin: 0; background: none; }
.head-report-button { display: inline-block; padding: 6px 12px; border: 1.5px solid var(--accent); border-radius: 8px; background: var(--card); font-weight: 600; text-decoration: none; }
/* 先生のページの「今の様子」(選んだ月によらない今の回答待ち。3日以上待っている学年は目立たせる) */
.head-now { border: 1.5px solid var(--accent); border-radius: 10px; padding: 10px 14px; margin: 10px 0 14px; background: var(--card); }
.head-now h3 { margin: 0 0 6px; font-size: 1rem; }
.head-now-grade + .head-now-grade { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.head-now-pending { margin: 0 0 4px; }
.head-test-box summary { cursor: pointer; color: var(--accent); font-size: 0.9rem; }
.head-test-box[open] summary { margin-bottom: 6px; }
.head-now .head-test { margin-top: 4px; }
.head-now-old { color: var(--ng); font-weight: 600; }
.head-now .note a { margin-left: 8px; }
/* 公開ボタンの横の「押すと何が起きるか」 */
.publish-note { font-size: 0.8rem; }
/* ログイン画面の案内(だれ向けかで分ける) */
.login-help p { margin: 10px 0; }
/* 写真の編集画面の注意書き(管理画面で生徒の写真を上書きするとき。2026-11-02) */
.pe-note { margin: 6px 0 0; font-size: 0.85rem; color: var(--ng); }
/* 開いているあいだに届いた新しい質問の知らせ(admin-q.js) */
.q-fresh { display: block; width: 100%; margin: 0 0 8px; padding: 8px 12px; border: 1.5px solid var(--accent); border-radius: 8px; background: var(--card); color: var(--accent); font-weight: 600; text-align: left; cursor: pointer; }
/* 教材の確認画面の「保存するとすぐ生徒に見えます」 */
.cc-publish { margin: 10px 0; padding: 8px 12px; border-left: 4px solid var(--accent); background: var(--card); font-weight: 600; font-size: 0.9rem; }
.head-list { padding-left: 1.2em; margin: 6px 0; }
.head-test { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---- 授業アンケート(enquete.html。2026-10-30) ---- */
.eq-form { margin-top: 8px; }
.eq-q { margin: 18px 0; }
.eq-label { margin: 0 0 8px; font-size: 1.05rem; }
.eq-hint { margin-left: 8px; font-weight: 400; }
.eq-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.eq-choice { min-height: 44px; padding: 6px 14px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--card); color: var(--fg); font: inherit; }
.eq-choice.on { border-color: var(--accent); background: var(--accent); color: var(--on-accent, #fff); font-weight: 600; }
.eq-stars .eq-choice { flex: 1; max-width: 64px; padding: 6px 0; font-size: 1.5rem; line-height: 1; color: var(--muted); }
.eq-stars .eq-choice.on { color: var(--on-accent, #fff); }
.eq-pace .eq-choice { flex: 1; padding: 6px 4px; } /* 「ちょうどよかった」が3つ並びのスマホ幅でも1行に収まるよう、左右の余白を詰める(2026-11-01) */
.eq-scale { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; max-width: 352px; }
textarea.eq-text { resize: none; overflow: hidden; min-height: 4.5em; padding: 12px; font-size: 1.05rem; line-height: 1.7; border-width: 1.5px; border-radius: 10px; background: #fff; color: #1f2328; }
textarea.eq-text:focus { border-color: var(--accent); outline: none; }
@media (prefers-color-scheme: dark) {
  html:not([data-mode="light"]) textarea.eq-text { background: var(--card); color: var(--fg); }
}
html[data-mode="dark"] textarea.eq-text { background: var(--card); color: var(--fg); }
.eq-count { display: block; text-align: right; }
.enquete-link { margin: 24px 0 8px; }

/* 積分の100問(public/sekibun.js、2026-11-04)。10段×10マスの一覧と、1問ぶんの枠 */
.sk-summary { font-weight: 600; margin: 0.5rem 0 1rem; }
.sk-dan { margin: 0 0 0.9rem; }
.sk-dan-head { font-size: 1rem; margin: 0 0 0.4rem; display: flex; gap: 0.6rem; align-items: baseline; }
.sk-dan-level { font-size: 0.85rem; font-weight: normal; }
.sk-cells { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.4rem; }
@media (min-width: 560px) { .sk-cells { grid-template-columns: repeat(10, 1fr); } }
.sk-cell { position: relative; min-height: 2.75rem; padding: 0.25rem; border: 1px solid var(--line); border-radius: 8px; background: var(--card, #fff); color: var(--fg); font: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.sk-cell-no { font-size: 0.95rem; }
.sk-cell-mark { font-size: 0.8rem; min-height: 1em; }
.sk-cell.seen { border-style: dashed; border-color: var(--muted); }
.sk-cell.ok { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.sk-cell.ok .sk-cell-mark { color: var(--accent); }
.sk-cell.ng .sk-cell-mark { color: #c0392b; }
.sk-cell.current { outline: 2px solid var(--accent); outline-offset: 1px; }
.sk-panel-wrap { margin-top: 1.25rem; scroll-margin-top: 1rem; }
.sk-answer { margin-top: 1rem; }
.sk-kotae { margin: 0 0 0.75rem; }
.sk-kotae figcaption { font-weight: 600; margin-bottom: 0.25rem; }
.sk-kotae img { max-width: 100%; height: auto; }
.sk-marks { display: flex; gap: 0.5rem; margin: 0.5rem 0 1rem; }
.sk-mark-btn { flex: 1; min-height: 2.75rem; border: 1px solid var(--line); border-radius: 8px; background: var(--card, #fff); color: var(--fg); font: inherit; cursor: pointer; }
.sk-mark-btn.ok.on { border-color: var(--accent); background: var(--accent); color: var(--on-accent, #fff); }
.sk-mark-btn.ng.on { border-color: #c0392b; background: #c0392b; color: #fff; }
.sk-nav { display: flex; justify-content: space-between; margin-top: 1rem; }
/* 生徒の画面のボタンは全体で丸い形(999px)なので、マスと自己採点のボタンだけ角を戻す */
.sk-cells .sk-cell, .sk-marks .sk-mark-btn { border-radius: 8px; }
/* 管理画面の積分の100問(admin-sekibun.js) */
.sk-admin-dan { margin: 0 0 0.75rem; }
.sk-admin-dan > summary { font-weight: 600; cursor: pointer; }
.sk-hard td:first-child { color: #c0392b; font-weight: 600; }
/* 積分の100問の技のまとめへのリンク(2026-11-04) */
.sk-matome-row { display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; align-items: center; margin: 0.25rem 0 0.75rem; }
/* 積分の100問: 表示の切りかえ・しおり・10問ずつ・折りたためるヒント(2026-11-04) */
.sk-toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; margin: 0 0 1rem; }
.sk-toolbar .ch-filter { margin: 0; }
.sk-cell-bm { position: absolute; top: 2px; right: 3px; line-height: 0; color: var(--accent); }
.sk-cell-bm svg { width: 0.85rem; height: 0.85rem; }
.sk-cell-bm svg .f { fill: currentColor; }
.sk-pager { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0 0 1rem; }
.sk-pager button { min-height: 2.25rem; padding: 0 0.7rem; border: 1px solid var(--line); border-radius: 8px; background: var(--card, #fff); color: var(--fg); font: inherit; cursor: pointer; }
.sk-pager button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--on-accent, #fff); }
.sk-preview { margin: 0 0 1rem; }
.sk-preview.current { outline: 2px solid var(--accent); outline-offset: 1px; }
.sk-preview .ch-head .bm-btn, .sk-panel .ch-head .bm-btn { margin-left: auto; }
.sk-preview-mark { font-weight: 700; }
.sk-preview-mark.ok { color: var(--accent); }
.sk-preview-mark.ng { color: #c0392b; }
.sk-preview-foot { display: flex; justify-content: flex-end; margin-top: 0.5rem; }
.sk-hint > summary { cursor: pointer; font-size: 0.85rem; color: var(--accent); }
/* ヒントの見出しの右端に三角(開いていれば下向き、閉じたら右向き)。閉じられることが分かるように(2026-11-04 マスター) */
.sk-hint > summary { list-style: none; display: flex; justify-content: space-between; align-items: center; min-height: 1.75rem; }
.sk-hint > summary::-webkit-details-marker { display: none; }
.sk-hint > summary::after { content: ""; flex: none; width: 0; height: 0; margin-left: 0.5rem; border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 7px solid currentColor; transition: transform 0.15s; }
.sk-hint:not([open]) > summary::after { transform: rotate(-90deg); }
/* 積分の100問のヒント・答えの画像は、問題の画像と同じく横幅いっぱい(どれも紙の幅で作るので、同じ縮尺でそろう。2026-11-04) */
.sk-hint img, .sk-kotae img { width: 100%; max-width: 100%; margin: 0; }
/* ランダムに1問のボタン(2026-11-04) */
.sk-random { min-height: 36px; padding: 4px 14px; border: 1.5px solid var(--accent); border-radius: 999px; background: var(--card, #fff); color: var(--accent); font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
/* 答案の間違い探し(2026-11-06 作り直し。public/machigai.js)。画像は積分の100問と同じく横幅いっぱい */
.mg-caution { margin: -6px 0 14px; }
/* 一覧のカード */
.mg-summary { font-weight: 600; margin: 0.25rem 0 0.75rem; }
.mg-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 0.6rem; }
.student button.mg-pick { display: flex; flex-direction: column; align-items: flex-start; gap: 0.2rem; min-height: 4.5rem; padding: 0.6rem 0.75rem; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--fg); text-align: left; box-shadow: var(--shadow); }
.mg-pick-no { font-weight: 700; color: var(--accent); }
.mg-pick-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.4rem; }
.mg-pick-tangen { font-size: 0.85rem; color: var(--muted); }
.mg-pick-mark { margin-top: auto; padding: 0 0.5rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.mg-pick-mark.found { background: var(--accent); color: var(--on-accent, #fff); }
.mg-pick-mark.seen { border: 1px solid var(--line); color: var(--muted); }
.student button.mg-pick.found { border-color: var(--accent); }
/* 1問の画面 */
.mg-top { margin: 0 0 0.5rem; }
.student button.mg-btn { min-height: 44px; padding: 6px 16px; border: 1.5px solid var(--accent); background: var(--card); color: var(--accent); font-weight: 600; }
.mg-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.75rem; }
.mg-tangen { font-size: 0.85rem; font-weight: normal; color: var(--muted); }
.mg-label { font-size: 0.9rem; font-weight: 600; color: var(--muted); margin: 1rem 0 0.3rem; }
.mg-mondai { min-height: 3rem; }
.mg-prompt { margin: 1rem 0 0.25rem; padding: 0.6rem 0.75rem; border-left: 4px solid var(--accent); background: var(--card); border-radius: 8px; font-weight: 600; }
.mg-result { margin: 0.75rem 0 0; padding: 0.6rem 0.75rem; border-radius: 8px; background: var(--card); border: 1.5px solid var(--line); font-weight: 700; scroll-margin-top: 1rem; }
.mg-result p { margin: 0; }
.mg-result.all { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); }
.mg-result.warn { border-color: #d48806; background: color-mix(in srgb, #f0a020 14%, var(--card)); }
/* 解き終えたあとの完了の枠: 解説 PDF と「次の問題へ」(塗りの主ボタン)を並べる */
.mg-result.done { border-width: 2px; }
.mg-done-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.mg-done-actions > * { flex: 1 1 12rem; justify-content: center; text-align: center; }
.student button.primary.mg-next { min-height: 44px; padding: 8px 16px; font-weight: 700; }
.mg-summary { margin-bottom: 0; }
.mg-summary-note { margin: 2px 0 0.75rem; }
.mg-guide-note { margin: 4px 2px 0; }
.mg-before { margin: -2px 0 0; }
.mg-pick-kasho { font-size: 0.8rem; color: var(--muted); }
.mg-pick-kasho.many { color: var(--ng); font-weight: 700; }
/* 「おかしな所が N か所」の数。2か所以上は赤(2026-11-06 マスター) */
.mg-kasho-num { font-weight: 800; font-size: 1.1em; }
.mg-kasho-num.many { color: var(--ng); }
/* 答案: 薄いノートの色の台に、白地の行の画像を縦に並べる。1行ずつ押して選ぶ */
.mg-toan { display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px solid color-mix(in srgb, #c9a94a 45%, var(--line)); border-radius: 12px; background: color-mix(in srgb, #f3e3a3 40%, var(--bg)); scroll-margin-top: 1rem; }
/* 行のボタン: 左に印の帯(選ぶと色が付き ✓ が出る。判定のあとは ○△×)、右に行の画像。印が画像の文字に重ならないように、帯は画像の外に置く */
.student button.mg-line { display: flex; align-items: stretch; width: 100%; min-height: 44px; padding: 0; border: 3px solid color-mix(in srgb, #c9a94a 35%, transparent); border-radius: 8px; background: #fff; cursor: pointer; overflow: hidden; }
.student button.mg-line:disabled { opacity: 1; cursor: default; }
.mg-line-mark { flex: none; display: flex; align-items: center; justify-content: center; width: 1.9rem; background: color-mix(in srgb, #c9a94a 18%, #fff); color: #fff; font-size: 1.5rem; font-weight: 700; line-height: 1; }
.mg-dot { display: block; width: 0.95rem; height: 0.95rem; border: 2px solid color-mix(in srgb, #8a6d1f 45%, transparent); border-radius: 50%; }
.mg-line-mark.small { font-size: 0.7rem; letter-spacing: -0.02em; }
.mg-line img { display: block; flex: 1; min-width: 0; width: 100%; height: auto; min-height: 1.75rem; padding: 4px; object-fit: contain; object-position: left top; align-self: center; }
/* 選んだ行: 枠を太く+左の帯に色(色の見え方の個人差のため ✓ も) */
.mg-row.sel .mg-line { border-width: 3px; border-color: var(--accent); }
.mg-row.sel .mg-line-mark { background: var(--accent); }
/* 判定: 当たり=緑(正解の色)・惜しい=オレンジ・はずれ=灰色。答えを見たときの見つけられなかった所は赤の破線 */
.mg-row.hit .mg-line { border-color: var(--ok); }
.mg-row.hit .mg-line-mark { background: var(--ok); }
.mg-row.close .mg-line { border-color: #d48806; }
.mg-row.close .mg-line-mark { background: #d48806; }
.mg-row.wrong .mg-line { border-color: #8a9099; }
.mg-row.wrong .mg-line-mark { background: #8a9099; }
.mg-row.missed .mg-line { border: 3px dashed var(--ng); }
.mg-row.missed .mg-line-mark { background: var(--ng); }
.mg-row.alt .mg-line { border: 3px dotted var(--ok); }
.mg-verdict { margin: 4px 2px 2px; padding: 4px 8px; border-left: 4px solid var(--line); border-radius: 4px; background: var(--bg); font-size: 0.9rem; }
.mg-verdict strong { margin-right: 0.4em; }
.mg-row.hit .mg-verdict { border-left-color: var(--ok); }
.mg-row.hit .mg-verdict strong { color: var(--ok); }
.mg-row.close .mg-verdict { border-left-color: #d48806; }
.mg-row.close .mg-verdict strong { color: #b26a00; }
.mg-row.wrong .mg-verdict { border-left-color: #8a9099; }
.mg-row.wrong .mg-verdict strong { color: var(--muted); }
.mg-row.missed .mg-verdict { border-left-color: var(--ng); color: var(--ng); font-weight: 600; }
.mg-row.alt .mg-verdict { border-left-color: var(--ok); }
.mg-actions { margin: 0.75rem 0 0; }
/* 答案の下の「答えを見る」: 控えめ(灰色の枠)だが、押しやすい高さ */
.student button.mg-btn-sub { display: block; min-height: 44px; margin: 6px auto 0; padding: 6px 20px; border: 1.5px solid var(--line); background: var(--card); color: var(--muted); font-size: 0.9rem; font-weight: 600; }
/* 画面の下(下のタブの上)に固定する帯。答案の最後の行や前後の移動を隠さないよう、出ているあいだは下に余白を足す */
.mg-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 49; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 12px;
  padding: 8px max(16px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: var(--bg); border-top: 1px solid var(--line); box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08); }
body.has-tabs .mg-bar { bottom: calc(64px + env(safe-area-inset-bottom, 0px)); padding-bottom: 8px; }
.mg-bar[hidden] { display: none; }
.mg-bar-text { font-weight: 600; }
.mg-bar button { min-height: 44px; }
.student .mg-bar button.primary { padding: 8px 20px; font-weight: 700; }
#app.mg-has-bar { padding-bottom: 8rem; } /* 帯が2段になっても、答案の最後の行と前後の移動が隠れないように */
.mg-nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 0.5rem; margin: 1.5rem 0 0.5rem; }
.mg-nav > :first-child { justify-self: start; }
.mg-nav > :last-child { justify-self: end; }
.student .mg-nav button.mg-btn { padding: 6px 12px; }

/* ---- 教科の切り替え(有料プラン「大」、試しの版。2026-11-07 マスター。public/subject-bar.js) ----
   形はデジタル庁デザインシステムのボタンに寄せる: 角丸 8px・枠 1px・文字 16px の太字・高さ 48px・キーボードのフォーカスは黒と黄の二重線。
   色は標準の空色テーマでは DADS の blue-900、ほかのテーマ・暗いときはテーマのアクセント色(地の色とちぐはぐにしないため)。
   選んでいる教科は塗りつぶし+チェックの印(色だけで伝えない)。新着は orange-800 の地に白い文字の「新着」 */
.subject-bar {
  --sb-key: #0017c1;
  --sb-on-key: #ffffff;
  display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 8px;
  margin: 0 0 20px;
}
html[data-theme] body.student .subject-bar { --sb-key: var(--accent); --sb-on-key: var(--on-accent, #ffffff); }
@media (prefers-color-scheme: dark) {
  html:not([data-mode="light"]) body.student .subject-bar { --sb-key: var(--accent); --sb-on-key: var(--on-accent, #0f1722); }
}
html[data-mode="dark"] body.student .subject-bar { --sb-key: var(--accent); --sb-on-key: var(--on-accent, #0f1722); }
.subject-bar .subject-btn {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px 6px;
  min-height: 48px; padding: 6px 4px; margin: 0;
  border: 1px solid var(--sb-key); border-radius: 8px;
  background: var(--card, #fff); color: var(--fg);
  font-size: 1rem; font-weight: 700; line-height: 1.3; letter-spacing: 0.02em;
}
.subject-bar .subject-btn:hover { background: color-mix(in srgb, var(--sb-key) 10%, var(--card, #fff)); }
.subject-bar .subject-btn.on { background: var(--sb-key); color: var(--sb-on-key); cursor: default; }
.subject-bar .subject-btn:focus-visible { outline: 4px solid #000000; outline-offset: 2px; box-shadow: 0 0 0 2px #ffd43d; }
.subject-bar .subject-check { display: inline-flex; width: 18px; height: 18px; }
.subject-bar .subject-check svg { width: 18px; height: 18px; }
.subject-bar .subject-new {
  display: inline-block; padding: 0 6px; border-radius: 4px;
  background: #c74700; color: #ffffff; font-size: 0.875rem; font-weight: 700; line-height: 1.5;
}
/* 教科の切り替えの見出し「教科」と、選んでいる教科の未読の回答の帯(天秤AIレビュー 2026-11-07 を反映) */
.subject-area { margin: 0 0 20px; }
.subject-area .subject-bar { margin: 0; }
.subject-label { margin: 0 0 4px; font-size: 0.875rem; font-weight: 700; color: var(--muted); letter-spacing: 0.02em; }
.subject-unread {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  margin: 12px 0 0; padding: 10px 12px; border: 1px solid #c74700; border-left-width: 4px; border-radius: 8px;
  background: var(--card, #fff); color: var(--fg); font-size: 0.95rem; line-height: 1.6;
}
.subject-unread a { flex-shrink: 0; padding: 6px 14px; border-radius: 8px; background: #c74700; color: #ffffff; font-weight: 700; text-decoration: none; }
.subject-unread a:focus-visible { outline: 4px solid #000000; outline-offset: 2px; box-shadow: 0 0 0 2px #ffd43d; }
/* 入口のカードの「新しい回答」も、教科のボタンの「新着」と同じオレンジにそろえる(「最新」は教材の新しさなので青のまま) */
.badge.unread { background: #c74700; color: #ffffff; font-size: 0.8rem; font-weight: 700; }
/* 4列のときは、どのボタンも「教科名の行」「新着の行」の2段にして、教科名の高さをそろえる */
.subject-bar .subject-main { display: inline-flex; align-items: center; gap: 6px; }
.subject-bar.narrow .subject-btn { flex-direction: column; justify-content: flex-start; padding-top: 12px; min-height: 64px; }
.subject-bar .subject-main > span:last-child { white-space: nowrap; }
/* 4列のときは、チェックの印を教科名の下の段に回す(幅 320px の端末で、教科名が縦に割れないように) */
.subject-bar.narrow .subject-main { flex-direction: column-reverse; gap: 2px; }
/* 印は2種類(2026-11-07 マスター): 自分あての回答は塗りの「回答」、みんなの質問の更新は枠だけの「新着」 */
.subject-bar .subject-badges { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.subject-bar .subject-new.pub { background: transparent; color: #c74700; box-shadow: inset 0 0 0 1px #c74700; }
@media (prefers-color-scheme: dark) {
  html:not([data-mode="light"]) .subject-bar .subject-new.pub { color: #ff9a62; box-shadow: inset 0 0 0 1px #ff9a62; }
}
html[data-mode="dark"] .subject-bar .subject-new.pub { color: #ff9a62; box-shadow: inset 0 0 0 1px #ff9a62; }
/* みんなの質問の新着の案内(自分あての回答の帯より控えめ) */
.subject-pub-note { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 10px 0 0; font-size: 0.95rem; color: var(--fg); }
.subject-pub-note a { font-weight: 700; }

/* ---- 必要条件・十分条件のパック(試作、2026-11-07。public/hitsuyou.js)。一覧・1問の画面の多くは答案の間違い探し(mg-)の形を借りる ---- */
.hy-bu { font-size: 1rem; margin: 1.25rem 0 0.5rem; color: var(--fg); }
/* 一覧の上の「はじめに:説明カードを読む(PDF)」(A5 の PDF を開くリンク。2026-11-07 マスター) */
.student a.hy-card-entry { display: flex; flex-direction: column; align-items: flex-start; gap: 0.2rem; width: 100%; box-sizing: border-box; margin: 0.25rem 0 1rem; padding: 0.75rem 0.9rem; border: 1.5px solid var(--accent); border-left-width: 6px; border-radius: 12px; background: var(--card); color: var(--fg); text-decoration: none; box-shadow: var(--shadow); }
.hy-card-entry-title { display: inline-flex; align-items: center; gap: 0.35em; font-weight: 700; color: var(--accent); }
.hy-card-entry-sub { font-size: 0.9rem; color: var(--muted); }
.hy-card-entry .mg-pick-mark { margin-top: 0.3rem; }
/* 1問の画面の「説明カードを見直す(PDF)」: 控えめな文字のリンク */
.hy-card-again { margin: 0.25rem 0 0.5rem; font-size: 0.9rem; }
.hy-card-again-link { display: inline-flex; align-items: center; gap: 0.3em; font-weight: 600; }
/* 1問の画面 */
.hy-mae { margin-bottom: 0.25rem; }
.hy-progress { margin: 0.75rem 0 0; font-size: 0.9rem; font-weight: 600; color: var(--muted); }
.hy-toi { margin: 0.9rem 0 0; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.hy-toi-image { background: #fff; border-radius: 6px; }
.hy-choices { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 0; }
/* 選択肢: 左に印の丸、右に文。押しやすい高さ。正解=緑、ちがう=灰色、答えを見た=緑の破線 */
.student button.hy-choice { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; margin: 0; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--fg); font-size: 1rem; font-weight: 600; text-align: left; line-height: 1.45; }
.student button.hy-choice:disabled { opacity: 1; cursor: default; }
.hy-choice-mark { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem; border: 2px solid var(--line); border-radius: 50%; font-size: 0.95rem; font-weight: 800; }
.hy-choice-text { flex: 1; min-width: 0; }
.student button.hy-choice.ok { border-color: var(--ok); background: var(--ok-bg); }
.hy-choice.ok .hy-choice-mark { border-color: var(--ok); background: var(--ok); color: #fff; }
.student button.hy-choice.ng { border-color: #8a9099; color: var(--muted); }
.hy-choice.ng .hy-choice-mark { border-color: #8a9099; background: #8a9099; color: #fff; }
.student button.hy-choice.ans { border: 2px dashed var(--ok); }
.hy-choice.ans .hy-choice-mark { border-color: var(--ok); color: var(--ok); font-size: 0.75rem; }
.hy-verdict { margin-top: 8px; }
.hy-verdict.ok { border-left-color: var(--ok); }
.hy-verdict.ok strong { color: var(--ok); }
.hy-verdict.ng { border-left-color: #8a9099; }
.hy-verdict.ng strong { color: var(--muted); }
.hy-retry { color: var(--muted); }
.student button.hy-give { margin-top: 8px; }

/* ---- 用語・公式の辞書(大プランの特典・試作、2026-11-12。public/jisho.js・jisho-card.js、管理画面のプレビュー admin-jisho.js) ---- */
.jisho-search-form { margin: 0 0 12px; }
.jisho-search { width: 100%; min-height: 48px; padding: 10px 14px; border: 1.5px solid var(--accent); border-radius: 12px; background: var(--card); color: var(--fg); font-size: 1rem; }
/* 科目は6つを1行に(数IIIだけ2行目に落ちて見えたので。天秤AIレビュー 2026-11-12) */
.jisho-tabs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin: 4px 0 8px; }
.student button.jisho-tab { min-width: 0; min-height: 44px; padding: 4px 2px; border: 1.5px solid var(--accent); background: var(--card); color: var(--accent); font-weight: 600; }
/* 選んでいる科目は青で塗る(選択中は色で塗るのがマスターの好み) */
.student button.jisho-tab[aria-selected="true"] { background: var(--accent); color: #fff; }
.jisho-unit { margin: 0; }
h2.jisho-unit-title { margin: 16px 0 8px; padding-top: 10px; font-size: 1rem; }
.jisho-terms { display: flex; flex-wrap: wrap; gap: 8px; }
.student button.jisho-term-btn { min-height: 44px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--fg); font-size: 0.95rem; font-weight: 600; box-shadow: var(--shadow); }
.jisho-results { display: flex; flex-direction: column; gap: 8px; }
.student button.jisho-result { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; min-height: 52px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--fg); text-align: left; box-shadow: var(--shadow); }
.jisho-result-go { font-weight: 700; }
.jisho-result-where { font-size: 0.85rem; color: var(--muted); }
.jisho-count { margin: 0 0 6px; }
.jisho-none { padding: 12px 14px; border: 1px dashed var(--line); border-radius: 12px; background: var(--card); }
.jisho-none p { margin: 0 0 6px; }
.jisho-none .jisho-none-title { font-weight: 700; }
/* 見つからないときの「質問箱で聞く」はボタンの形で(文字のリンクだと小さく見落とす) */
.student a.jisho-ask { display: inline-flex; align-items: center; gap: 0.35em; min-height: 44px; margin-top: 4px; padding: 6px 16px; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 700; text-decoration: none; }
.student button.jisho-back { display: inline-flex; align-items: center; gap: 0.3em; min-height: 40px; margin: 0 0 10px; padding: 4px 12px 4px 8px; border: 1px solid var(--line); background: var(--card); color: var(--accent); font-weight: 600; }
/* カード: スマホの1画面に収まる量。見出し → 意味(青)→ 例(緑)→ よくある間違い(赤)→ 問題へのリンク */
.jisho-card { padding: 14px 16px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--fg); box-shadow: var(--shadow); overflow-wrap: anywhere; }
.jisho-card-head { margin: 0 0 10px; }
.jisho-where { margin: 0; font-size: 0.85rem; color: var(--muted); }
h2.jisho-go { margin: 2px 0 0; padding: 0; border: 0; font-size: 1.35rem; line-height: 1.35; }
.jisho-yomi { margin: 0; font-size: 0.9rem; color: var(--muted); }
.jisho-betsumei { margin: 4px 0 0; font-size: 0.85rem; color: var(--muted); }
.jisho-sec { margin: 10px 0 0; padding: 8px 12px; border-left: 4px solid var(--accent); border-radius: 0 10px 10px 0; background: color-mix(in srgb, var(--accent) 7%, transparent); }
.jisho-sec-rei { border-left-color: var(--ok); background: color-mix(in srgb, var(--ok) 8%, transparent); }
/* よくある間違いは、警告に見えすぎないよう地の色を薄めに(見出しと左の線は赤のまま。天秤AIレビュー 2026-11-12) */
.jisho-sec-machigai { border-left-color: var(--ng); background: color-mix(in srgb, var(--ng) 4%, transparent); }
.jisho-sec-mondai { border-left-color: var(--line); background: none; }
/* 使い分け(紫)・なぜ成り立つ?(証明。方法ごとに開け閉め) 2026-11-12 */
.jisho-sec-tsukaiwake { border-left-color: var(--c6, #8b5cf6); background: color-mix(in srgb, var(--c6, #8b5cf6) 7%, transparent); }
.jisho-sec-tsukaiwake h3.jisho-sec-title { color: var(--c6, #8b5cf6); }
.jisho-sec-shoumei { border-left-color: var(--c5, #3730a3); background: color-mix(in srgb, var(--c5, #3730a3) 6%, transparent); }
.jisho-sec-shoumei h3.jisho-sec-title { color: var(--c5, #3730a3); }
.jisho-proof { margin: 6px 0 0; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.jisho-proof > summary { min-height: 44px; display: flex; align-items: center; padding: 6px 12px; font-weight: 700; cursor: pointer; }
.jisho-proof[open] > summary { border-bottom: 1px solid var(--line); }
/* 開ける印(display:flex で三角の印が消えるので、右端に + / − を出す) */
.jisho-proof > summary { list-style: none; gap: 8px; }
.jisho-proof > summary::-webkit-details-marker { display: none; }
.jisho-proof > summary::after { content: "+"; margin-left: auto; font-size: 1.2rem; color: var(--accent); }
.jisho-proof[open] > summary::after { content: "−"; }
.jisho-proof-body { padding: 8px 12px 10px; }
/* 証明の図(SVG)。地は白のまま(暗い表示でも図の線が見えるように)、幅いっぱいまで */
.jisho-zu-box { padding: 10px 12px 0; }
.jisho-zu { display: block; width: 100%; max-width: 340px; height: auto; margin: 0 auto; border-radius: 8px; background: #fff; border: 1px solid var(--line); }
h3.jisho-sec-title { margin: 0 0 2px; font-size: 0.85rem; color: var(--accent); }
.jisho-sec-rei h3.jisho-sec-title { color: var(--ok); }
.jisho-sec-machigai h3.jisho-sec-title { color: var(--ng); }
.jisho-sec-mondai h3.jisho-sec-title { color: var(--muted); }
.jisho-text p { margin: 0; line-height: 1.75; }
.jisho-text p + p { margin-top: 4px; }
/* 数式は質問と回答(.qa-text)と同じ 1.08 倍。長い数式は段落の中だけ横に動かせる(ページ全体は横にはみ出さない) */
.jisho-card .katex { font-size: 1.08em; }
.jisho-text p { overflow-x: auto; overflow-y: hidden; }
/* 問題へのリンクは横に並ぶ札(4つ付いてもスマホの1画面に収まるように) */
.jisho-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.jisho-link { display: inline-flex; align-items: center; gap: 0.3em; min-height: 40px; padding: 4px 14px; border: 1px solid var(--accent); border-radius: 10px; background: var(--card); font-size: 0.85rem; font-weight: 600; text-decoration: none; }
/* 問題へのリンクは、科目の切り替え(丸い札)と見分けがつくよう角を四角寄りに+行き先の矢印 */
.jisho-link::after { content: "→"; margin-left: 0.15em; }
.jisho-back-bottom { margin-top: 12px; }
.jisho-link-group + .jisho-link-group { margin-top: 8px; }
.jisho-link-pack { display: flex; align-items: center; gap: 0.3em; margin: 4px 0 0; font-size: 0.85rem; font-weight: 600; }
/* 管理画面の「用語辞書」(admin-jisho.js) */
.jisho-admin-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 10px; }
.jisho-admin-bar input[type="search"] { flex: 1 1 220px; min-width: 0; }
.jisho-admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.jisho-admin-table th, .jisho-admin-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.jisho-admin-table .note { font-size: 0.75rem; }
button.link-button.jisho-admin-open { padding: 0; border: 0; background: none; color: var(--accent); font-weight: 600; text-align: left; text-decoration: underline; cursor: pointer; }
.jisho-hidden-row { opacity: 0.6; }
.jisho-admin-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.jisho-admin-tag { padding: 0 8px; border: 1px solid var(--line); border-radius: 999px; font-size: 0.75rem; color: var(--muted); }
.jisho-admin-tag.off { border-color: var(--ng); color: var(--ng); }
button.jisho-admin-back { margin: 0 0 8px; }
.jisho-editor { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 900px) { .jisho-editor { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } .jisho-preview-box { position: sticky; top: 12px; } }
.jisho-form { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.jisho-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.jisho-field-label { font-size: 0.85rem; font-weight: 600; }
.jisho-field input[type="text"], .jisho-field input[type="number"], .jisho-field textarea, .jisho-field select { width: 100%; min-width: 0; box-sizing: border-box; }
/* 数式の  がはっきり見えるように、入力欄は等幅の字に */
.jisho-field textarea { font-family: ui-monospace, Consolas, "BIZ UDGothic", monospace; font-size: 0.9rem; resize: vertical; }
.jisho-field-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.jisho-field-row > .jisho-field { flex: 1 1 160px; }
.jisho-proof-edit { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 8px 10px 10px; border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.jisho-proof-edit > legend { padding: 0 4px; font-size: 0.85rem; font-weight: 600; }
.jisho-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; margin-top: 4px; }
/* プレビューはスマホの幅で(1画面に収まるかを見られるように。天秤AIレビュー 2026-11-12) */
.jisho-preview-box { min-width: 0; }
.jisho-preview { max-width: 390px; }
.jisho-preview-box > .note { margin: 0 0 4px; }

/* 微分の計算ドリル(大プランの特典・試しの版、2026-11-22。public/bibun.js) */
.bd-h { margin: 1rem 0 0.4rem; font-size: 1rem; }
.bd-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.student label.bd-check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 14px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--card); font-weight: 600; cursor: pointer; }
.student label.bd-check:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--card)); color: var(--fg); }
.bd-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.bd-stars .bd-check span { letter-spacing: 1px; color: #d97706; }
.bd-sel-note { margin: 0.5rem 0 0.75rem; }
.student button.primary.bd-start { display: block; width: 100%; min-height: 52px; font-size: 1.1rem; font-weight: 700; }
.bd-today { margin-top: 1.5rem; padding: 12px 14px; border-radius: 14px; background: var(--card); box-shadow: var(--shadow); }
.bd-today p { margin: 0 0 8px; }
.student button.bd-again { width: 100%; }
.bd-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin: 0.25rem 0 0.5rem; font-size: 0.9rem; color: var(--muted); }
.bd-head-star { color: #d97706; letter-spacing: 1px; }
.bd-head-count { margin-left: auto; }
.bd-round { margin: 0 0 0.75rem; padding: 8px 12px; border-radius: 10px; background: var(--ok-bg); color: var(--ok); font-weight: 600; }
.student button.bd-card { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; min-height: 200px; margin: 0; padding: 20px 14px; border: 1.5px solid var(--line); border-radius: 16px; background: var(--card); color: var(--fg); box-shadow: var(--shadow); text-align: center; cursor: pointer; justify-content: center; }
.student button.bd-card.open { min-height: 0; cursor: default; }
.bd-label { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.bd-math { display: block; max-width: 100%; overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
.bd-q { font-size: 1.35rem; }
.bd-ask { display: flex; align-items: center; gap: 4px; font-size: 1rem; }
.bd-ask .bd-math { display: inline-block; }
.bd-tap { margin-top: 4px; font-size: 0.85rem; color: var(--accent); font-weight: 600; }
.bd-answer { margin: 12px 0 0; padding: 12px 14px; border-left: 4px solid var(--accent); border-radius: 10px; background: var(--card); }
.bd-step + .bd-step { margin-top: 10px; }
.bd-step-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.bd-a { font-size: 1.2rem; }
.bd-judge { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.student .bd-judge button { min-height: 52px; font-size: 1.05rem; font-weight: 700; border-width: 1.5px; }
.student button.bd-ok { border-color: var(--ok); color: var(--ok); background: var(--ok-bg); }
.student button.bd-ng { border-color: var(--ng); color: var(--ng); background: var(--ng-bg); }
/* 動く図(大プランの特典・試しの版、2026-11-25。public/ugokuzu.js と public/ugokuzu-zu/)。図の色は kit.js が style.css の変数で塗る */
.uz-unit { display: block; margin: 0; font-size: 0.8rem; font-weight: 700; color: var(--accent); }
.uz-card .uz-unit { margin-bottom: 2px; }
.round-card.uz-soon { opacity: 0.6; }
.uz-groups { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; } /* 一覧の分野で絞るボタン(2026-11-25) */
.uz-groups button.reason-chip { min-height: 40px; padding: 4px 16px; font-size: 0.95rem; }
.round-card.uz-soon::after { content: none; }
.uz-back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; font-weight: 600; text-decoration: none; }
.student h1.uz-title { margin: 0 0 10px; }
.uz-svg { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; }
/* 指では図をドラッグしない(スワイプでページがスクロールできる)。マウス・ペンだけドラッグ(ペンは横に動かせる) */
.uz-svg.uz-draggable { touch-action: pan-y pinch-zoom; }
@media (hover: hover) and (pointer: fine) { .uz-svg.uz-draggable { cursor: crosshair; } }
/* 図の中の意味を持つ色(kit.js の 'muted'・'accent'・'c1'〜'c7'・'ok'・'ng'・'orange' はここを見る。2026-11-25)。
   ライト・ダークの2通りだけで変わり、生徒が選ぶテーマ(ミント・クリームなど)では変わらない。
   テーマで accent が青緑(ミント)や茶色(クリーム)になると、グラフと青緑・黄色の線が見分けられなくなったため。
   値は空色のテーマ(body.student の標準)と同じ。c2 だけは字幕で「黄色」と呼ぶので、ライトでも黄色に見える色にした(大問の色の --c2 は変えない) */
.uz-svg {
  --uz-muted: #56657a; --uz-accent: #2f80d1; --uz-c1: #db2777; --uz-c2: #b88a00; --uz-c3: #0d9488; --uz-c4: #3b82f6; --uz-c5: #3730a3; --uz-c6: #8b5cf6; --uz-c7: #64748b;
  --uz-ok: #1a7f37; --uz-ng: #cf222e; --uz-orange: #c2410c;
}
@media (prefers-color-scheme: dark) {
  html:not([data-mode="light"]) .uz-svg {
    --uz-muted: #8d9bb0; --uz-accent: #58a6ff; --uz-c1: #f472b6; --uz-c2: #eab308; --uz-c3: #2dd4bf; --uz-c4: #60a5fa; --uz-c5: #818cf8; --uz-c6: #c084fc; --uz-c7: #94a3b8;
    --uz-ok: #56d364; --uz-ng: #ff7b72; --uz-orange: #fb923c;
  }
}
html[data-mode="dark"] .uz-svg {
  --uz-muted: #8d9bb0; --uz-accent: #58a6ff; --uz-c1: #f472b6; --uz-c2: #eab308; --uz-c3: #2dd4bf; --uz-c4: #60a5fa; --uz-c5: #818cf8; --uz-c6: #c084fc; --uz-c7: #94a3b8;
  --uz-ok: #56d364; --uz-ng: #ff7b72; --uz-orange: #fb923c;
}
.uz-bg { fill: var(--card); stroke: var(--line); stroke-width: 1; }
.uz-grid { stroke: var(--line); stroke-width: 1; }
.uz-axis line, line.uz-axis { stroke: var(--fg); stroke-width: 1.5; }
.uz-arrow { fill: var(--fg); }
.uz-label { font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif; paint-order: stroke; stroke: var(--card); stroke-width: 4px; stroke-linejoin: round; }
.uz-math { font-family: "Times New Roman", "Cambria Math", "Hiragino Mincho ProN", serif; font-style: italic; }
.uz-bold { font-weight: 700; }
.uz-point { stroke: var(--card); stroke-width: 2; }
/* 図の左上の一言(note)の札。地の色を塗り、下の軸・目盛り・線を隠して読めるようにする */
.uz-plate { fill: var(--bg); stroke: none; }
.uz-label.uz-note-t { stroke: var(--bg); }
/* − の字は欧文の字体で(日本語の字体の − は全角の幅で、「− 0.7」のようにすきまが空く) */
.uz-minus { font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-style: normal; }
.uz-bar { display: grid; grid-template-columns: 1fr 1.4fr 1fr auto; gap: 8px; align-items: center; margin-top: 10px; }
.student button.uz-btn { display: inline-flex; justify-content: center; align-items: center; gap: 6px; min-height: 48px; padding: 6px 8px; font-weight: 700; background: var(--card); color: var(--fg); white-space: nowrap; }
.student button.uz-btn.uz-play { border-color: var(--accent); background: var(--accent); color: var(--on-accent, #fff); }
.student button.uz-btn:disabled { opacity: 0.45; }
/* 「最初から見る」はスマホの幅では字だけにして、ボタンに収める */
@media (max-width: 420px) { .uz-play.uz-again .uz-btn-i { display: none; } }
.uz-count { min-width: 3.4em; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.uz-where { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.uz-progress { height: 4px; overflow: hidden; border-radius: 2px; background: var(--line); }
.uz-progress-fill { width: 0; height: 100%; background: var(--accent); }
.uz-dots { display: flex; flex-wrap: nowrap; justify-content: center; gap: 2px; } /* 場面が多くても1段に(点の幅を縮める。2026-11-25、正弦定理が11場面で折り返した) */
.student button.uz-dot { position: relative; flex: 0 1 32px; width: 32px; min-width: 22px; min-height: 32px; padding: 0; border: none; background: transparent; }
.uz-dot::before { content: ''; position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; transform: translate(-50%, -50%); border-radius: 50%; background: var(--line); }
.uz-dot.done::before { background: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.uz-dot.on::before { width: 14px; height: 14px; background: var(--accent); }
.uz-cap { margin: 8px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--card); box-shadow: var(--shadow); font-size: 1.05rem; line-height: 1.8; }
.uz-controls { display: grid; gap: 10px; margin-top: 10px; }
.uz-controls:empty { display: none; }
.student label.uz-slider { display: block; padding: 10px 14px; border: 1.5px solid var(--accent); border-radius: 12px; background: var(--card); }
.uz-slider-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-weight: 600; }
.uz-val { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); }
.uz-slider input { display: block; width: 100%; min-height: 36px; margin: 4px 0 0; accent-color: var(--accent); }
/* 2択・3択の切り替えボタン(controls の type: 'choice'、2026-11-25)。枠はスライダーと同じ、選んでいるボタンは塗り */
.uz-choice { padding: 10px 14px; border: 1.5px solid var(--accent); border-radius: 12px; background: var(--card); }
.uz-choice .uz-name { display: block; font-weight: 600; }
.uz-choice-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.uz-choice button.reason-chip { min-height: 40px; padding: 4px 16px; font-size: 1rem; }
.uz-drag-hint { margin: 4px 0 0; }
.uz-drag-hint[hidden] { display: none; }
@media (min-width: 640px) { .uz-controls { grid-template-columns: 1fr 1fr; } }
.uz-panel { margin-top: 10px; padding: 8px 12px; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.uz-panel:empty { display: none; }
.uz-tex-d { display: block; max-width: 100%; overflow-x: auto; overflow-y: hidden; }
.uz-panel .katex-display { margin: 0.4em 0; }
.uz-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.uz-table th, .uz-table td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.uz-table th { font-size: 0.85rem; color: var(--muted); }
.uz-table th:last-child, .uz-table td:last-child { text-align: right; }
/* 今の行は意味を持たない灰色(図の色と取り違えないように) */
.uz-table tr.on td { background: color-mix(in srgb, var(--fg) 9%, var(--card)); font-weight: 700; }
.uz-foot { margin: 8px 0 2px; font-weight: 600; }
.uz-note { margin: 0; font-size: 0.9rem; color: var(--muted); text-align: center; }
