/* たし算クロス固有の見た目（共通は ../common/base.css） */
[hidden] { display: none !important; }

.board-wrap { min-height: 200px; container-type: inline-size; }

/* ---------- 盤: 黒マス（ヒント）と白マス。盤の地は紙のように明るいまま（ダークでも） ---------- */
.kx {
  --w: 6; --h: 6;
  --kx-ink: #1F2328; --kx-blk: #3E444D; --kx-blk-ink: #F4F2EC; --kx-diag: #8B919A; --kx-line: #9A968C;
  --cs: calc(100cqw / var(--w));
  display: grid; grid-template-columns: repeat(var(--w), 1fr); gap: 1px;
  width: min(100%, calc(66px * var(--w)), 560px); margin: 0 auto; aspect-ratio: var(--w) / var(--h);
  background: var(--kx-line); border: 3px solid var(--kx-blk); border-radius: 4px; color: var(--kx-ink);
  container-type: inline-size;
}
.kx .b { position: relative; background: var(--kx-blk); min-width: 0; min-height: 0; }
.kx .b.clue { background: linear-gradient(to top right, var(--kx-blk) calc(50% - 1px), var(--kx-diag) calc(50% - .5px), var(--kx-diag) calc(50% + .5px), var(--kx-blk) calc(50% + 1px)); }
.kx .b .a, .kx .b .d {
  position: absolute; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; color: var(--kx-blk-ink);
  font-size: max(12px, min(calc(100cqw / var(--w) * .34), 20px)); padding: 1px 2px; border-radius: 3px;
}
.kx .b .a { right: 5%; top: 7%; }
.kx .b .d { left: 5%; bottom: 7%; }
.kx .b .on { background: #F4D58D; color: #1F2328; }
.kx .b .done { opacity: .45; }
.kx .b .bad { background: #F2C4BF; color: #8A1F1F; }
.kx .b .hl { background: #FFE9A8; color: #1F2328; box-shadow: 0 0 0 2px #B7791F; }

.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(--w) * .56), 34px);
  display: flex; align-items: center; justify-content: center; touch-action: manipulation;
}
.cell.rel { background: #EAF0F6; }
.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.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) * 25ms); }
@keyframes pop-in { from { transform: scale(.6); } to { transform: none; } }
@keyframes flash { 0%, 100% { background: #FFFFFF; } 40% { background: #CDE8D6; } }

/* メモ（候補の小さな数字。3×3） */
.memo { position: absolute; inset: 1px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); pointer-events: none; }
.memo span { display: flex; align-items: center; justify-content: center; font-size: max(9px, min(calc(100cqw / var(--w) / 3 * .8), 14px)); 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; }

/* ---------- 組み合わせの早見 ---------- */
.combo { max-width: 560px; margin: 10px auto 0; display: grid; gap: 4px; font-size: 15px; min-height: 2.9em; }
.combo .row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.combo .dir { font-weight: 700; min-width: 7.5em; }
.combo .dir b { font-size: 17px; }
.combo .cb { display: inline-block; padding: 1px 7px; border-radius: 4px; border: 1.5px solid var(--line-strong); font-variant-numeric: tabular-nums; font-weight: 600; background: var(--surface); }
.combo .cb.no { color: var(--ink-sub); text-decoration: line-through; border-style: dashed; border-color: var(--line); font-weight: 400; }
.combo .cb.only { border-color: var(--ok); color: var(--ok); }
.combo .more { color: var(--ink-sub); }
.combo .empty { color: var(--ink-sub); }

/* ---------- 道具（メモ・1手もどす・ヒント） ---------- */
.tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 10px auto 0; max-width: 560px; }
.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 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; max-width: 560px; 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.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); }
.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); }

.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; }
.callout { z-index: 3; top: 50%; }

@media (max-width: 480px) {
  .stage { padding: 8px; }
  .key { min-height: 46px; font-size: 24px; }
  .pad { gap: 5px; }
  .tools { gap: 6px; }
  .tool, .tools .softkb-btn { padding: 0 4px; font-size: 14px; gap: 3px; min-width: 0; min-height: 44px; }
  .tools svg { display: none; }
  .controls .btn.icon { padding: 0 9px; }
  .combo { font-size: 14px; }
  .combo .dir { min-width: 0; }
}
@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: 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: 3; --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; } }
/* 上のバーの高さ ここまで */
