/* 謎解きプリントのページ(/nazotoki)。lp.css の上に重ねる。
   画面: 操作(けいさん・段・答えのことば・印刷する)と 紙の見本(画面の幅に transform で縮める。--nz-scale・--nz-paper-h は js/nazotoki-page.js)。
   紙: 2-4 節の寸法(mm・pt)。背景に意味を持たせない(番号は線の丸・枠と点線は #444〜#555)。色は うすい飾りだけ。
   印刷: 紙2枚だけを出す。改ページは 答えの紙の前だけ。高さを 297mm に固定しない(iOS Safari は @page を無視して組む) */

/* ---- パンくず(JSON-LD の BreadcrumbList と同じ「ホーム › 謎解きプリント」。kuku-intro.css と同じ見た目) ---- */
.nz-crumbs {
  max-width: 960px;
  margin: 0 auto;
  padding: 10px 20px 0;
  font-size: 0.78rem;
  opacity: 0.7;
}
.nz-crumbs a { color: var(--ink); }

/* ---- 道具(見出し・操作・見本) ---- */
main section.nz-tool { padding-top: 8px; }
.nz-intro { text-align: center; }
.nz-h1 {
  font-size: clamp(1.3rem, 5.6vw, 2rem);
  font-weight: 900;
  line-height: 1.45;
}
.nz-h1-sub { display: inline-block; font-size: 0.72em; }
.nz-lead-line { font-size: 0.86rem; line-height: 1.7; margin-top: 6px; word-break: keep-all; }
.nz-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px 6px;
  margin-top: 6px;
  font-size: 0.74rem;
  line-height: 1.5;
}
.nz-tags span {
  background: var(--sun-soft);
  border: 1.5px solid var(--sun-deep);
  border-radius: 999px;
  padding: 0 9px;
}

