/* 計算プリントメーカー */
.ks-samples { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border: 2px dashed var(--line); border-radius: 14px; background: color-mix(in srgb, var(--mint) 16%, var(--card)); margin-bottom: 14px; }
.ks-sl { font-weight: 900; display: inline-flex; align-items: center; gap: 6px; margin-right: 4px; }
.ks-wrap { display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 960px) { .ks-wrap { grid-template-columns: minmax(0, 1fr); } }
.ks-side { display: grid; gap: 12px; min-width: 0; }
.ks-card { display: grid; gap: 10px; padding: 14px; }
.ks-h { font-size: 15.5px; margin: 0; }
.ks-gs { overflow-x: auto; max-width: 100%; padding-bottom: 2px; }
.ks-gs .seg { flex-wrap: nowrap; }
.ks-gs .seg button { padding: 6px 10px; white-space: nowrap; }
.ks-ch { display: grid; gap: 6px; border-top: 2px dashed var(--line-soft); padding-top: 10px; }
.ks-chosen { display: grid; gap: 6px; }
.ks-crow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 6px; align-items: center; padding: 6px 8px; border: 2px solid var(--line-soft); border-radius: 10px; background: var(--card2); }
.ks-cname { font-weight: 700; font-size: 13.5px; line-height: 1.35; }
.ks-crow .stepper button { width: 30px; }
.ks-crow .stepper input { width: 46px; min-height: 32px; }
.ks-pvcol { position: sticky; top: 74px; min-width: 0; display: grid; gap: 8px; }
@media (max-width: 960px) { .ks-pvcol { position: static; } }
.ks-tb { margin-bottom: 0; }
.ks-sum { color: var(--ink2); font-weight: 700; }
.ks-pvtabs { overflow-x: auto; max-width: 100%; }
.ks-stage { overflow: hidden; border: 2px solid var(--line); border-radius: 14px; background: repeating-linear-gradient(45deg, var(--bg2), var(--bg2) 10px, var(--bg) 10px, var(--bg) 20px); padding: 8px; }
.ks-sheets { transform-origin: 0 0; width: 210mm; }
.ks-sheets .ks-page { box-shadow: 0 2px 14px rgba(0, 0, 0, .18); margin-bottom: 6mm; }
.ks-empty { width: 210mm; padding: 40mm 20mm; text-align: center; font-size: 18pt; color: var(--ink2); }
.ks-measure { position: absolute; left: -12000px; top: 0; width: 210mm; visibility: hidden; pointer-events: none; }

