/* ===== 漢造くん ===== */
:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --ink: #2b2622;
  --muted: #7a7068;
  --line: #e4ddd3;
  --accent: #c2410c;
  --accent-soft: #fdeee4;
  --ok: #2f7d4f;
  --warn: #9a5b00;
  --warn-bg: #fff4dc;
  --red: #d40000;
  --radius: 12px;
  --kyokasho: "UD デジタル 教科書体 N-R", "UD Digital Kyokasho N-R", "UD デジタル 教科書体 NK-R",
    "UD Digital Kyokasho NK-R", "游教科書体", "YuKyokasho", "Klee One", serif;
  --ui: "BIZ UDPGothic", "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.6;
}
button { font: inherit; color: inherit; cursor: pointer; }

/* ---- 上部バー ---- */
.appbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 10px 20px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 48px; height: 48px; display: block; }
.brand h1 { margin: 0; font-size: 20px; letter-spacing: .05em; }
.brand p { margin: 0; font-size: 12.5px; color: var(--muted); }

/* ---- 2カラム ---- */
.layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
  padding: 20px;
  align-items: start;
}
.panel {
  position: sticky; top: 20px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 18px 18px;
}
.step { padding: 14px 0; border-bottom: 1px dashed var(--line); }
.step:last-child { border-bottom: 0; }
.step h2 {
  font-size: 15px; margin: 0 0 10px;
  display: flex; align-items: center; gap: 8px;
}
.step h2 .n {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 13px;
}
.step h2 .opt { font-weight: normal; font-size: 12px; color: var(--muted); margin-left: auto; }