.nz-controls { margin-top: 12px; }
/* 1列の画面(スマホ・タブレット)は 紙と操作を 480px までに(タブレットで 紙が 画面より 高くならないように) */
@media (max-width: 959px) {
  .nz-preview,
  .nz-controls { max-width: 480px; margin-left: auto; margin-right: auto; }
}
button.nz-print,
button.nz-regen,
button.nz-ans-close {
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* 設定の カード(使いかた の ①〜⑤ の カードと 同じ 白地・線・点線の しきり)。左に 見出し、右に プルダウン・欄 */
.nz-form {
  margin-top: 16px;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 2px 14px;
}
.nz-form-row { display: grid; grid-template-columns: 5.4em minmax(0, 1fr); align-items: center; column-gap: 10px; padding: 10px 0; }
.nz-form-row[hidden] { display: none; }
.nz-form-row + .nz-form-row { border-top: 2px dashed rgba(69, 58, 47, 0.14); }
.nz-form-label { font-size: 0.85rem; font-weight: 900; line-height: 1.3; }
.nz-select { position: relative; }
/* プルダウンと 欄は 同じ形。iOS は 16px 未満だと 押したときに 画面が寄るので 1rem */
.nz-select select,
.nz-word {
  display: block;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  height: 42px;
  font: inherit;
  font-size: 1rem;
  font-weight: 900;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid rgba(69, 58, 47, 0.35);
  border-radius: 10px;
  padding: 0 12px;
  -webkit-appearance: none;
  appearance: none;
}
.nz-select select { padding-right: 34px; text-overflow: ellipsis; cursor: pointer; }
/* プルダウンの しるし(下向きの くの字) */
.nz-select::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -6px;
  border-right: 2.5px solid var(--ink);
  border-bottom: 2.5px solid var(--ink);
  transform: rotate(45deg);
  pointer-events: none;
}
.nz-word::placeholder { color: var(--ink); opacity: 0.45; font-weight: 700; }
.nz-select select:focus,
.nz-word:focus { outline: 3px solid var(--sun); outline-offset: 1px; }
.nz-word-note { font-size: 0.76rem; line-height: 1.6; margin: -4px 0 10px; }
.nz-word-note.is-error { color: #c0392b; }

/* 答え・別の問題にする・印刷する を 横1列で 同じ はば(12/1 持ち主「横幅 揃える」)。印刷する は 黄色(いちばん押す ボタン)。
   字は 画面の はばで 少し 小さくして、360px でも「別の問題にする」が 1行に入る */
.nz-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.nz-actions .nz-regen,
.nz-actions .nz-print { padding: 7px 4px; font-size: clamp(0.78rem, 3.5vw, 0.92rem); white-space: nowrap; }
.nz-print {
  background: var(--sun);
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 3px 0 var(--ink);
  font-weight: 900;
  line-height: 1.4;
}
.nz-print:active { transform: translateY(3px); box-shadow: none; }
/* ボタンの下の注は LINE などのアプリの中で開いたときだけ(赤)。「2枚目は答えです」は 12/1 に やめた(持ち主「なくていい」) */
.nz-print-note { margin-top: 8px; font-size: 0.74rem; line-height: 1.6; text-align: center; opacity: 0.8; }
.nz-inapp-note { margin-top: 4px; color: #c0392b; opacity: 1; font-weight: 900; }
/* 見本の上の行: 左に「見本(1枚め)」、右に べつの もんだいにする。
   ボタンは ほかのボタンと同じ 線と下の影の 白地で、印刷する より小さく(11/30 持ち主「ボタンの方がいい」「ボタンと説明だらけ」) */
/* 答え・別の問題にする は 印刷する の下に 並べる(紙を いちばん上に出すため。12/1) */
.nz-regen {
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 3px 0 var(--ink);
  padding: 4px 14px;
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1.4;
}
.nz-regen:active { transform: translateY(3px); box-shadow: none; }
/* こたえの ポップアップ。幕は fixed(このページは 体ごと スクロールするので)。上の端の帯(.top-edge・z-index 1000)は
   幕より上にして 幕と同じ色にする(iOS 26/27 は 上の端の fixed の色で ステータスバーを ぬる。メモ ios27-top-edge)。
   開いているあいだ うしろは スクロールしない */
.nz-ans-modal {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(69, 58, 47, 0.4);
  animation: nz-fade-in 0.15s ease-out;
}
.nz-ans-modal[hidden] { display: none; }
@keyframes nz-fade-in { from { opacity: 0; } to { opacity: 1; } }
body:has(.nz-ans-modal:not([hidden])) { overflow: hidden; }
body:has(.nz-ans-modal:not([hidden])) .top-edge { background-color: color-mix(in srgb, var(--paper), rgb(69 58 47) 40%); }
.nz-ans-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  max-height: 100%;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 6px 24px rgba(69, 58, 47, 0.3);
  overflow: hidden;
}
.nz-ans-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 10px 8px 16px; }
.nz-ans-title { margin: 0; font-size: 0.95rem; font-weight: 900; }
.nz-ans-close {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 50%;
  font-size: 1.2rem;
  font-weight: 900;
  line-height: 1;
}
.nz-ans-body { overflow: auto; overscroll-behavior: contain; padding: 0 12px 12px; }

/* 見本: 紙(186mm)に 6mm ずつの余白を足した 198mm を、見本の幅に合わせて transform で縮める。
   transform は 場所を縮めないので、見本の高さは JS が入れる --nz-paper-h(縮めたあとの紙の高さ)。
   zoom で縮めると WebKit(iPhone も)は 9px 未満になる字を 9px に戻し(minimumLogicalFontSize)、
   表の数や「かず」が 紙より大きくなって はみ出した(11/30)。transform は 紙の大きさのまま組んで 絵として縮めるので 紙と同じ見た目 */
.nz-preview { margin-top: 8px; }
.nz-paper {
  background: #fff;
  border-radius: 6px;
  /* 紙が 少し 浮いて見える 影(近い影 + やわらかい広い影。12/1 持ち主「もう少しだけ影を」) */
  box-shadow: 0 1px 2px rgba(69, 58, 47, 0.14), 0 6px 18px rgba(69, 58, 47, 0.24);
  overflow: hidden;
}
.nz-paper { height: var(--nz-paper-h, auto); }
.nz-paper .nz-sheet { transform: scale(var(--nz-scale, 0.48)); transform-origin: 0 0; padding: 6mm; box-sizing: content-box; }
.nz-paper-answers { margin-top: 6px; }

