/* 推しぬいを漫画の1コマに（/nui-koma/）。日英共通。
   広い画面: 左に 01 写真・02 場面・03 切り抜き、右に仕上がりと 04 保存（追従）。
   狭い画面: 01 → 仕上がり → 02 → 03 → 04 の順（.nk-right を display: contents にして並べ替える） */
[hidden] { display: none !important; }
.nk { --n-line: var(--hairline, #e5e7eb); --n-acc: var(--accent, #b45309); --n-soft: var(--ink-soft, #4b5563); --n-ink: var(--ink, #1f2937); --n-wash: #fdf7ef;
  border: 1px solid var(--n-line); background: var(--panel, #fff); padding: 22px; margin-bottom: 8px; position: relative; }
.nk.is-drag { outline: 2px dashed var(--n-acc); outline-offset: -8px; }
.nk-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 380px); column-gap: 24px; align-items: start; }
.nk-s1 { grid-column: 1; grid-row: 1; }
.nk-s2 { grid-column: 1; grid-row: 2; }
.nk-s3 { grid-column: 1; grid-row: 3; }
.nk-right { grid-column: 2; grid-row: 1 / span 4; position: sticky; top: 76px; }
.nk-step + .nk-step { margin-top: 0; }
.nk-step { padding: 0 0 20px; }
.nk-s2, .nk-s3 { border-top: 1px solid var(--n-line); padding-top: 18px; }
.nk-h { display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; font-size: 17px; font-weight: 700; color: var(--n-ink); border: 0; padding: 0; }
.nk-h span { font: 500 12px/1 var(--mono); color: var(--n-acc); letter-spacing: .06em; }

/* 01 写真 */
.nk-pick { display: flex; flex-wrap: wrap; gap: 10px; }
.nk-pick .nk-btn:first-child { flex: 1 1 180px; }
.nk-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.nk-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 50px; padding: 0 20px; 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; text-align: center; cursor: pointer; transition: transform .08s ease, background-color .15s; }
.nk-btn:hover { background: var(--accent-dark, #92400e); }
.nk-btn:active { transform: scale(.97); }
.nk-btn.sub { background: #fff; color: var(--n-ink); border-color: var(--hairline-strong, #d1d5db); font-weight: 500; font-size: 15px; }
.nk-btn.sub:hover { border-color: var(--n-acc); color: var(--n-acc); }
.nk-btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.nk-btn.is-busy { cursor: progress; }
label.nk-btn:focus-within, .nk-file:focus-visible + * { outline: 2px solid var(--n-acc); outline-offset: 2px; }
.nk-src { margin: 10px 0 0; min-height: 1.5em; font: 500 12px/1.5 var(--mono); color: var(--n-soft); overflow-wrap: anywhere; }
.nk-tip { margin: 6px 0 0; font-size: 13px; line-height: 1.7; color: var(--n-soft); }

/* 仕上がり */
.nk-frame { position: relative; background: #f3f4f6; aspect-ratio: 1080 / 1350; box-shadow: 0 1px 0 var(--n-line), 0 12px 32px -18px rgba(17, 24, 39, .35); }
.nk-frame canvas { display: block; width: 100%; height: 100%; }
.nk-fail { position: absolute; inset: 0; display: grid; align-content: center; gap: 10px; padding: 28px; background: rgba(255, 255, 255, .94); text-align: left; border: 2px solid var(--ng, #c03434); }
.nk-fail-h { margin: 0; font-size: 20px; line-height: 1.5; font-weight: 700; color: var(--ng, #c03434); }
.nk-fail-s { margin: 0; font-size: 14px; line-height: 1.75; color: var(--n-ink); }
.nk-meta { display: flex; justify-content: space-between; gap: 8px; margin: 8px 0 14px; font: 500 12px/1.4 var(--mono); color: var(--n-soft); }
.nk-ms { color: var(--n-acc); }

/* 02 場面 */
.nk-scenes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.nk-scenes button { display: grid; grid-template-columns: 46px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 10px; align-items: center; text-align: left;
  min-height: 64px; padding: 8px 10px; border: 1px solid var(--hairline-strong, #d1d5db); background: #fff; color: var(--n-ink); font: inherit; cursor: pointer; transition: transform .08s ease, border-color .15s; }
.nk-scenes button:hover { border-color: var(--n-acc); }
.nk-scenes button:active { transform: scale(.97); }
.nk-scenes button[aria-pressed="true"] { border-color: var(--n-ink); box-shadow: inset 0 0 0 1px var(--n-ink); background: var(--n-wash); }
.nk-scenes b { grid-column: 2; font-size: 15px; line-height: 1.3; }
.nk-scenes span { grid-column: 2; font-size: 12px; line-height: 1.4; color: var(--n-soft); }
.nk-ico { grid-row: 1 / span 2; width: 46px; height: 46px; border: 2px solid #111; position: relative; overflow: hidden; background: #fff; }
.nk-ico.is-arrival { background: repeating-linear-gradient(0deg, #fff 0 5px, #111 5px 6.5px, #fff 6.5px 11px), #fff; background-color: #dcecfb; }
.nk-ico.is-arrival::after { content: ""; position: absolute; left: 13px; bottom: 4px; width: 18px; height: 18px; border-radius: 50%; background: #f4d9a2; border: 2px solid #111; }
.nk-ico.is-wait { background: repeating-conic-gradient(from 0deg at 50% 60%, #fff 0 4deg, #2a2050 4deg 12deg); }
.nk-ico.is-wait::after { content: ""; position: absolute; left: 13px; top: 15px; width: 16px; height: 16px; border-radius: 50%; background: #2a2050; box-shadow: 0 0 0 5px #2a2050; }
.nk-ico.is-home { background: linear-gradient(#9aa1ae, #e3e5ea); }
.nk-ico.is-home::before { content: ""; position: absolute; inset: 0 3px 16px; background: repeating-linear-gradient(90deg, rgba(20,22,30,.7) 0 2px, transparent 2px 6px); }
.nk-ico.is-birthday { background: radial-gradient(circle at 50% 60%, #ffe6ef 0 30%, #ffd2e2 31% 100%); }
.nk-ico.is-birthday::before, .nk-ico.is-birthday::after { content: ""; position: absolute; width: 14px; height: 14px; background: #fff6c9; border: 0; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
.nk-ico.is-birthday::before { left: 6px; top: 6px; filter: drop-shadow(0 0 1px #111); }
.nk-ico.is-birthday::after { right: 6px; top: 16px; width: 18px; height: 18px; filter: drop-shadow(0 0 1px #111); }
.nk-line-row { display: flex; justify-content: space-between; align-items: baseline; margin: 16px 0 6px; }
.nk-line-l { font-size: 14px; font-weight: 700; }
.nk-count { font: 500 12px/1 var(--mono); color: var(--n-soft); }
.nk-line { width: 100%; min-height: 48px; padding: 8px 12px; border: 1px solid var(--hairline-strong, #d1d5db); border-radius: 0; background: #fff; font: inherit; font-size: 18px; font-weight: 700; color: var(--n-ink); }
.nk-line:focus { outline: 2px solid var(--n-acc); outline-offset: 1px; border-color: var(--n-acc); }

/* 03 切り抜き */
.nk-cutrow { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr); gap: 14px; align-items: start; }
.nk-cutbox { border: 1px solid var(--n-line); background-color: #fff; background-image: conic-gradient(#e7e7e7 25%, #fff 0 50%, #e7e7e7 0 75%, #fff 0); background-size: 16px 16px; display: grid; place-items: center; min-height: 140px; }
.nk-cutbox canvas { display: block; max-width: 100%; height: auto; max-height: 260px; }
.nk-tol { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; font-weight: 700; }
.nk-tol output { font: 500 15px/1 var(--mono); color: var(--n-acc); min-width: 2.5em; text-align: right; }
#nk-tol { width: 100%; margin: 10px 0 4px; accent-color: var(--n-acc); min-height: 32px; }
.nk-cut-stat { margin: 8px 0 0; font: 500 12px/1.5 var(--mono); color: var(--n-soft); }
.nk-cut-hint { margin: 6px 0 0; padding: 8px 10px; font-size: 13px; line-height: 1.6; background: #fff7e6; border-left: 3px solid #e2a33b; color: #6b4300; }

/* 04 保存 */
.nk-s4 { border-top: 1px solid var(--n-line); padding-top: 14px; }
.nk-check { margin: 0 0 12px; padding: 10px 12px; font-size: 13.5px; line-height: 1.75; background: #fffbeb; border: 1px solid #f3d999; color: #4a3500; }
.nk-check b { display: block; font-size: 12px; letter-spacing: .04em; color: #92400e; margin-bottom: 2px; }
.nk-actions { display: grid; gap: 8px; }
.nk-msg { margin: 8px 0 0; min-height: 1.5em; font-size: 13px; font-weight: 700; color: var(--ok, #2e7d43); }
.nk-fine { margin: 4px 0 0; font-size: 12px; line-height: 1.7; color: var(--n-soft); }
.nk.is-fail .nk-meta .nk-ms { visibility: hidden; }

/* 比較表 */
.nk-cmp-h { margin: 28px 0 10px; font-size: 16px; }
.nk-cmp-wrap { overflow-x: auto; }
.nk-cmp { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 13px; line-height: 1.6; }
.nk-cmp th, .nk-cmp td { border-bottom: 1px solid var(--hairline, #e5e7eb); padding: 8px 10px; text-align: left; vertical-align: top; }
.nk-cmp thead th { font-size: 12px; color: var(--ink-soft, #4b5563); font-weight: 700; border-bottom: 2px solid var(--ink, #1f2937); }
.nk-cmp thead th:nth-child(2), .nk-cmp td:nth-child(2) { background: #fffbeb; }
.nk-cmp tbody th { white-space: nowrap; font-weight: 700; }
.nk-cmp-note { margin: 8px 0 0; font-size: 12px; color: var(--ink-soft, #4b5563); }
.nk-all { margin: 14px 0 0; font-size: 14px; }

@media (max-width: 860px) {
  .nk-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 340px); column-gap: 20px; }
  .nk-scenes { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .nk { padding: 16px; }
  .nk-grid { display: flex; flex-direction: column; }
  .nk-right { display: contents; }
  .nk-s1 { order: 1; }
  .nk-result { order: 2; }
  .nk-s2 { order: 3; }
  .nk-s3 { order: 4; }
  .nk-s4 { order: 5; padding-bottom: 0; }
  .nk-result { margin: 0 -4px; }
  .nk-scenes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nk-scenes button { grid-template-columns: 36px minmax(0, 1fr); padding: 8px; column-gap: 8px; }
  .nk-ico { width: 36px; height: 36px; }
  .nk-ico.is-arrival::after { left: 8px; width: 14px; height: 14px; }
  .nk-ico.is-wait::after { left: 9px; top: 11px; width: 12px; height: 12px; }
  .nk-scenes span { font-size: 11px; }
  .nk-cutrow { grid-template-columns: minmax(0, 130px) minmax(0, 1fr); gap: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .nk-btn, .nk-scenes button { transition: none; }
  .nk-btn:active, .nk-scenes button:active { transform: none; }
}
