/* ナンプレ固有の見た目（共通は ../common/base.css） */
[hidden] { display: none !important; }

.board-wrap { min-height: 200px; container-type: inline-size; }

/* ---------- 盤: ブロックの並び（太い線）＞ブロックの中のマス（細い線） ---------- */
.np {
  --n: 9; --bc: 3; --br: 3;
  display: grid; grid-template-columns: repeat(calc(var(--n) / var(--bc)), 1fr); gap: 3px;
  width: min(100%, 540px); margin: 0 auto; aspect-ratio: 1;
  background: #1F2328; border: 3px solid #1F2328; border-radius: 4px; color: #1F2328;
}
.np .blk { display: grid; grid-template-columns: repeat(var(--bc), 1fr); grid-template-rows: repeat(var(--br), 1fr); gap: 1px; background: #9A968C; min-width: 0; min-height: 0; }
.cell {
  appearance: none; font: inherit; position: relative; min-width: 0; min-height: 0; padding: 0; margin: 0; border: 0; border-radius: 0; cursor: pointer;
  background: #FFFFFF; color: #2F5D8A; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1;
  font-size: min(calc(100cqw / var(--n) * .56), 34px);
  display: flex; align-items: center; justify-content: center; touch-action: manipulation;
}
.cell.given { color: #1F2328; }
.cell.rel { background: #EAF0F6; }
.cell.same { background: #CFE0F0; }
.cell.sel { background: #B9D2EA; box-shadow: inset 0 0 0 3px #2F5D8A; }
.cell:focus-visible { outline: 3px solid #B7791F; outline-offset: -3px; }
.cell.wrong { color: #B23A3A; background: #FBE9E7; }
.cell.wrong.sel { background: #F5D3CF; }
.cell.dup .v { text-decoration: underline wavy #B23A3A; text-underline-offset: 3px; }
.cell.hintcell { box-shadow: inset 0 0 0 3px #B7791F; }
.cell.hintcell::after { content: ''; position: absolute; inset: 3px; border: 2px dashed #B7791F; pointer-events: none; }
.cell.hsrc { background: #FFF1CF; }
.cell.helim { background: #FBE9E7; }
.cell.shown { color: #5B616B; font-style: italic; }
.cell.pop .v { animation: pop-in .2s ease-out; display: inline-block; }
.cell.win { animation: flash .6s ease-out; animation-delay: calc(var(--i, 0) * 12ms); }
@keyframes pop-in { from { transform: scale(.6); } to { transform: none; } }
@keyframes flash { 0%, 100% { background: #FFFFFF; } 40% { background: #CDE8D6; } }

/* メモ（候補の小さな数字） */
.memo { position: absolute; inset: 1px; display: grid; grid-template-columns: repeat(var(--mc, 3), 1fr); grid-template-rows: repeat(var(--mr, 3), 1fr); pointer-events: none; }
.memo span { display: flex; align-items: center; justify-content: center; font-size: min(calc(100cqw / var(--n) / var(--mc, 3) * .78), 13px); font-weight: 600; color: #4B5563; line-height: 1; }
.memo span.hl { background: #2F5D8A; color: #FFFFFF; border-radius: 3px; }
.memo span.x { color: #B23A3A; text-decoration: line-through; }

/* ---------- 道具（メモ・元に戻す・ヒント） ---------- */
.tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 12px auto 0; max-width: 540px; }
.tool { display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; font-size: 16px; flex: 1 1 0; justify-content: center; white-space: nowrap; }
.tool svg { width: 20px; height: 20px; flex: none; }
.tool[aria-pressed="true"] { background: var(--btn); border-color: var(--btn); color: var(--btn-ink); }
.tools .softkb-btn { flex: 1 1 0; justify-content: center; }

/* ---------- 数字パッド ---------- */
.pad { --cols: 5; display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 6px; max-width: 540px; margin: 10px auto 0; }
.key {
  appearance: none; font: inherit; position: relative; font-size: 26px; font-weight: 700; min-height: 52px; padding: 0 2px; font-variant-numeric: tabular-nums;
  border-radius: var(--radius); border: 2px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; touch-action: manipulation;
}
.key small { position: absolute; right: 4px; bottom: 2px; font-size: 14px; line-height: 1.1; font-weight: 600; color: var(--ink-sub); }
.key.done { opacity: .32; }
.key.memo-mode { color: var(--accent); border-style: dashed; font-size: 20px; }
.key.here { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.key.erase { font-size: 16px; color: var(--accent); }
.key:active:not(:disabled) { transform: translateY(1px); }
.key:disabled { cursor: not-allowed; opacity: .4; }
.key:focus-visible { outline: 3px solid var(--warn); outline-offset: 2px; }
.after { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.timer { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 18px; min-width: 56px; text-align: right; margin-left: auto; }
.linkbtn { display: inline-flex; align-items: center; text-decoration: none; }

/* ---------- ヒント・記録 ---------- */
.think { margin: 10px auto 0; max-width: 640px; border: 2px solid var(--line); border-radius: var(--radius); padding: 10px 14px; background: var(--surface); }
.think h3 { margin: 0 0 4px; font-size: 16px; }
.think p { margin: 0 0 6px; }
.think p:last-child { margin-bottom: 0; }
.think ol { margin: 0 0 6px; padding-left: 1.4em; }
.think .tech { display: inline-block; font-weight: 700; color: var(--accent); }
.think .alias { color: var(--ink-sub); font-size: 14px; }
.lv { display: inline-block; white-space: nowrap; font-size: 14px; font-weight: 700; padding: 0 8px; border-radius: 999px; border: 1.5px solid currentColor; margin-left: 6px; vertical-align: middle; }
.lv.l1, .lv.l2 { color: var(--ok); } .lv.l3 { color: var(--accent); } .lv.l4 { color: var(--warn); } .lv.l5 { color: var(--ng); }

.loading { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); background: var(--surface); color: var(--ink); border: 2px solid var(--line); border-radius: var(--radius); padding: 10px 18px; font-weight: 700; z-index: 2; }
.result-box { inset: 8% 4% auto; z-index: 2; }
.result-box .big { font-size: 1.4rem; font-weight: 700; margin-bottom: 8px; }
.result-box ul { list-style: none; padding: 0; margin: 0 0 8px; font-variant-numeric: tabular-nums; }
.callout { z-index: 3; top: 50%; }

@media (max-width: 480px) {
  .stage { padding: 8px; }
  .key { min-height: 48px; font-size: 24px; }
  .pad { gap: 5px; }
  .tools { gap: 6px; }
  .tool, .tools .softkb-btn { padding: 0 4px; font-size: 14px; gap: 3px; min-width: 0; }
  .tools svg { display: none; }
  .controls .btn.icon { padding: 0 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .cell.pop .v, .cell.win { animation: none; }
}
/* 上のバーの高さを一定に（No.93。数字は一番長い文が画面の幅（360px・375px 以上・641px 以上）で何行になるか。--tb-rt はふりがなの分。base.css・turnbar.js） */
.turnbar { --tb-msg-lines: 3; --tb-st-lines: 1; --tb-rt: 0px; --tb-st-rt: 0px; }
@media (min-width: 375px) { .turnbar { --tb-msg-lines: 3; --tb-st-lines: 1; } }
@media (min-width: 641px) { .turnbar { --tb-msg-lines: 2; --tb-st-lines: 1; } }
:root:lang(en) .turnbar { --tb-msg-lines: 4; --tb-st-lines: 2; --tb-rt: 0px; --tb-st-rt: 0px; }
@media (min-width: 375px) { :root:lang(en) .turnbar { --tb-msg-lines: 3; --tb-st-lines: 2; } }
@media (min-width: 641px) { :root:lang(en) .turnbar { --tb-msg-lines: 2; --tb-st-lines: 1; } }
/* 上のバーの高さ ここまで */
