/* 将棋固有の見た目（ミニ将棋の style.css をもとに）（共通は ../common/base.css） */
#board { user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.board-wrap { max-width: 600px; margin: 0 auto; }

/* 上下の帯（駒台: 名前と持ち駒） */
.strip { fill: var(--bg); stroke: var(--line); stroke-width: 2; }
.strip.on { stroke: var(--accent); stroke-width: 5; }
.strip-label { font: 700 15px var(--font); fill: var(--ink-sub); }
.name-tag rect { fill: var(--surface); stroke: var(--line); stroke-width: 2; }
.name-tag text { font: 700 24px var(--font); fill: var(--ink); }
.name-tag.on rect { fill: var(--ink); stroke: var(--ink); }
.name-tag.on text { fill: var(--surface); }
.hand-count { font: 800 22px var(--font); fill: var(--ink); paint-order: stroke; stroke: var(--bg); stroke-width: 5px; pointer-events: none; }

/* 成れる段（相手のいちばん奥の段）と手番の枠 */
.zone { fill: #B0301C; opacity: .07; pointer-events: none; }
.turn-frame { fill: none; stroke-width: 7; stroke: var(--accent); opacity: 0; pointer-events: none; transition: opacity var(--dur); }
.turn-frame.on { opacity: .85; }
.status .who { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; padding: 0 4px; border-radius: 5px; font-weight: 700; font-size: 15px; background: #E8C98F; color: #1F2328; border: 2px solid #1F2328; flex: none; }

/* 駒 */
.koma { pointer-events: none; transition: filter var(--dur); }
.koma.lifted { filter: var(--shadow-lift); translate: 0 -4px; }
.koma.doomed { animation: shake .32s ease-in-out 2; }
@keyframes shake { 0%, 100% { translate: 0 0; } 25% { translate: -2px 0; } 75% { translate: 2px 0; } }
@media (prefers-reduced-motion: reduce) { .koma.doomed { animation: none; } }

/* 印: 動かせる駒・えらんだ駒・行き先・キーボードの枠・直前の手・王手・ねらわれている駒 */
.mark { fill: none; pointer-events: none; }
.mark.movable { stroke: var(--accent); stroke-width: 3.5; }
.mark.picked { stroke: var(--accent); stroke-width: 6; fill: var(--accent); fill-opacity: .18; }
.mark.target { fill: var(--accent); stroke: #FFF8EA; stroke-width: 3; }
.mark.target.take { fill: none; stroke: var(--accent); stroke-width: 6; }
.mark.cursor { stroke: var(--warn); stroke-width: 4; stroke-dasharray: 8 6; }
.mark.last-to { fill: rgba(255, 233, 168, .6); }
.mark.last-from { stroke: rgba(40, 28, 16, .45); stroke-width: 2.5; stroke-dasharray: 5 6; }
.mark.check { stroke: var(--ng); stroke-width: 6; fill: var(--ng); fill-opacity: .14; }
.mark.threat { stroke: var(--ng); stroke-width: 3.5; stroke-dasharray: 9 6; }
.mark.hand-pick { stroke: var(--accent); stroke-width: 5; fill: var(--accent); fill-opacity: .15; }
.mark.hand-movable { stroke: var(--accent); stroke-width: 3; }
.mark.cpu { stroke: #FFF8EA; stroke-width: 6; }
.mark.hint { stroke: var(--ok); stroke-width: 6; fill: var(--ok); fill-opacity: .16; }
:root[data-theme="dark"] .mark.movable, :root[data-theme="dark"] .mark.picked, :root[data-theme="dark"] .mark.hand-pick, :root[data-theme="dark"] .mark.hand-movable, :root[data-theme="dark"] .mark.target.take { stroke: #2F5D8A; }
:root[data-theme="dark"] .mark.target, :root[data-theme="dark"] .mark.picked { fill: #2F5D8A; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mark.movable, :root:not([data-theme="light"]) .mark.picked, :root:not([data-theme="light"]) .mark.hand-pick, :root:not([data-theme="light"]) .mark.hand-movable, :root:not([data-theme="light"]) .mark.target.take { stroke: #2F5D8A; }
  :root:not([data-theme="light"]) .mark.target, :root:not([data-theme="light"]) .mark.picked { fill: #2F5D8A; }
}
.hit { fill: transparent; cursor: pointer; }

/* 動きガイド・ヒント・直前の手の矢印 */
.arrow { stroke-linecap: round; pointer-events: none; fill: none; }
.arrow.guide { stroke: #2F5D8A; stroke-width: 7; opacity: .85; }
.arrow.guide.blocked { opacity: .28; }
.arrow.hint { stroke: #2E7D4F; stroke-width: 9; }
.arrow.last { stroke: #8A5A2B; stroke-width: 5; opacity: .55; stroke-dasharray: 2 10; }
.arrow.cpu { stroke: #8A5A2B; stroke-width: 8; opacity: .9; }
#guide, #fx { pointer-events: none; }

.board-wrap .callout { padding: 6px 18px; font-size: clamp(17px, 4vw, 24px); top: 44%; }
.stage { padding: 12px; }
@media (max-width: 560px) {
  .stage { margin-left: -8px; margin-right: -8px; } /* 盤だけ左右に広げる（ページの余白は共通の16px。D1） */
  .stage { padding: 6px; }
  .name-tag text { font-size: 26px; }
}

/* 成る・成らない */
.promo-box { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--surface); border: 2px solid var(--ink); border-radius: var(--radius); padding: 12px 16px; text-align: center; z-index: 5; min-width: 240px; }
.promo-box p { margin: 0 0 8px; font-weight: 700; font-size: 1.1rem; }
.promo-box .controls { justify-content: center; margin: 0; }
.promo-box .btn { display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; min-height: 56px; }
.promo-box img { display: block; }

.result-box .score { font-size: 1.05rem; font-weight: 700; margin: 0 0 8px; }
.result-box { inset: 20% 6% auto; padding: 16px 20px; }
.result-box h2 { font-size: 1.4rem; margin-bottom: 6px; }
@media (max-width: 520px) { .result-box { inset: 14% 0 auto; } .result-box .controls .btn { padding: 0 12px; } }

.howto img { display: block; width: 100%; max-width: 600px; height: auto; margin: 0 auto; }
.howto figcaption { text-align: center; }

/* 駒（共通CSSの .piece は使わない: .piece.lifted の transform で上の人の駒の回転が消えるため） */
.koma { filter: var(--shadow-piece); }
.koma.lifted { filter: var(--shadow-lift); }
.coord text { font: 700 22px var(--font); fill: #FFF3DC; pointer-events: none; }
.name-tag text { font-size: 30px !important; }
.strip-label { font-size: 24px; }
/* スマホ幅（盤が約0.37倍に縮む）: 駒台の名前・「持ち駒なし」・持ち駒の数・筋と段の数字を、画面で12〜14px以上に（D9/G2） */
@media (max-width: 560px) {
  .name-tag text { font-size: 38px !important; }
  .strip-label { font-size: 38px; }
  .hand-count { font-size: 33px; }
  .coord text { font-size: 33px; }
}

/* 棋譜 */
.kifu { max-width: 600px; margin: 8px auto 0; max-height: 4.6em; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 8px; background: var(--surface); font-size: 15px; line-height: 1.5; }
.kifu-head { font-weight: 700; color: var(--ink-sub); margin-right: 8px; }
.kifu ol { display: inline; margin: 0; padding: 0; list-style: none; counter-reset: k; }
.kifu li { display: inline-block; margin-right: 12px; counter-increment: k; white-space: nowrap; font-variant-numeric: tabular-nums; }
.kifu li::before { content: counter(k) " "; color: var(--ink-sub); font-size: 14px; }
.kifu.empty ol::after { content: "まだ指していません"; color: var(--ink-sub); }

/* 成る・成らないの説明／入玉宣言の条件 */
.promo-note { font-size: 14px !important; font-weight: 400 !important; color: var(--ink-sub); margin: 8px 0 0 !important; max-width: 320px; }
.decl-box { min-width: 280px; max-width: 94%; text-align: left; }
.decl-box > p:first-child { text-align: center; }
.decl-list { list-style: none; margin: 0 0 4px; padding: 0; font-size: 15px; }
.decl-list li { display: flex; gap: 6px; align-items: baseline; margin: 4px 0; }
.decl-list .mk { font-weight: 800; width: 1.2em; flex: none; text-align: center; }
.decl-list .ok .mk { color: var(--ok); }
.decl-list .ng .mk { color: var(--ng); }
.decl-box .controls { justify-content: center; margin-top: 10px; }
:root:lang(en) .kifu.empty ol::after { content: "No moves yet"; }
/* 上のバーの高さを一定に（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: 4; --tb-st-lines: 2; } }
@media (min-width: 641px) { :root:lang(en) .turnbar { --tb-msg-lines: 2; --tb-st-lines: 1; } }
/* 上のバーの高さ ここまで */