/* 選択ボタン */
.seg { display: grid; gap: 8px; }
.grid2 { grid-template-columns: repeat(2, 1fr); }
.grid3 { grid-template-columns: repeat(3, 1fr); }
.grid4 { grid-template-columns: repeat(4, 1fr); }
.grid6 { grid-template-columns: repeat(6, 1fr); }
.seg button {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 9px 4px;
  min-height: 44px;
  line-height: 1.25;
  transition: border-color .15s, background .15s;
}
.seg button:hover:not(:disabled) { border-color: var(--accent); }
.seg button.on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}
.seg button:disabled { color: #b8afa6; background: #faf8f5; cursor: not-allowed; }
.seg button small { display: block; font-size: 11px; color: var(--muted); font-weight: normal; margin-top: 2px; }
.seg button:disabled small { color: #c9c1b9; }
.seg.kind button { padding: 10px 6px; }
.seg.kind b { font-size: 14.5px; }

/* 範囲タブ */
.tabs {
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: #f1ece5; border-radius: 10px; padding: 4px; gap: 4px;
}
.tabs button {
  border: 0; background: transparent; border-radius: 7px;
  padding: 8px 2px; font-size: 13px; min-height: 40px;
}
.tabs button.on { background: var(--surface); color: var(--accent); font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.range-body { margin-top: 10px; }
.range-help { font-size: 12.5px; color: var(--muted); margin: 0 0 8px; }

.unit-list { display: flex; flex-direction: column; gap: 6px; }
.unit-item {
  display: flex; align-items: center; gap: 10px;
  border: 1.5px solid var(--line); border-radius: 10px;
  padding: 8px 10px; cursor: pointer; background: var(--surface);
}
.unit-item.on { border-color: var(--accent); background: var(--accent-soft); }
.unit-item input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.unit-item .u-name { font-size: 14px; }
.unit-item .u-kanji { font-family: var(--kyokasho); font-size: 15px; color: var(--muted); letter-spacing: .1em; display: block; line-height: 1.3; }
.term-label { font-size: 12px; color: var(--muted); margin: 8px 0 2px; }
.mini-actions { display: flex; gap: 8px; margin-bottom: 8px; }
.mini-actions button {
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 8px; padding: 4px 10px; font-size: 12.5px;
}

.kanji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; }
.kanji-grid button {
  font-family: var(--kyokasho); font-size: 22px;
  aspect-ratio: 1; border: 1.5px solid var(--line); border-radius: 8px; background: var(--surface);
}
.kanji-grid button.on { border-color: var(--accent); background: var(--accent); color: #fff; }
.picked { font-size: 12.5px; color: var(--muted); margin-top: 8px; }

.trial-note {
  font-size: 12px; color: var(--warn); background: var(--warn-bg);
  border-radius: 8px; padding: 8px 10px; margin: 10px 0 0;
}
.warn {
  font-size: 12.5px; color: var(--warn); background: var(--warn-bg);
  border-radius: 8px; padding: 8px 10px; margin: 10px 0 0;
}
.disclaimer { font-size: 11.5px; color: var(--muted); margin: 6px 0 0; line-height: 1.5; }
input[type="text"] {
  width: 100%; font: inherit; font-size: 15px;
  border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px;
  background: var(--surface); color: var(--ink);
}
input[type="text"]:focus { outline: none; border-color: var(--accent); }

/* ---- できあがり ---- */
.preview { min-width: 0; }
.toolbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px;
  position: sticky; top: 20px; z-index: 5;
}
.tb-left { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.tb-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1.5px solid var(--line); background: var(--surface);
  border-radius: 10px; padding: 10px 16px; min-height: 46px; font-weight: 600;
}
.btn:hover { border-color: var(--accent); }
.btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; padding: 10px 26px; font-size: 16px; }
.btn.primary:hover { filter: brightness(1.08); }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.hint { font-size: 12.5px; color: var(--muted); margin: 10px 4px; }
.swap-icon {
  display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-size: 12px;
}

.pages { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-bottom: 40px; }
.page-label { align-self: flex-start; font-size: 13px; font-weight: 700; color: var(--muted); margin: 14px 0 0; }
.page-label.ans { color: var(--red); }
.sheet-wrap { position: relative; }
.sheet-wrap > .sheet { transform-origin: top left; box-shadow: 0 2px 10px rgba(0,0,0,.12); }
.empty {
  background: var(--surface); border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 60px 20px; text-align: center; color: var(--muted); width: 100%;
}

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: #2b2622; color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== プリント本体(mm基準。B4は --u を拡大) ===== */
.sheet {
  --u: 1mm;
  background: #fff;
  color: #000;
  font-family: var(--kyokasho);
  padding: calc(6 * var(--u));
  display: flex; flex-direction: row-reverse; /* 右に見出し、左へ問題 */
  overflow: hidden;
}

/* 1文字=1マス。縦書きの字形(。や小さい「ゃ」の位置)を保つため、1字ずつ縦書きにする */
.c {
  display: block; flex: none;
  writing-mode: vertical-rl;
  width: 1em; height: 1em; line-height: 1em;
  text-align: center;
}
.tcy { text-combine-upright: all; }
/* 答え以外の文字は小さめ(app.js の CTX と合わせる) */
.c.ctx { font-size: .72em; }

/* ---- 見出し(右端の縦書き帯) ---- */
.sheet-head {
  --hc: #2f7fd0;      /* 枠の色 */
  --hband: #d9e8f8;   /* 見出し帯の色 */
  --hred: #e0353b;    /* 丸と札の色 */
  flex: none;
  width: calc(25 * var(--u));
  margin-left: calc(2 * var(--u));
  display: flex; flex-direction: row-reverse; gap: calc(1.5 * var(--u));
}
.sheet-head.wide { width: calc(30 * var(--u)); }
.vtext { writing-mode: vertical-rl; line-height: 1.1; }

/* 右側の大きな枠:かん字の丸 → タイトル → 日づけ → なまえ → 点数 */
.h-frame {
  flex: none; width: calc(18 * var(--u));
  position: relative;
  display: flex; flex-direction: column; align-items: stretch;
  border: calc(.6 * var(--u)) solid var(--hc);
  border-radius: calc(4 * var(--u));
  padding-top: calc(3 * var(--u));
  overflow: visible;
}
.h-badge {
  position: absolute; top: calc(-7 * var(--u)); left: 50%; transform: translateX(-50%);
  width: calc(14 * var(--u)); height: calc(14 * var(--u)); border-radius: 50%;
  background: var(--hred); color: #fff;
  border: calc(.8 * var(--u)) solid #fff; box-shadow: 0 0 0 calc(.3 * var(--u)) var(--hred);
  display: grid; place-items: center;
  font-size: calc(4.6 * var(--u)); font-weight: 700; letter-spacing: -.05em; white-space: nowrap;
}
.h-title-box {
  flex: none; height: 30%;
  display: flex; justify-content: center; align-items: flex-start;
  padding: 0 calc(1 * var(--u));
  overflow: hidden;
}
.h-title { font-size: calc(7.5 * var(--u)); font-weight: 700; color: #b5501f; max-height: 100%; }
.h-band {
  flex: none;
  background: var(--hband); color: #234;
  text-align: center; font-size: calc(3.2 * var(--u)); line-height: calc(5 * var(--u)); white-space: nowrap;
  border-top: calc(.3 * var(--u)) solid var(--hc);
}
.h-date {
  flex: none; height: calc(28 * var(--u));
  display: flex; align-items: center; justify-content: center;
  font-size: calc(3.8 * var(--u)); white-space: nowrap; overflow: hidden;
}
/* 日づけは「月/日」を横に書く(場所をとらない) */
.h-slash {
  flex: none; height: calc(11 * var(--u));
  display: flex; align-items: center; justify-content: center;
  font-size: calc(6 * var(--u)); color: #555;
}
.h-date.h-class { height: calc(34 * var(--u));
}
.h-name { flex: 1; min-height: calc(30 * var(--u)); }
.h-score {
  flex: none; height: calc(11 * var(--u));
  border-top: calc(.3 * var(--u)) dashed var(--hc);
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: calc(.8 * var(--u)) calc(1.5 * var(--u));
  font-size: calc(3.4 * var(--u));
}
.h-score.ans-only { align-items: center; justify-content: center; }
.h-score .red { color: var(--red); font-weight: 700; font-size: calc(4.2 * var(--u)); white-space: nowrap; }

/* 左側:やりかた(指示文) */
.h-col { flex: none; display: flex; flex-direction: column; align-items: center; }
.h-tag {
  writing-mode: vertical-rl;
  background: var(--hred); color: #fff; font-weight: 700;
  font-size: calc(3.2 * var(--u)); padding: calc(1.5 * var(--u)) calc(.8 * var(--u));
  border-radius: calc(1.5 * var(--u)); margin-bottom: calc(2 * var(--u));
}
.h-instr { font-size: calc(3.6 * var(--u)); font-weight: 600; }

/* ---- 問題 ---- */
.rows { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row { flex: 1; display: flex; flex-direction: row-reverse; min-height: 0; }
.row + .row { border-top: calc(.6 * var(--u)) dotted #000; }
.qcol {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center;
  padding: calc(1.2 * var(--u)) 0 calc(.6 * var(--u));
  position: relative;
}
.qcol + .qcol { border-right: calc(.25 * var(--u)) dotted #888; }
.qnum { font-size: calc(4 * var(--u)); line-height: 1; margin-bottom: calc(.6 * var(--u)); flex: none; }
.sent {
  flex: 1; min-height: 0; width: 100%;
  display: flex; flex-direction: column; align-items: center; /* すべての字・マスを同じ中心線に */
  overflow: hidden;
  font-size: var(--fs, calc(8 * var(--u)));
  line-height: 1;
}
/* 文字の大きさ(--fs)は app.js が段数・列数から計算して .rows に設定する */

/* 問題部分:本体は中心線にそろえ、わき(読み・答えらん)は右に置く */
.q {
  position: relative; flex: none;
  display: flex; flex-direction: column; align-items: center;
  margin: .12em 0;
}
.q .side {
  position: absolute; left: 100%; top: 0; bottom: 0;
  margin-left: .04em;
  writing-mode: vertical-rl;
  font-size: .6em; width: 1.05em; /* よみがな:app.js の SIDE と合わせる */
  display: flex; align-items: center; justify-content: center;
  line-height: 1; letter-spacing: 0; white-space: nowrap;
}

/* 書き:マス */
.box {
  width: var(--bx, 1.5em); height: var(--bx, 1.5em);
  border: calc(.45 * var(--u)) solid #000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.box + .box { border-top-width: calc(.15 * var(--u)); border-top-style: dashed; }
.box.long { height: auto; padding: .15em 0; }
.box .ghost { visibility: hidden; }
.ans .box { color: var(--red); }

/* 送りがなあり:( )の中に書く */
/* （　）も□と同じ大きさにして、中に書きやすくする */
.q.paren .main { font-size: var(--px, 1.45em); }
.q.paren .pfill .c { font-size: .6em; } /* 答え(赤字)は□の中と同じくらいの大きさに */
/* 縦書きの（ は字の下半分、）は上半分にしかないので、空いている半分を詰める */
.q.paren .c.po { margin-top: -.45em; }
.q.paren .c.pc { margin-bottom: -.45em; }
.q.paren { margin: .3em 0; }
.q.paren .pfill { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ans /* （　）も□と同じ大きさにして、中に書きやすくする */
.q.paren .main { font-size: var(--px, 1.45em); }
.q.paren .pfill .c { font-size: .6em; } /* 答え(赤字)は□の中と同じくらいの大きさに */
/* 縦書きの（ は字の下半分、）は上半分にしかないので、空いている半分を詰める */
.q.paren .c.po { margin-top: -.45em; }
.q.paren .c.pc { margin-bottom: -.45em; }
.q.paren { margin: .3em 0; }
.q.paren .pfill { color: var(--red); }

/* 読み:漢字の右に傍線、その右に答えらん */
.q.read .main { position: relative; font-size: 1.3em; } /* 読み問題の漢字:app.js の READ と合わせる */
.q.read .main::after {
  content: ""; position: absolute; top: .05em; bottom: .05em; right: -.1em;
  border-right: calc(.5 * var(--u)) solid #000;
}
/* 読みがなは線の右の空いたところに書く(□にしない=書き問題と見分けられる) */
.q.read .side {
  margin-left: .2em;
  font-size: .6em; width: 1.3em;
  color: var(--red);
}

/* 練習用マス(10問のとき、左の余白に) */
.practice {
  flex: 1; min-width: 0;
  display: flex; flex-direction: row-reverse; align-items: flex-start; gap: calc(2 * var(--u));
  border-right: calc(.5 * var(--u)) solid #000;
  padding-right: calc(2 * var(--u)); margin-right: calc(1 * var(--u));
}
.pr-label { font-size: calc(4.2 * var(--u)); padding-top: calc(1 * var(--u)); }
.pr-grid {
  flex: none;
  display: grid; grid-auto-rows: var(--cell);
  border-top: calc(.3 * var(--u)) solid #888; border-left: calc(.3 * var(--u)) solid #888;
}
.pr-cell {
  position: relative;
  border-right: calc(.3 * var(--u)) solid #888; border-bottom: calc(.3 * var(--u)) solid #888;
}
.pr-cell::before, .pr-cell::after { content: ""; position: absolute; }
.pr-cell::before { left: 50%; top: 0; bottom: 0; border-left: calc(.2 * var(--u)) dashed #bbb; }
.pr-cell::after { top: 50%; left: 0; right: 0; border-top: calc(.2 * var(--u)) dashed #bbb; }

/* 入れかえボタン(画面だけ。プレビューの縮小を打ち消して読みやすい大きさに) */
.qtools {
  position: absolute; top: 0; left: 50%;
  transform: translate(-50%, -45%) scale(var(--inv, 1));
  display: flex; gap: 4px; z-index: 2;
  opacity: 0; transition: opacity .15s;
  font-family: var(--ui);
}
.qcol:hover .qtools, .qtools:focus-within { opacity: 1; }
@media (hover: none) { .qtools { opacity: .95; } }
.qtools button {
  height: 26px; min-width: 26px; padding: 0 8px; border-radius: 13px;
  border: 1px solid #e3c7b8; background: var(--accent-soft); color: var(--accent);
  font-size: 12.5px; font-weight: 700; line-height: 1; white-space: nowrap;
}
.qtools button:hover { background: var(--accent); color: #fff; }
/* 自分で入力した問題の印(画面だけ) */
.ctag {
  position: absolute; top: 0; right: 2px; transform-origin: top right; transform: scale(var(--inv, 1));
  font-family: var(--ui); font-size: 11px; font-weight: 700; line-height: 1;
  background: #2f7fd0; color: #fff; border-radius: 6px; padding: 3px 5px; z-index: 1;
}
.cf-remove { margin-right: auto; color: var(--muted); }

/* 候補からえらぶ画面 */
.picker {
  width: min(560px, calc(100vw - 32px)); max-height: min(80vh, 720px);
  border: 0; border-radius: 16px; padding: 0 18px 18px;
  box-shadow: 0 10px 40px rgba(0,0,0,.25);
  font-family: var(--ui); color: var(--ink); background: var(--surface);
}
.picker::backdrop { background: rgba(30, 20, 10, .35); }
.pk-head { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: var(--surface); padding: 14px 0 6px; z-index: 1; }
.pk-head h3 { margin: 0; font-size: 17px; }
.pk-close { border: 0; background: #f1ece5; width: 34px; height: 34px; border-radius: 50%; font-size: 18px; }
.pk-help { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
/* 自分で問題を作る画面 */
.picker.cf { width: min(860px, calc(100vw - 32px)); max-height: 92vh; }
.cf-body { display: grid; grid-template-columns: 1fr 230px; gap: 0 20px; }
.cf-right { border-left: 1px dashed var(--line); padding-left: 18px; }
.cf-right .cf-cols { flex-direction: row-reverse; gap: 14px; }
@media (max-width: 760px) {
  .cf-body { grid-template-columns: 1fr; }
  .cf-right { border-left: 0; padding-left: 0; }
}
.cf-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 12px; border-top: 1px dashed var(--line); }
.cf-actions .btn:disabled { opacity: .5; cursor: not-allowed; }
.cf-step { padding: 12px 0; border-top: 1px dashed var(--line); }
.cf-step-h { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; margin-bottom: 10px; }
.cf-step-h .n { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 13px; flex: none; }
.cf-sub { font-weight: normal; font-size: 12px; color: var(--muted); }
.cf-kind { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cf-kind button {
  border: 1.5px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px; min-height: 56px; line-height: 1.3;
}
.cf-kind button b { display: block; font-size: 15px; }
.cf-kind button small { color: var(--muted); font-size: 12px; }
.cf-kind button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* 言葉の欄:プリントの順に横一列(読みは漢字の上=ふりがなの位置) */
.cf-row { display: flex; align-items: flex-end; gap: 6px; flex-wrap: wrap; }
.cf-f, .cf-target label { display: flex; flex-direction: column; gap: 3px; }
.cf-f > span, .cf-target label > span { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.cf-row input {
  font-family: var(--kyokasho); font-size: 20px; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--surface); width: 100%;
}
.cf-row input:focus { outline: none; border-color: var(--accent); }
.cf-pre { flex: 2 1 110px; }
.cf-post { flex: 2 1 110px; }
.cf-okuri { flex: 1 1 70px; }
.cf-target { flex: 1.4 1 110px; display: flex; flex-direction: column; gap: 4px; }
/* 必ず入れる欄は色つき */
.cf-target input { background: #fff6ef; border-color: #efc7b2; }
.cf-kanji input { font-size: 26px; text-align: center; font-weight: 600; }
.cf-yomi input { font-size: 15px; text-align: center; padding: 5px 8px; }
.cf-msg { font-size: 12px; color: var(--warn); margin: 8px 0 0; min-height: 1em; }

/* 見本:プリントと同じ縦書き */
.cf-preview { background: #faf6f0; border-radius: 12px; padding: 10px; }
.cf-cols { display: flex; flex-direction: row-reverse; justify-content: center; gap: 28px; --u: .55mm; }
.cf-col { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.cf-col-h { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.cf-col.ans .cf-col-h { color: var(--red); }
.cf-col .sent { font-family: var(--kyokasho); font-size: 24px; width: 96px; flex: none; overflow: visible; padding: 8px 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; min-height: 0; }
.cf-empty { margin: 8px 0 0; text-align: center; color: var(--muted); font-size: 12px; }

/* ---- スマホ・タブレット縦 ---- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 12px 16px; gap: 14px; }
  .panel { position: static; max-height: none; }
  .toolbar { top: 0; border-radius: 0 0 var(--radius) var(--radius); }
  .grid6 { grid-template-columns: repeat(3, 1fr); }
}

/* ===== 印刷 ===== */
@media print {
  body { background: #fff; }
  .appbar, .panel, .toolbar, .hint, .page-label, .toast, .qtools, .ctag, .picker, .empty { display: none !important; }
  .layout { display: block; padding: 0; }
  .pages { display: block; padding: 0; gap: 0; }
  .sheet-wrap { width: auto !important; height: auto !important; }
  .sheet-wrap > .sheet { transform: none !important; box-shadow: none; }
  /* 2枚目以降の前で改ページ(最後に白紙が出ないように「前」で切る) */
  .sheet-wrap:not(.first) { break-before: page; page-break-before: always; }
  body.no-answer .sheet-wrap.answer { display: none; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

.cf-row input::placeholder { color: #c9bfb5; font-size: .8em; }

/* 自作の問題の一覧 */
.bk-list { list-style: none; margin: 0 0 12px; padding: 0; max-height: 50vh; overflow-y: auto; border-top: 1px dashed var(--line); }
.bk-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 2px; border-bottom: 1px dashed var(--line); }
.bk-text { font-family: var(--kyokasho); font-size: 19px; }
.bk-text b { color: var(--accent); }
.bk-text small { font-size: 12px; color: var(--muted); }
.bk-del { border: 1.5px solid #e9c4c4; color: #b42318; background: #fff5f5; border-radius: 8px; padding: 6px 12px; font-weight: 700; flex: none; }
.bk-del:hover { background: #b42318; color: #fff; }
.bk-empty { color: var(--muted); font-size: 14px; justify-content: center !important; }
.picker:not(.cf) { padding-bottom: 14px; }

.u-tag { font-style: normal; font-size: 10.5px; font-weight: 700; margin-left: 6px; padding: 1px 6px; border-radius: 6px; background: #fff4dc; color: var(--warn); vertical-align: 1px; }
.u-tag.none { background: #eee; color: #777; }

.ctag.fixed { background: var(--ok); }
.bk-h { font-weight: 700; font-size: 13.5px; color: var(--muted); padding: 12px 2px 4px !important; border-bottom: 1px solid var(--line) !important; }
.bk-text s { color: #b8afa6; }
.bk-undo { border: 1.5px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 12px; font-weight: 700; flex: none; }
.bk-undo:hover { border-color: var(--accent); color: var(--accent); }
