/* 関卡頁（八稿 SPC / SM）。機台・左右の札は作品頁（simulator-play.css）と共通。ここは関卡の部品だけ。
   左柱：上＝ステージ（選ぶ）・下＝このステージ。操作方法の札は出さない（キーは下の本文に）。 */
.game-simulator-stage .guide-card { display: none; }
.game-simulator-stage .work-rank { display: none !important; } /* 関卡は順位を出さない。右柱は NEXT・HOLD だけ */
.game-simulator-stage .stage-lead { font-size: 13px; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-simulator-stage .stage-progress { margin-left: auto; flex: none; font-size: 13px; color: var(--ok-ink); background: var(--ok-bg); border: 1.5px solid var(--ok-line); border-radius: var(--radius-pill); padding: 3px 14px; }
.game-simulator-stage .stage-progress:empty { display: none; }
.game-simulator-stage .stage-of { font-family: 'Share Tech Mono', monospace; letter-spacing: .06em; }

/* 機台の開始札（結果の面は全站と同じ部品・result-panel.css）*/
.game-simulator-stage .stage-big { font: 900 40px/1 'Share Tech Mono', monospace; letter-spacing: .04em; color: var(--brand-red); }
.game-simulator-stage .stage-big:empty { display: none; }
.game-simulator-stage .stage-name { font-size: 13px; font-weight: 900; color: var(--muted); }
.game-simulator-stage .game-overlay [data-work-sentence] { font-size: 19px; line-height: 1.45; }
.game-simulator-stage .game-overlay a.start-cta { text-decoration: none; display: flex; align-items: center; justify-content: center; }

/* 問題は順番が決まっているので、開始前から NEXT・HOLD を見せる（全站の遊技頁は開始前＝順位表の場所） */
html[data-skin='plain'] body.game-simulator-stage:not(.is-playing) .info-pieces { display: flex; flex: 1; }
html[data-skin='plain'] body.game-simulator-stage:not(.is-playing) #next-desktop { height: 100%; }
html[data-skin='plain'] body.game-simulator-stage:not(.is-playing) .hold-slot { display: flex; }
html[data-skin='plain'] body.game-simulator-stage:not(.is-playing) .info-hold { display: flex; flex: none; }
/* HOLD が使えない面は札だけ残して一言（空の枠だと壊れて見える） */
[data-skin='plain'] .game-simulator-stage .info-hold { min-height: 134px; justify-content: center; }
/* 結果の札が出ても NEXT・HOLD は残す（作品頁は over で隠して順位表を見せるが、関卡は順位表を出さない） */
[data-skin='plain'] .game-simulator-stage[data-work-phase='over'] .info-pieces { display: flex; }
[data-skin='plain'] .game-simulator-stage[data-work-phase='over'] .info-hold { display: flex; }
/* 開始の札は機台の上の方に。下の盤面を隠さない（解く前に形を見て考えるため・八稿）。結果の面は全站と同じく盤を覆う */
[data-skin='plain'] .game-simulator-stage .game-overlay:not([data-overlay='pause'], [data-work-over]) {
  inset: 52px 30px auto 30px; background: var(--surface); border: 2px solid var(--stroke); border-radius: 16px;
  box-shadow: 0 4px 0 var(--stroke); padding: 20px 22px 16px;
}

/* 左上：ステージを選ぶ */
[data-skin='plain'] .game-simulator-stage .stage-select { grid-area: stats; align-self: start; margin-top: var(--perch); }
[data-skin='plain'] .game-simulator-stage .work-summary { grid-area: guide; align-self: start; margin-top: 22px; }
.stage-select { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 24px 12px 12px; }
.stage-tabs { display: flex; align-items: center; justify-content: space-between; gap: 3px; background: var(--soft); border: 2px solid var(--stroke); border-radius: var(--radius-pill); padding: 2px; }
.stage-tabs button { font: inherit; font-size: 12.5px; font-weight: 900; color: var(--ink); background: transparent; border: 0; border-radius: var(--radius-pill); padding: 5px 0; cursor: pointer; white-space: nowrap; }
.stage-tabs button small { font-size: 11px; font-weight: 700; }
.stage-tabs .stage-step { flex: none; padding: 5px 14px; font-size: 15px; }
.stage-tabs .stage-step:disabled { color: var(--faint); cursor: default; }
.stage-chapter { font-size: 13px; font-weight: 900; white-space: nowrap; }
.stage-chapter small { font-size: 11px; font-weight: 700; color: var(--muted); }
.stage-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.stage-tile { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 0 4px; border-radius: 11px; border: 1.5px dashed var(--slot-line); background: var(--soft); color: var(--ink); text-decoration: none; min-width: 0; }
.stage-tile b { font-size: 12px; line-height: 1; }
.stage-face { height: 30px; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.stage-face canvas { width: 40px; height: 20px; }
.stage-tile[data-state='lock'] { opacity: .7; cursor: default; }
.stage-tile[data-state='done'] { border: 1.5px solid var(--ok-line); background: var(--ok-bg); box-shadow: 0 2px 0 color-mix(in srgb, var(--ink) 18%, transparent); }
.stage-tile[data-state='now'], .stage-tile[data-state='open'] { border: 1.5px solid var(--stroke); background: var(--surface); box-shadow: 0 2px 0 var(--stroke); }
.stage-tile[aria-current='page'] { border: 2.5px solid var(--cta); background: var(--now-bg); }
.stage-tile[aria-current='page'] .stage-face { color: var(--cta); font-weight: 900; }
.stage-tile:hover { color: var(--ink); }
.stage-dot, .stage-legend i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.stage-legend { margin: 0; display: flex; justify-content: center; gap: 4px 10px; flex-wrap: wrap; font-size: 10.5px; color: var(--sub); align-items: center; }
.stage-legend i { margin-right: -6px; }
[data-tone='z'] > .stage-dot, .stage-legend i[data-tone='z'] { background: var(--mino-z-edge, #C23D2E); }
[data-tone='t'] > .stage-dot, .stage-legend i[data-tone='t'] { background: var(--mino-t-edge, #7C4FB0); }
[data-tone='i'] > .stage-dot, .stage-legend i[data-tone='i'] { background: var(--mino-i-edge, #2E8FA0); }
[data-tone='j'] > .stage-dot, .stage-legend i[data-tone='j'] { background: var(--mino-j-edge, #3B63B4); }

/* 電脑は左の柱に札があるので、開く釦は手機だけ */
.game-simulator-stage [data-stage-pick] { display: none; }

@media (max-width: 560px) {
  /* 手機の液晶は低いので、札は作品頁と同じく液晶いっぱい（上だけに置くと文字が何行にも折れた）。盤面は札を閉じれば見える */
  .game-simulator-stage .stage-lead, .game-simulator-stage .title-badges .badge { display: none; }
  .game-simulator-stage .stage-big { font-size: clamp(24px, calc(var(--board-h) * .09), 34px); }
  .game-simulator-stage .game-overlay [data-work-sentence] { font-size: clamp(13px, calc(var(--board-h) * .045), 16px); }
  /* 手機は機台を他の遊技頁と同じ大きさに保つ：札は機台の中に置かず、開始・結果札の「ステージをえらぶ」から #modal で開く */
  .game-simulator-stage [data-stage-mobile-home] { display: none; }
  /* 作品頁の記録札の置き場。関卡頁は札を出さないのに、空の器の余白（34px）だけが開始前に機台へ数えられ、
     はじめると消えるので盤が 362 → 396px と跳ねた（站長 11-16 iPhone）。器ごと出さない */
  .game-simulator-stage [data-work-mobile-rank-home] { display: none; }
  .game-simulator-stage .link-button[data-stage-pick] { display: inline-block; }
  .game-simulator-stage .start-cta[data-stage-pick] { display: block; }
  .modal-body > .stage-select { padding: 4px 0 0; }
}

/* 本文の図（tools/problem-picks/stage-figures.mjs が関卡の実データから描く。盤は全站共通の .waza-thumb）*/
.stage-figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 14px 0; }
.stage-figs.is-solo { grid-template-columns: minmax(0, 360px); justify-content: center; }
.stage-fig { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.stage-fig figcaption { font-size: 11.5px; line-height: 1.6; color: var(--sub); text-align: center; }
.stage-fig-board { display: flex; align-items: flex-end; gap: 10px; background: var(--page); border-radius: 10px; padding: 8px 10px; }
.stage-fig-board > .waza-thumb { flex: 10 1 0; min-width: 0; padding: 0; background: none; }
.stage-fig-next { display: flex; flex-direction: column; align-items: center; gap: 10px; flex: 4 1 0; min-width: 0; }
.stage-fig-next .waza-thumb { height: auto; }
.stage-fig-next .waza-thumb { padding: 0; background: none; }
.sub-card .stage-fig { margin: 8px 0; }
/* 章の表：章名・個数は折り返さない（手機で「初/級」と縦に割れた）。種類は 1 行 1 つ */
.stage-chapters td { white-space: nowrap; }
.stage-chapters th, .stage-chapters td { padding-inline: 7px; }
