/* 魔方陣パズル固有の見た目（共通は ../common/base.css） */
[hidden] { display: none !important; }

.board-wrap { min-height: 200px; container-type: inline-size; }

/* ---------- 盤（n×n のマス＋右に横の和・下に縦の和・右上と右下に斜めの和） ---------- */
.ms {
  --n: 3; --gap: 4px;
  display: grid; grid-template-columns: repeat(var(--n), 1fr) .78fr; gap: var(--gap);
  width: min(100%, calc((var(--n) + .78) * 88px)); margin: 0 auto;
  background: var(--board); color: #1F2328; border: 2px solid var(--line); border-radius: var(--radius); padding: 8px;
}
.ms .top { grid-column: 1 / -2; display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: #5B616B; padding-left: 2px; }
.ms .top b { color: #1F2328; font-size: 16px; }
.cell {
  appearance: none; font: inherit; position: relative; aspect-ratio: 1; min-width: 0; padding: 0; cursor: pointer;
  border: 2px solid #C9C4B8; border-radius: 6px; background: #FFFFFF; color: var(--accent-light, #2F5D8A);
  font-size: min(calc(100cqw / (var(--n) + .78) * .42), 40px); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--dur), border-color var(--dur);
}
.cell.given { background: #ECE8DD; color: #1F2328; cursor: default; }
.cell.given::after { content: ''; position: absolute; left: 4px; top: 4px; width: 6px; height: 6px; border-radius: 50%; background: #8A8F97; }
.cell.rel { background: #EEF3F8; }
.cell.given.rel { background: #E2E3DF; }
.cell.lineok { background: #E6F3EA; }
.cell.given.lineok { background: #D8EADC; }
.cell.sel { border: 3px solid #2F5D8A; box-shadow: inset 0 0 0 2px #FFFFFF; }
.cell:focus-visible { outline: 3px solid var(--warn); outline-offset: 2px; }
.cell.wrong { background: #FBE9E7; border-color: #B23A3A; color: #B23A3A; }
.cell.dup { color: #B23A3A; }
.cell.hintcell { border: 3px dashed #B7791F; }
.cell.shown { color: #5B616B; font-style: italic; }
.cell.pending { color: #B7791F; }
.cell.pending::before { content: ''; position: absolute; left: 22%; right: 22%; bottom: 14%; height: 3px; background: #B7791F; animation: blink 1s steps(1) infinite; }
.cell.pop { animation: pop-in .2s ease-out; }
.cell.win { background: #E6F3EA; border-color: #2E7D4F; animation: jump .5s ease-out; animation-delay: calc(var(--i, 0) * 40ms); }
@keyframes pop-in { from { transform: scale(.8); } to { transform: none; } }
@keyframes jump { 0%, 100% { transform: none; } 40% { transform: translateY(-8px); } 70% { transform: translateY(2px); } }
@keyframes blink { 50% { opacity: 0; } }

/* 和の札 */
.sum {
  display: flex; align-items: center; justify-content: center; gap: 2px; min-width: 0; min-height: 30px;
  border-radius: 6px; border: 2px solid transparent; color: #5B616B; font-weight: 700; font-variant-numeric: tabular-nums;
  font-size: min(calc(100cqw / (var(--n) + .78) * .26), 22px); line-height: 1.1;
}
.sum.col { aspect-ratio: auto; padding: 4px 0; }
.sum.row { align-self: center; height: 64%; }
.sum b { font-weight: 700; }
.sum svg { width: .8em; height: .8em; flex: none; }
.sum.part { color: #5B616B; }
.sum.ok { background: #2E7D4F; color: #FFFFFF; }
.sum.ng { background: #FBE9E7; color: #B23A3A; border-color: #B23A3A; }
.sum.rel { border-color: #2F5D8A; }
.sum.ok.rel { border-color: #1F2328; }
.sum.anti { align-self: end; }
.sum .mark { font-size: .75em; margin-left: 1px; }

.pending-note { margin: 6px auto 0; max-width: 520px; font-size: 15px; color: var(--ink); background: var(--accent-soft); border-radius: var(--radius); padding: 4px 10px; text-align: center; }

/* ---------- 数字パッド ---------- */
.pad { --cols: 5; display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 6px; max-width: 560px; margin: 12px auto 0; }
.key {
  appearance: none; font: inherit; font-size: 24px; font-weight: 700; min-height: 48px; 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;
}
.key.used { opacity: .38; }
.key.given { opacity: .2; cursor: not-allowed; border-style: dashed; }
.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; }
.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; }

/* ---------- ヒント・記録 ---------- */
.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 .calc { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.think .ok-t { color: var(--ok); }
.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.easy { color: var(--ok); } .lv.normal { color: var(--accent); } .lv.hard { color: var(--ng); } .lv.blank { color: var(--ink-sub); }

.result-box { inset: 6% 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: 45%; }

@media (max-width: 420px) {
  .ms { padding: 6px; --gap: 3px; }
  .key { min-height: 44px; font-size: 21px; }
  .pad { gap: 5px; }
  .stage { padding: 8px; }
  .controls .btn.icon { padding: 0 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .cell.pop, .cell.win, .cell.pending::before { animation: none; }
}
.howto img.narrow { max-width: 560px; }
/* 上のバーの高さを一定に（No.93。数字は一番長い文が画面の幅（360px・375px 以上・641px 以上）で何行になるか。--tb-rt はふりがなの分。base.css・turnbar.js） */
.turnbar { --tb-msg-lines: 2; --tb-st-lines: 1; --tb-rt: 0px; --tb-st-rt: 0px; }
@media (min-width: 375px) { .turnbar { --tb-msg-lines: 2; --tb-st-lines: 1; } }
@media (min-width: 641px) { .turnbar { --tb-msg-lines: 1; --tb-st-lines: 1; } }
:root:lang(en) .turnbar { --tb-msg-lines: 2; --tb-st-lines: 2; --tb-rt: 0px; --tb-st-rt: 0px; }
@media (min-width: 375px) { :root:lang(en) .turnbar { --tb-msg-lines: 2; --tb-st-lines: 2; } }
@media (min-width: 641px) { :root:lang(en) .turnbar { --tb-msg-lines: 1; --tb-st-lines: 1; } }
/* 上のバーの高さ ここまで */