/* ---- 説明の節 ---- */
.nz-section-lead { word-break: keep-all; }
.nz-steps { list-style: none; max-width: 560px; margin: 8px auto 0; font-size: 0.92rem; }
.nz-steps li {
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 8px 14px;
  margin-top: 8px;
  word-break: keep-all;
}
.nz-kuku-link,
.nz-cta-lead { text-align: center; font-size: 0.9rem; margin-top: 12px; word-break: keep-all; }
.nz-kuku-link a { color: var(--ink); font-weight: 900; }
/* 使いかた: 本物の紙の 1問めと ひみつのことばの行(紙と同じ class・mm のまま。1問の箱は 約 90mm = スマホの幅)に
   ①〜③ の番号、横(スマホでは下)に ①〜④ の説明。紙らしく 白い台紙に のせる */
.nz-demo { margin: 12px auto 0; max-width: 560px; }
.nz-demo-fig {
  max-width: 92mm;
  margin: 0 auto;
  padding: 3mm;
  background: #fff;
  border-radius: 6px;
  /* 紙が 少し 浮いて見える 影(近い影 + やわらかい広い影。12/1 持ち主「もう少しだけ影を」) */
  box-shadow: 0 1px 2px rgba(69, 58, 47, 0.14), 0 6px 18px rgba(69, 58, 47, 0.24);
}
.nz-demo-fig .nz-demo-sheet { width: auto; }   /* .nz-sheet の 186mm(あとに書いてある)を 打ち消す */
.nz-demo-sheet .nz-final { margin-top: 3mm; }
.nz-demo-sheet .nz-table td.is-hit { background: var(--sun); }
.nz-demo-sheet .nz-box,
.nz-demo-sheet .nz-final-box { position: relative; }
/* 番号の丸(黄色)。線に かぶせない(12/1 持ち主「①②③が 表の枠に被ってる」): ①② は 枠の 真上(表との あいだを あける)、
   ③ と 1行めの ④ は 文・しるしの 右に 並べ、ひみつのことばの行の ④ は しるしの 右 */
.nz-demo-sheet .nz-rows { margin-top: 7mm; }
.nz-demo-sheet .nz-mark { position: relative; }
.nz-call {
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  margin-left: -10px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--sun);
  color: var(--ink);
  font-family: var(--font-num);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}
