/* 中袋の記入欄に収める下書き（/nakabukuro-ran/）。左に欄の寸法と入力、右に字の大きさ・下書き・共有の画像。印刷では原寸の下書きだけを出す */
[hidden] { display: none !important; }
.nb { --n-line: var(--hairline, #e5e7eb); --n-acc: var(--accent, #b45309); --n-soft: var(--ink-soft, #4b5563); --n-wash: #fbf6ee; --n-ink: #8d939b;
  border: 1px solid var(--n-line); background: var(--panel, #fff); padding: 20px; margin-bottom: 8px; }
.nb-work { display: grid; grid-template-columns: minmax(0, 330px) minmax(0, 1fr); gap: 24px; align-items: start; }

/* 入力 */
.nb-orient { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--hairline-strong, #d1d5db); }
.nb-orient button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; border: 0; background: #fff; color: var(--ink, #1f2937);
  font: inherit; font-size: 15px; font-weight: 500; cursor: pointer; transition: background-color .15s, color .15s; }
.nb-orient button + button { border-left: 1px solid var(--hairline-strong, #d1d5db); }
.nb-orient button[aria-pressed="true"] { background: var(--ink, #1f2937); color: #fff; }
.nb-ico { display: inline-block; border: 1.5px solid currentColor; }
.nb-ico.is-v { width: 9px; height: 18px; }
.nb-ico.is-h { width: 18px; height: 9px; }
.nb-hint { margin: 6px 0 0; font-size: 12px; line-height: 1.6; color: var(--n-soft); }
.nb-field { margin: 14px 0 0; padding: 12px 0 0; border: 0; border-top: 1px solid var(--n-line); min-width: 0; }
.nb-field legend { float: left; width: 100%; padding: 0; display: flex; align-items: baseline; gap: 8px; }
.nb-field legend + * { clear: both; }
.nb-field legend span { font-size: 16px; font-weight: 700; color: var(--ink, #1f2937); }
.nb-field legend small { font: 500 11px/1 var(--mono); color: var(--n-acc); letter-spacing: .04em; }
.nb-field.is-address { border-top: 2px solid var(--ink, #1f2937); }
.nb-dims { display: flex; align-items: center; gap: 8px; margin: 10px 0 10px; }
.nb-dims label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--n-soft); }
.nb-dims input { width: 64px; min-height: 40px; padding: 0 8px; border: 1px solid var(--hairline-strong, #d1d5db); font: 500 17px/1 var(--mono); text-align: right; color: var(--ink, #1f2937); background: #fff; }
.nb-dims span { font: 500 12px/1 var(--mono); color: var(--n-soft); }
.nb-x { color: #9ca3af; }
.nb-l { display: block; font-size: 13px; color: var(--n-soft); margin: 8px 0 0; }
.nb-l input, .nb-l select, .nb-addr { display: block; width: 100%; margin-top: 4px; min-height: 40px; padding: 6px 10px; border: 1px solid var(--hairline-strong, #d1d5db);
  font: inherit; font-size: 16px; color: var(--ink, #1f2937); background: #fff; }
.nb-addr { resize: vertical; line-height: 1.6; min-height: 84px; }
.nb-dims input:focus, .nb-l input:focus, .nb-l select:focus, .nb-addr:focus { outline: 2px solid var(--n-acc); outline-offset: -1px; border-color: var(--n-acc); }
.nb-row2 { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.nb-row2 .nb-chk { margin-bottom: 10px; }
.nb-chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink, #1f2937); cursor: pointer; }
.nb-chk input { width: 17px; height: 17px; accent-color: var(--n-acc); margin: 0; }
.nb-chks { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; }
.nb-yen { display: flex; align-items: center; gap: 6px; }
.nb-yen input { flex: 1; font-family: var(--mono); }
.nb-yen span { font-size: 14px; color: var(--ink, #1f2937); margin-top: 4px; }
.nb-daiji { margin: 8px 0 0; min-height: 1.6em; font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif; font-size: 19px; letter-spacing: .08em; color: var(--ink, #1f2937); }

/* 結果 */
.nb-result { min-width: 0; }
.nb-read { border-left: 3px solid var(--n-acc); padding: 2px 0 2px 14px; }
.nb-read-h { margin: 0; font-size: 13px; color: var(--n-soft); }
.nb-size { margin: 0; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.nb-size b { font: 500 52px/1.1 var(--mono); letter-spacing: -.02em; color: var(--ink, #1f2937); }
.nb-size span { font: 500 18px/1 var(--mono); color: var(--n-soft); }
.nb-size em { font-style: normal; margin-left: 10px; font-size: 15px; font-weight: 700; color: var(--ink, #1f2937); }
.nb-verdict { margin: 4px 0 8px; font-size: 13px; line-height: 1.6; color: var(--n-soft); }
.nb-verdict.is-ok { color: var(--ok, #2e7d43); }
.nb-verdict.is-ok::before { content: "○ "; }
.nb-verdict.is-small { color: #9a3412; }
.nb-verdict.is-small::before { content: "! "; font-weight: 700; }
.nb-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nb-lines li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 8px; font-size: 14px; line-height: 1.55; }
.nb-lines span { font: 500 11px/1.9 var(--mono); color: var(--n-acc); }
.nb-lines b { font-weight: 500; overflow-wrap: anywhere; font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif; }

.nb-alts { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 8px; margin-top: 14px; }
.nb-alts:empty { display: none; }
.nb-alt { display: grid; gap: 2px; text-align: left; padding: 10px 12px; border: 1px solid var(--hairline-strong, #d1d5db); background: #fff; color: var(--ink, #1f2937);
  font: inherit; cursor: pointer; transition: border-color .15s, background-color .15s, transform .08s; }
.nb-alt:hover { border-color: var(--n-acc); }
.nb-alt:active { transform: scale(.98); }
.nb-alt[aria-pressed="true"] { border-color: var(--ink, #1f2937); background: var(--n-wash); box-shadow: inset 0 0 0 1px var(--ink, #1f2937); }
.nb-alt-h { font-size: 12px; color: var(--n-soft); }
.nb-alt b { font: 500 26px/1.1 var(--mono); }
.nb-alt b small { font-size: 12px; margin-left: 2px; color: var(--n-soft); }
.nb-alt.is-ok b { color: var(--ok, #2e7d43); }
.nb-alt-n { font-size: 12px; color: var(--n-soft); }
.nb-alt-u { margin-top: 4px; font-size: 12px; font-weight: 700; color: var(--n-acc); }
.nb-alt[aria-pressed="true"] .nb-alt-u { color: var(--ink, #1f2937); }
.nb-alt-note { margin: 8px 0 0; font-size: 12px; line-height: 1.6; color: var(--n-soft); }

/* 下書きの枠（画面）。--k は 1mm あたりの px（app.js が欄の大きさと画面の幅から決める） */
.nb-boxes { --k: 4; margin-top: 18px; padding: 18px 12px 14px; background: var(--n-wash); border: 1px solid #eadfcd;
  display: flex; gap: 18px; justify-content: center; align-items: flex-start; flex-wrap: wrap; }
.nb.is-v .nb-boxes { flex-direction: row-reverse; flex-wrap: nowrap; }
.nb.is-h .nb-boxes { flex-direction: column; align-items: center; }
.nb-box { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.nb-box figcaption { display: grid; justify-items: center; color: var(--n-soft); white-space: nowrap; }
.nb-box figcaption b { font-size: 12px; font-weight: 700; line-height: 1.4; }
.nb-box figcaption span { font: 500 11px/1.3 var(--mono); }
.nb-box.is-address figcaption { color: var(--n-acc); }
.nb-svg { display: block; width: calc(var(--w) * var(--k) * 1px); height: calc(var(--h) * var(--k) * 1px); background: #fff; overflow: visible; }
.nb-frame { fill: none; stroke: #2b2f36; stroke-width: .3; }
.nb-box.is-address .nb-frame { stroke: var(--n-acc, #b45309); stroke-width: .45; }
.nb-cells rect { fill: none; stroke: #e7dccb; stroke-width: .12; stroke-dasharray: .5 .4; }
.nb-ink { fill: var(--n-ink); }
.nb.is-flash .nb-box.is-address .nb-svg { animation: nb-flash .35s ease-out; }
@keyframes nb-flash { from { opacity: .55; } to { opacity: 1; } }

.nb-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 14px; }
.nb-actions p { flex: 1 1 220px; margin: 0; font-size: 12px; line-height: 1.6; color: var(--n-soft); }
.nb-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 22px; border: 1px solid var(--n-acc); background: var(--n-acc); color: #fff;
  font-family: inherit; font-size: 16px; font-weight: 700; line-height: 1.2; cursor: pointer; transition: transform .08s ease, background-color .15s; }
.nb-btn:hover { background: var(--accent-dark, #92400e); }
.nb-btn:active { transform: scale(.97); }
.nb-btn.sub { background: #fff; color: var(--ink, #1f2937); border-color: var(--hairline-strong, #d1d5db); font-weight: 500; font-size: 15px; min-height: 44px; }
.nb-btn.sub:hover { border-color: var(--n-acc); color: var(--n-acc); }

.nb-sharebox { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--n-line); }
.nb-sharebox-h { margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.nb-sharebox-h b { font-size: 14px; }
.nb-sharebox-h span { font-size: 12px; color: var(--n-soft); }
#nb-share-img { display: block; width: 100%; height: auto; max-width: 520px; border: 1px solid var(--n-line); }
.nb.is-h #nb-share-img { max-width: none; }
.nb-share-act { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.nb-msg { margin: 6px 0 0; min-height: 1.4em; font-size: 13px; color: var(--ok, #2e7d43); }
.nb-all { margin: 14px 0 0; font-size: 14px; }

.nb-sheet { display: none; }
.nb-peek { display: none; }
@media (max-width: 760px) {
  .nb-peek:not([hidden]) { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 10px;
    min-height: 48px; padding: 0 16px; background: var(--ink, #1f2937); color: #fff; text-decoration: none; font-size: 14px; box-shadow: 0 6px 18px rgba(17,24,39,.22);
    animation: nb-peek .18s ease-out; }
  .nb-peek span { font-family: var(--mono); font-weight: 500; }
  .nb-peek.is-small span { color: #fdba74; }
  .nb-peek b { font-size: 13px; white-space: nowrap; }
}
@keyframes nb-peek { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 760px) {
  .nb { padding: 14px; }
  .nb-work { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .nb-size b { font-size: 44px; }
  .nb-boxes { padding: 14px 6px 10px; gap: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .nb.is-flash .nb-box.is-address .nb-svg { animation: none; }
  .nb-btn, .nb-alt, .nb-orient button { transition: none; }
  .nb-peek:not([hidden]) { animation: none; }
}

/* 印刷: 原寸の下書きだけを A4 に出す（拡大縮小なし＝100% で印刷すると欄と同じ大きさになる） */
@page { size: A4 portrait; margin: 12mm; }
@media print {
  body > *:not(.nb-sheet) { display: none !important; }
  body { background: #fff !important; margin: 0; }
  .nb-sheet { display: block !important; color: #111; font-family: "IBM Plex Sans JP", "Hiragino Sans", "Noto Sans JP", sans-serif; }
  .nb-sheet-h { margin: 0 0 1mm; font-size: 12pt; font-weight: 700; }
  .nb-sheet-n { margin: 0 0 3mm; font-size: 8.5pt; line-height: 1.5; color: #444; }
  .nb-ruler { display: flex; align-items: center; gap: 2mm; margin: 0 0 6mm; font-size: 8pt; color: #444; }
  .nb-ruler span { display: block; width: 50mm; height: 2.5mm; border: .25mm solid #111; border-top: 0; }
  .nb-sheet-boxes { display: flex; gap: 8mm; align-items: flex-start; flex-wrap: wrap; }
  .nb-sheet-boxes.is-v { flex-direction: row-reverse; justify-content: flex-end; }
  .nb-sheet-boxes.is-h { flex-direction: column; }
  .nb-sheet .nb-box { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 1.5mm; break-inside: avoid; }
  .nb-sheet .nb-box figcaption { display: block; font-size: 7.5pt; line-height: 1.3; color: #444; white-space: nowrap; text-align: center; }
  .nb-sheet .nb-box figcaption b { font-size: 7.5pt; margin-right: 1.5mm; }
  .nb-sheet .nb-box figcaption span { font: inherit; }
  .nb-sheet .nb-svg { width: calc(var(--w) * 1mm); height: calc(var(--h) * 1mm); background: none; }
  .nb-sheet .nb-box .nb-frame { stroke: #222; stroke-width: .25; }
  .nb-sheet .nb-cells rect { stroke: #d0d0d0; stroke-width: .1; }
  .nb-sheet .nb-ink { fill: #a6a6a6; }
}
