/* 着せ替え 固有の見た目（共通は ../common/base.css） */
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 絵。ダーク表示でも絵の色はそのまま（背景の絵が地になる） */
.stage.kisekae .board-wrap { max-width: 640px; }
.canvas { position: relative; margin: 0 auto; border-radius: 4px; overflow: hidden; background: #FFFFFF; touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; border: 1px solid var(--line); }
.canvas.playing { touch-action: none; }
.canvas svg { display: block; width: 100%; height: 100%; }
.canvas.playing svg .stk { cursor: grab; }
.canvas.playing svg .stk:active { cursor: grabbing; }
.canvas.playing svg .figure { cursor: pointer; }

/* 手番のバー（お題の名前・季節・記録） */
.status { flex-wrap: wrap; column-gap: 10px; row-gap: 0; }
.st-name { white-space: nowrap; }
.season { display: inline-block; white-space: nowrap; font-size: 14px; font-weight: 700; padding: 0 8px; border-radius: 999px; border: 1.5px solid currentColor; color: var(--accent); line-height: 1.6; }
.best { font-size: 14px; font-weight: 700; color: var(--ng); margin-left: auto; white-space: nowrap; }
.best::before { content: ""; display: inline-block; width: 12px; height: 12px; border: 2.4px solid currentColor; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }

/* 部品の種類（タブ）: スマホ幅では横に流す */
.tabs { display: flex; gap: 6px; margin-top: 10px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; }
.tab { appearance: none; flex: none; min-height: var(--tap); min-width: 48px; padding: 0 12px; border: 2px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: inherit; font-size: 16px; cursor: pointer; white-space: nowrap; }
.tab[aria-selected="true"] { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.tab:focus-visible { outline: 3px solid var(--warn); outline-offset: 2px; }

/* 部品の見本 */
.items { display: flex; gap: 6px; overflow-x: auto; margin-top: 8px; padding: 2px 2px 4px; touch-action: pan-x; scrollbar-width: thin; align-items: stretch; }
.items.dim .it { opacity: .7; }
.grp { flex: none; writing-mode: vertical-rl; font-size: 13px; font-weight: 700; color: var(--ink-sub); padding: 4px 0; align-self: center; letter-spacing: 1px; }
:root:lang(en) .grp { writing-mode: horizontal-tb; align-self: center; font-size: 13px; max-width: 56px; text-align: center; line-height: 1.2; }
.it { appearance: none; flex: none; width: 76px; padding: 3px 3px 2px; border: 2px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 1px; font: inherit; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.it svg { width: 64px; height: 56px; display: block; background: #F4F2EC; border-radius: 4px; pointer-events: none; }
.it .nm { font-size: 13px; line-height: 1.25; text-align: center; min-height: 2.5em; display: flex; align-items: center; }
.it .nm rt { font-size: 10px; }
.it.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent); font-weight: 700; }
.it:focus-visible { outline: 3px solid var(--warn); outline-offset: 2px; }
.it[data-kind="sticker"] { cursor: grab; touch-action: pan-x; }
.ghost { position: fixed; left: 0; top: 0; width: 64px; height: 64px; pointer-events: none; z-index: 50; filter: var(--shadow-lift); }
.ghost svg { width: 100%; height: 100%; }

/* 置いた持ち物の道具 */
.stk-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.stk-name { font-weight: 700; margin-right: 4px; }

/* 色と柄 */
.colors { display: flex; align-items: center; gap: 6px; margin-top: 8px; overflow-x: auto; padding: 4px 2px; scrollbar-width: thin; min-height: 52px; }
.col-target { flex: none; font-size: 14px; font-weight: 700; color: var(--ink-sub); max-width: 9em; line-height: 1.3; }
.colors.off .col-target { max-width: none; flex: 1; font-weight: 400; }
.pats, .swatches { display: flex; gap: 6px; flex: none; }
.pats:not(:empty) { padding-right: 6px; border-right: 1px solid var(--line); }
.sw, .pat { appearance: none; flex: none; width: 40px; height: 40px; border-radius: 8px; border: 2px solid var(--line-strong); cursor: pointer; padding: 0; position: relative; overflow: hidden; }
.pat svg { width: 100%; height: 100%; display: block; }
.sw[aria-checked="true"], .pat[aria-checked="true"] { outline: 3px solid var(--ink); outline-offset: 2px; }
.sw[aria-checked="true"]::after { content: ""; position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--mark, #fff); border: 1.5px solid rgba(0,0,0,.35); }
.sw:focus-visible, .pat:focus-visible { outline: 3px solid var(--warn); outline-offset: 2px; }
.free-btn { flex: none; position: relative; width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--line-strong); cursor: pointer;
  background: conic-gradient(#C8453B, #D9A21B, #9CC25B, #2A9D8F, #2F6DB5, #7B5BA6, #E88FA8, #C8453B); }
.free-btn.on { outline: 3px solid var(--ink); outline-offset: 2px; }
.free-btn.on::after { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--fc); border: 2px solid #fff; }
.free-btn input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.free-btn:focus-within { outline: 3px solid var(--warn); outline-offset: 2px; }

/* 道具 */
.tools { margin-top: 8px; }
.tools #judge { font-weight: 700; }

/* 結果（お題の判定。絵の下に。絵を隠さない） */
.result-box { position: static; margin: 12px auto 0; padding: 16px 20px; max-width: 560px; text-align: left; transform: none; }
.res-head { display: flex; align-items: center; gap: 12px; }
.res-head .stamp { width: 84px; height: 84px; flex: none; background: #FFFFFF; border-radius: 50%; }
.res-head h2 { margin: 0; font-size: 1.5rem; }
.res-theme { margin: 0; color: var(--ink-sub); }
.res-list { list-style: none; padding: 0; margin: 12px 0 8px; display: grid; gap: 6px; }
.res-list li { display: flex; gap: 8px; align-items: flex-start; line-height: 1.5; }
.res-list .mk { flex: none; width: 16px; height: 16px; margin-top: 5px; border-radius: 50%; border: 3px solid var(--ok); }
.res-list .bonus .mk { border-color: var(--accent); border-radius: 3px; transform: rotate(45deg) scale(.85); }
.res-list .fix .mk { border: none; width: 0; height: 0; border-left: 9px solid transparent; border-right: 9px solid transparent; border-bottom: 16px solid var(--warn); border-radius: 0; }
.res-list .fix { color: var(--ink); }
.result-box .controls { justify-content: flex-start; }

/* 設定のお題 */
.choice .hm { display: inline-block; width: 18px; height: 18px; margin-left: 4px; vertical-align: -3px; }
.choice .hm svg { width: 100%; height: 100%; }

.callout { z-index: 3; }

@media (max-width: 640px) {
  .stage { padding: 8px; }
  .turnbar .message { font-size: 15px; line-height: 1.5; }
  .tools { gap: 6px; }
  .controls .btn.icon { padding: 0 9px; }
  .result-box { padding: 12px; }
}
@media (max-width: 420px) {
  .it { width: 70px; }
  .it svg { width: 60px; height: 52px; }
  .sw, .pat, .free-btn { width: 38px; height: 38px; }
}

/* 広い画面: 絵を左、部品と色を右に並べる（スクロールなしで着せ替えられるように） */
@media (min-width: 900px) {
  .stage.kisekae { width: min(1080px, calc(100vw - 48px)); margin-left: calc(50% - min(540px, 50vw - 24px));
    display: grid; grid-template-columns: minmax(0, 1fr) 420px; column-gap: 20px; align-items: start; }
  .stage.kisekae > .turnbar { grid-column: 1 / -1; }
  .stage.kisekae > .board-wrap { grid-column: 1; grid-row: 2 / span 2; max-width: none; width: 100%; }
  .stage.kisekae > #play { grid-column: 2; grid-row: 2; }
  .stage.kisekae > .result-box { grid-column: 2; grid-row: 3; margin: 12px 0 0; }
  .stage.kisekae .tabs { flex-wrap: wrap; margin-top: 0; overflow: visible; }
  .stage.kisekae .items { flex-wrap: wrap; overflow: visible; max-height: none; }
  .stage.kisekae .grp { writing-mode: horizontal-tb; flex-basis: 100%; padding: 2px 0 0; font-size: 14px; }
  .stage.kisekae .colors { flex-wrap: wrap; overflow: visible; }
  .stage.kisekae .col-target { flex-basis: 100%; max-width: none; }
  .stage.kisekae .swatches { flex-wrap: wrap; flex: 1 1 100%; }
  .stage.kisekae .pats:not(:empty) { border-right: none; padding-right: 0; }
  .stage.kisekae #tools2 .spacer { display: none; }
}
.howto img.narrow { max-width: 560px; }
/* 上のバーの高さを一定に（No.93。数字は一番長い文が画面の幅（360px・375px 以上・641px 以上）で何行になるか。--tb-rt はふりがなの分。base.css・turnbar.js） */
.turnbar { --tb-msg-lines: 3; --tb-st-lines: 1; --tb-rt: 11px; --tb-st-rt: 11px; }
@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: 3; --tb-st-lines: 1; --tb-rt: 0px; --tb-st-rt: 0px; }
@media (min-width: 375px) { :root:lang(en) .turnbar { --tb-msg-lines: 2; --tb-st-lines: 1; } }
@media (min-width: 641px) { :root:lang(en) .turnbar { --tb-msg-lines: 2; --tb-st-lines: 1; } }
/* 上のバーの高さ ここまで */