.nz-call.is-inline { position: static; margin-left: 4px; flex: none; }
.nz-call.is-side { bottom: auto; top: 50%; margin-top: -10px; left: calc(100% + 3px); margin-left: 0; }
/* 2〜5行めは うすく答え(たてに読むと なぞの こたえ に なるのを見せる)。下に「たてに よむと」③ */
.nz-demo-sheet .nz-row.is-faint .nz-box { color: #b4a792; }
.nz-demo-word { display: flex; align-items: center; margin-top: 4mm; font-size: 11pt; line-height: 1.4; white-space: nowrap; }
/* ③ は 文の前(字の枠の 真下に 来ないように。12/1 持ち主「③が 未修正」) */
.nz-call.is-lead { margin: 0 6px 0 0; }
.nz-demo-steps {
  list-style: none;
  margin: 14px auto 0;
  padding: 4px 14px;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 14px;
}
.nz-demo-steps li {
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: center;
  column-gap: 8px;
  padding: 9px 0;
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1.5;
  word-break: keep-all;
}
.nz-demo-steps li + li { border-top: 2px dashed var(--grid); }
/* 句(nz-ph)の中では 折らない。幅が足りなければ 句の あいだで 折る */
.nz-solve .nz-ph,
.nz-howto .nz-ph { display: inline-block; }
/* 宝探しの ① の 下の 注(入れられる 場所の 例) */
.nz-step-note { display: block; margin-top: 2px; font-size: 0.82rem; opacity: 0.8; }
.nz-demo-steps .nz-sf { grid-column: 2; justify-content: flex-start; margin-top: 6px; }
.nz-solve-no {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--sun);
  font-family: var(--font-num);
  font-size: 0.85rem;
  line-height: 1;
}
.nz-sf { display: flex; align-items: center; justify-content: center; gap: 8px; color: #222; }
.nz-sf-box {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border: 2px solid #444;
  border-radius: 6px;
  background: #fff;
  font-family: var(--font-num);
  font-size: 1.2rem;
}
.nz-sf-box.nz-sf-kana { background: #f6ecd8; font-family: var(--font-ui); }
.nz-sf-mark { font-size: 0.95rem; line-height: 1; font-family: 'Hiragino Maru Gothic ProN', sans-serif; }
.nz-sf-final { display: flex; align-items: flex-end; gap: 5px; }
.nz-sf-item { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.nz-sf-done { align-self: flex-end; padding-bottom: 7px; font-size: 1rem; font-weight: 900; white-space: nowrap; }
/* 広い画面: 左に 紙、右に 説明 */
@media (min-width: 760px) {
  .nz-demo { max-width: 820px; display: grid; grid-template-columns: auto minmax(0, 380px); justify-content: center; align-items: center; column-gap: 28px; }
  .nz-demo-fig { margin: 0; }
  .nz-demo-steps { margin: 0; }
}


/* ---- 広い画面: 左に見出しと操作、右に見本 ---- */
@media (min-width: 960px) {
  .nz-tool {
    display: grid;
    /* minmax(0, …): 列の最小が 縮める前の紙の幅(748px)にならないよう 0 から */
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "preview intro" "preview controls";
    grid-template-rows: auto 1fr;
    column-gap: 40px;
  }
  /* 広い画面: 左に 紙、右に 題・操作・何のページか(紙が 先) */
  .nz-intro { grid-area: intro; text-align: left; }
  .nz-tags { justify-content: flex-start; }
  .nz-controls { grid-area: controls; }
  .nz-preview { grid-area: preview; margin-top: 0; min-width: 0; }
}

/* ================= 紙(2-4 節。mm・pt) ================= */
.nz-sheet {
  width: 186mm;
  margin: 0 auto;
  color: #222;
  background: #fff;
  font-family: var(--font-ui);
  font-weight: 700;
  line-height: 1.3;
  text-align: left;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
/* lp.css の main section・main h2 を 紙には効かせない */
main section.nz-sheet { max-width: none; padding: 0; margin: 0 auto; }
.nz-paper section.nz-sheet { padding: 6mm; }
.nz-sheet .nz-title { font-size: 16pt; font-weight: 900; text-align: left; line-height: 1.2; margin: 0; flex: 1; }
.nz-sheet .nz-title::after { display: none; }
.nz-sheet p { margin: 0; }

.nz-head { display: flex; align-items: center; gap: 3mm; height: 11mm; }
.nz-icon { width: 10mm; height: 9mm; flex: none; }
.nz-name { display: flex; align-items: flex-end; gap: 2mm; font-size: 11pt; }
.nz-name-line { display: block; width: 46mm; height: 7mm; border-bottom: 0.4mm solid #444; }
.nz-lead,
.nz-example { font-size: 11pt; line-height: 6mm; white-space: nowrap; }
.nz-example-label { margin-right: 3mm; }
.nz-example-eq { font-family: var(--font-num); }
.nz-ex-box {
  display: inline-block;
  min-width: 6mm;
  height: 5.4mm;
  padding: 0 0.6mm;
  border: 0.4mm solid #444;
  border-radius: 1mm;
  text-align: center;
  line-height: 4.8mm;
  font-size: 10pt;
  vertical-align: middle;
}
.nz-mark { font-family: 'Hiragino Maru Gothic ProN', sans-serif; }

.nz-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4mm 5mm; margin-top: 3mm; }
.nz-block { position: relative; border: 0.4mm solid #333; border-radius: 4mm; padding: 2.5mm 3mm; }
/* 見出しの行(なぞ + 番号の丸 7mm)。右上の まる用の点線は 12/1 に やめた(持ち主「いらない」)ので 低くした */
.nz-block-head { display: flex; align-items: center; gap: 2mm; height: 9mm; }
.nz-no {
  display: grid;
  place-items: center;
  width: 7mm;
  height: 7mm;
  border: 0.4mm solid #222;
  border-radius: 50%;
  font-family: var(--font-num);
  font-size: 12pt;
  line-height: 1;
}
/* 5つ1組の呼び名「なぞ」+ 番号の丸(12/1) */
.nz-nazo { font-size: 12pt; }
.nz-dan { font-size: 11pt; }
/* 数と字の表。2けたの数(九九・くりあがり)でも 境目が見えるよう、線は 問の枠と同じ作り(マスごとの線・0.4mm)にする。
   collapse(となりのマスと線を共有)の 0.3mm は、iPhone の見本で 線が出なかった(11/30 持ち主のスクショ。手元の WebKit では出る)。
   幅は 問の枠いっぱい(マスの数で 等分。九九の 9マスは 約 8.5mm) */
.nz-table { border-collapse: separate; border-spacing: 0; table-layout: fixed; width: 100%; margin-top: 0; }
.nz-table th { width: 8.5mm; font-size: 7.5pt; font-weight: 700; text-align: left; padding: 0 1.4mm 0 0; box-sizing: border-box; white-space: nowrap; }
.nz-table td { text-align: center; border-right: 0.4mm solid #555; border-bottom: 0.4mm solid #555; padding: 0; }
.nz-table th + td { border-left: 0.4mm solid #555; }
.nz-table tr:first-child td { border-top: 0.4mm solid #555; }
.nz-table tr:first-child td { height: 6mm; font-family: var(--font-num); font-size: 12pt; background: #f6f1e6; }
.nz-table tr:last-child td { height: 7.5mm; font-size: 15pt; }
.nz-rows { list-style: none; margin: 1mm 0 0; padding: 0; }
.nz-row { display: flex; align-items: center; height: 12mm; margin-top: 1.5mm; font-size: 18pt; line-height: 1; }
.nz-eq { width: 29mm; text-align: right; font-family: var(--font-num); white-space: nowrap; }
.nz-box {
  display: grid;
  place-items: center;
  width: 12mm;
  height: 12mm;
  margin-left: 1.5mm;
  border: 0.5mm solid #444;
  border-radius: 1.5mm;
  font-family: var(--font-num);
  font-size: 18pt;
}
.nz-box.nz-kana { background: #f6ecd8; font-family: var(--font-ui); margin-left: 0; }
.nz-arrow { font-size: 12pt; margin: 0 1.5mm; }
.nz-row-mark { font-size: 14pt; margin-left: 1.5mm; }

/* 下の行: しるしを 枠の上に置く(字の数が 1〜10 で変わっても 1列に入る)。はじめから書く字は 白い枠に字入り。
   長いことばで 下の文が入らなければ 次の行へ */
.nz-final { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1mm 3mm; margin-top: 3mm; font-size: 12pt; white-space: nowrap; }
.nz-final-label { line-height: 12mm; }
/* 下の文は 枠の まんなかの高さに置き、次の行に回ったときは 低い行にする(A4 に余裕を残す) */
.nz-final-tail { line-height: 7mm; margin-bottom: 2.5mm; }
.nz-final-boxes { display: flex; align-items: flex-end; gap: 2mm; }
.nz-final-item { display: flex; flex-direction: column; align-items: center; gap: 0.5mm; font-size: 14pt; line-height: 6mm; }
.nz-final-box {
  display: grid;
  place-items: center;
  width: 12mm;
  height: 12mm;
  border: 0.5mm solid #444;
  border-radius: 1.5mm;
  background: #f6ecd8;
  font-size: 18pt;
}
.nz-final-box.nz-final-given { background: #fff; color: #222; }
.nz-foot { font-size: 8pt; color: #555; margin-top: 1mm; line-height: 5mm; }

/* 答えの紙(大人むけ。答えは黒い字) */
.nz-ans-lead { font-size: 10pt; }
.nz-ans-big { font-size: 22pt; font-weight: 900; margin-top: 2mm; }
.nz-ans-notes { font-size: 10.5pt; margin-top: 1.5mm; line-height: 1.6; }
.nz-answers .nz-box,
.nz-answers .nz-final-box { color: #000; font-weight: 700; }
.nz-ans-foot { font-size: 8pt; color: #555; margin-top: 1mm; }

/* ================= 印刷 ================= */
@page { size: A4; margin: 10mm; }

@media print {
  html, body { background: #fff; background-image: none; }
  .top-edge,
  .lp-header,
  .nz-crumbs,
  .nz-intro,
  .nz-controls,
  .nz-ans-modal,
  main > section:not(.nz-tool),
  .lp-footer { display: none !important; }
  main section.nz-tool { display: block; padding: 0; max-width: none; }
  .nz-preview { display: block; margin: 0; }
  .nz-paper { box-shadow: none; border-radius: 0; overflow: visible; background: none; height: auto; }
  .nz-paper .nz-sheet,
  .nz-paper section.nz-sheet { transform: none; padding: 0; }
  /* 答えの紙は 画面で かくしていても 印刷には いつも出す。改ページは 答えの紙の前だけ(最後に break を付けない) */
  [data-nz-answers][hidden] { display: block !important; }
  [data-nz-answers] { break-before: page; margin: 0; }
}