/* ---- 紙 ---- */
.ks-page { width: 210mm; height: 296mm; padding: 11mm 12mm 0; background: #fff; color: #161616; font-size: var(--fs, 13pt); line-height: 1.4; position: relative; overflow: hidden; box-sizing: border-box; font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', Meiryo, sans-serif; font-variant-numeric: tabular-nums; }
.ks-measure .ks-page { height: auto; }
.ks-body { display: flow-root; }
.ks-head { display: flex; align-items: flex-end; gap: 4mm; border-bottom: 0.6mm solid #161616; padding-bottom: 2mm; }
.ks-tt { flex: 1; min-width: 0; }
.ks-ttl { font-size: 17pt; font-weight: 900; line-height: 1.2; display: flex; align-items: center; gap: 3mm; font-family: 'Zen Maru Gothic', 'Noto Sans JP', sans-serif; }
.ks-sub { font-size: 8.5pt; color: #555; }
.ks-key { font-size: 9pt; color: #fff; background: #d6332a; border-radius: 1.2mm; padding: .4mm 2.2mm; }
.ks-meta { display: flex; gap: 2mm; font-size: 10pt; }
.ks-f { border-bottom: 0.3mm solid #161616; padding: 0 1mm .5mm; white-space: nowrap; }
.ks-fn { min-width: 55mm; }
.ks-meta2 { display: flex; justify-content: flex-end; gap: 3mm; margin: 2mm 0 1mm; font-size: 10pt; align-items: center; }
.ks-time { display: inline-flex; align-items: center; gap: 1mm; border: 0.35mm solid #161616; border-radius: 5mm; padding: 1mm 3mm; }
.ks-time b { display: inline-block; width: 9mm; border-bottom: 0.25mm solid #161616; height: 1.1em; }
.ks-time small { color: #555; margin-left: 1mm; }
.ks-score { display: inline-flex; align-items: flex-end; gap: 1mm; border: 0.5mm solid #161616; border-radius: 2mm; padding: 1mm 2.5mm; min-height: 10mm; }
.ks-score b { min-width: 13mm; text-align: center; font-size: 14pt; }
.ks-sec { margin-top: 2.6mm; }
.ks-inst { display: flex; gap: 2mm; align-items: center; font-weight: 700; margin-bottom: 1.8mm; font-size: max(10pt, .82em); }
.ks-no { min-width: 1.6em; height: 1.6em; display: grid; place-items: center; background: #161616; color: #fff; border-radius: 50%; font-weight: 900; font-size: .9em; }
.ks-gridq { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); column-gap: 5mm; row-gap: calc(.62em + var(--xg, 0px)); padding-left: 1mm; }
.ks-gridq.hs { row-gap: 4mm; }
.ks-q { display: flex; align-items: center; gap: .35em; min-height: 2.1em; white-space: nowrap; }
.ks-n { font-size: .72em; color: #555; min-width: 2.2em; flex: none; font-weight: 700; }
.ks-e { letter-spacing: .02em; }
.ks-ab { display: inline-flex; align-items: center; justify-content: center; border: 0.3mm solid #444; border-radius: 1.2mm; height: 1.75em; margin-left: .2em; padding: 0 .3em; }
.ks-ab.tall { height: 2.6em; }
.ks-qe { flex-wrap: wrap; white-space: normal; }
.ks-qe .ks-ans { margin-left: auto; white-space: nowrap; }
.ks-qe .ks-ab { height: 1.6em; border-width: 0 0 0.3mm; border-radius: 0; }
.ks-sq { display: inline-flex; align-items: center; justify-content: center; min-width: 2.6em; height: 1.65em; border: 0.3mm solid #444; vertical-align: middle; margin: 0 .15em; }
.ks-red { color: #d6332a; font-weight: 700; }
.ks-fr { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; font-size: .86em; line-height: 1.12; margin: 0 .12em; }
.ks-fr > span:first-child { border-bottom: 0.28mm solid currentColor; padding: 0 .18em; }
.ks-w { margin-right: .02em; }
.ks-rt { white-space: nowrap; }
.ks-rad { border-top: 0.25mm solid currentColor; padding: 0 .1em; margin-left: -.05em; }
.ks-sys { display: inline-flex; flex-direction: column; border-left: 0.35mm solid #161616; border-radius: 2mm 0 0 2mm; padding: 0 .3em 0 .5em; line-height: 1.5; vertical-align: middle; }
.ks-page i, .ks-fc i { font-family: 'Times New Roman', serif; font-size: 1.08em; }
.ks-page sup { font-size: .62em; line-height: 0; }
/* 筆算のマス目 */
.ks-qh { align-items: flex-start; }
.ks-hs { display: flex; align-items: flex-end; gap: 2mm; }
.ks-grid { border-collapse: collapse; }
.ks-grid td { width: 1.75em; height: 1.75em; border: 0.2mm dashed #b9b9b9; text-align: center; vertical-align: middle; padding: 0; font-size: 1.05em; }
.ks-grid td b { font-weight: 600; }
.ks-grid td b.op { font-weight: 700; }
.ks-grid tr.carry td { height: .95em; border-top-style: none; font-size: .7em; border-color: #e3e3e3; }
.ks-grid tr.line td { border-bottom: 0.45mm solid #161616; }
.ks-grid td.e { border-color: transparent; }
.ks-grid td.top { border-top: 0.45mm solid #161616; }
.ks-grid td.bk { border-left: 0.45mm solid #161616; border-top-left-radius: 2.4mm; }
.ks-grid tr.qrow td { border-bottom-color: transparent; }
.ks-rem { font-size: .85em; }
/* 100マス */
.ks-qy { justify-content: center; }
.ks-hy { border-collapse: collapse; margin: 1mm auto; }
.ks-hy th, .ks-hy td { width: 15.5mm; height: 15.5mm; border: 0.3mm solid #444; text-align: center; font-size: 15pt; }
.ks-hy th { background: #f0f0f0; font-weight: 800; }
.ks-hy tr:first-child th { border-bottom: 0.6mm solid #161616; }
.ks-hy th:first-child { border-right: 0.6mm solid #161616; }
.ks-hy th.op { background: #161616; color: #fff; font-size: 17pt; }
.ks-hy tr:nth-child(6) td, .ks-hy tr:nth-child(6) th { border-bottom-width: 0.6mm; }
.ks-hy td:nth-child(6), .ks-hy th:nth-child(6) { border-right-width: 0.6mm; }
.ks-ksec .ks-gridq { row-gap: .2em; }
.ks-k { display: flex; gap: 1.5mm; align-items: center; border-bottom: 0.2mm dotted #bbb; min-height: 1.9em; }
.ks-foot { position: absolute; left: 12mm; right: 12mm; bottom: 5mm; display: flex; justify-content: space-between; font-size: 7pt; color: #888; border-top: 0.2mm solid #ddd; padding-top: 1mm; }

/* ---- 画面で練習 ---- */
.ks-fc { position: fixed; inset: 0; z-index: 9999; background: #183a33; color: #f6f2e7; display: grid; grid-template-rows: auto 1fr auto; gap: 12px; padding: 14px; }
.ks-fc-top { display: flex; align-items: center; gap: 12px; }
.ks-fc-top .sp { flex: 1; }
.ks-fc-cnt { font-weight: 900; font-size: 20px; font-variant-numeric: tabular-nums; }
.ks-fc-card { display: grid; place-items: center; align-content: center; gap: 4vh; border: 3px solid #f6f2e7; border-radius: 26px; cursor: pointer; user-select: none; text-align: center; padding: 20px; }
.ks-fc-q { font-size: clamp(40px, 11vw, 140px); font-weight: 900; line-height: 1.2; }
.ks-fc-a { font-size: clamp(32px, 8vw, 100px); font-weight: 900; color: #ffd23f; min-height: 1.2em; opacity: 0; transition: .2s; }
.ks-fc-a.on { opacity: 1; }
.ks-fc-q i, .ks-fc-a i { font-size: 1em; }
.ks-fc-help { text-align: center; margin: 0; font-size: 13px; opacity: .75; }

/* 長いページで「なめらかスクロール」中に押すとボタンの位置がずれるため、このアプリのページだけ即時スクロールにする */
html { scroll-behavior: auto; }
