/*
  野球オーダー表メーカー — style.css
  design-tokens.css / components.css の変数・部品を土台に、このツール専用のレイアウトだけを書く。
  共通部分（ヘッダー・トースト・SEO・フッター・印刷）は命名書メーカー(meimeisho/style.css)と同じ作り。
*/

* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }

.skip-link { position: absolute; left: -9999px; top: 0; background: var(--color-accent); color: #fff; padding: var(--space-2) var(--space-3); border-radius: 0 0 var(--radius-small) 0; z-index: 100; }
.skip-link:focus { left: 0; }

/* ==================== 共通レイアウト ==================== */
.app-header { padding: var(--space-5) var(--space-3) var(--space-4); text-align: center; }
.app-logo { font-size: var(--font-size-title); font-weight: var(--font-weight-bold); margin: 0 0 var(--space-1); }
.app-tagline { font-size: var(--font-size-body); color: var(--color-text-secondary); margin: 0 auto; max-width: 600px; }

main { max-width: 1000px; margin: 0 auto; padding: 0 var(--space-3) var(--space-6); display: flex; flex-direction: column; gap: var(--space-4); }

.note { font-size: var(--font-size-caption); color: var(--color-text-secondary); margin: var(--space-2) 0 0; }
.note-warn { color: #B25E00; background: var(--color-warning-tint); border-radius: var(--radius-small); padding: var(--space-2) var(--space-3); }
.sub-title { font-size: var(--font-size-body); font-weight: var(--font-weight-semibold); margin: var(--space-4) 0 var(--space-2); }

/* ==================== トースト ==================== */
.toast-container { position: fixed; left: 50%; bottom: var(--space-4); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: var(--space-2); z-index: 3000; pointer-events: none; width: min(90vw, 420px); }
.toast { background: var(--color-text-primary); color: #fff; padding: var(--space-2) var(--space-3); border-radius: var(--radius-small); box-shadow: var(--shadow-modal); font-size: var(--font-size-body); text-align: center; opacity: 0; transform: translateY(8px); animation: toast-in var(--transition-base) forwards; }
.toast-success { background: var(--color-success); }
.toast-error { background: var(--color-danger); }
.toast-hide { animation: toast-out 200ms cubic-bezier(0.4, 0, 0.2, 1) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(8px); } }


.field-label { display: block; font-size: var(--font-size-caption); font-weight: var(--font-weight-semibold); color: var(--color-text-secondary); margin: var(--space-3) 0 var(--space-1); }
.form-card .field-label:first-of-type { margin-top: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--space-3); }
.form-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-4); }
.form-foot .note { margin: 0; flex: 1 1 200px; }
.btn-small { padding: var(--space-1) var(--space-2); font-size: var(--font-size-caption); }
input[type="range"] { width: 100%; }

/* 切り替えボタン（先攻・後攻／打順の人数） */
.seg { display: flex; border: 1px solid var(--color-border); border-radius: 999px; overflow: hidden; }
.seg button { flex: 1 1 0; appearance: none; border: 0; background: transparent; color: var(--color-text-primary); font: inherit; font-size: 14px; padding: 8px 6px; min-height: 40px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--color-border); }
.seg button[aria-checked="true"] { background: var(--color-accent); color: #fff; font-weight: var(--font-weight-semibold); }
.seg button:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; }

/* メイン写真 */
.hero-row { display: flex; gap: var(--space-3); align-items: flex-start; }
.hero-thumb { flex: none; width: 66px; height: 144px; border-radius: 8px; background: #e9e6e0; border: 1px solid var(--color-border); }
.hero-actions { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); min-width: 0; }
.hero-actions .note { margin: 0; }

/* チームカラー */
.preset-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.preset { appearance: none; border: 2px solid var(--color-border); border-radius: 10px; background: var(--color-surface); padding: 6px 4px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; font: inherit; font-size: 11px; color: var(--color-text-secondary); }
.preset .sw { display: flex; width: 100%; height: 26px; border-radius: 6px; overflow: hidden; border: 1px solid rgba(0, 0, 0, .12); }
.preset .sw i { flex: 1; display: block; }
.preset[aria-checked="true"] { border-color: var(--color-accent); box-shadow: 0 0 0 2px var(--color-accent-tint); color: var(--color-accent); font-weight: var(--font-weight-semibold); }
.preset:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.color-pick { display: flex; gap: var(--space-4); margin-top: var(--space-3); flex-wrap: wrap; }
.color-field { display: flex; align-items: center; gap: 8px; font-size: var(--font-size-caption); color: var(--color-text-secondary); font-weight: var(--font-weight-semibold); }
.color-field input[type="color"] { width: 52px; height: 36px; padding: 0; border: 1px solid var(--color-border); border-radius: 8px; background: none; cursor: pointer; }

/* ==================== 出力 ==================== */
.goods-card .card-title { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.goods-card p { margin: 0 0 var(--space-2); }
.goods-details { margin: var(--space-2) 0 var(--space-3); }
.goods-details summary { cursor: pointer; color: var(--color-accent); font-size: var(--font-size-caption); }

/* ==================== 写真の位置あわせ ==================== */
.cropbox { position: fixed; inset: 0; z-index: 2000; background: rgba(20, 18, 16, .78); display: flex; align-items: center; justify-content: center; padding: 12px; overflow-y: auto; }
.cropbox-inner { width: min(100%, 380px); background: var(--color-surface, #fff); border-radius: 16px; padding: 16px; max-height: 100%; overflow-y: auto; }
.cropbox-title { font-size: 17px; margin: 0 0 10px; }
.crop-stage { display: flex; justify-content: center; }
.crop-canvas { display: block; max-width: 100%; touch-action: none; cursor: grab; border-radius: 8px; background: #222; user-select: none; -webkit-user-select: none; }
.crop-canvas.grabbing { cursor: grabbing; }
.crop-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.crop-main .btn { flex: 1 1 0; min-height: 44px; }

/* ==================== SEOセクション ==================== */
.seo-section { margin-top: var(--space-3); display: flex; flex-direction: column; gap: var(--space-4); }
.seo-summary { font-size: var(--font-size-heading); font-weight: var(--font-weight-semibold); cursor: pointer; word-break: keep-all; }
.seo-summary:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.seo-details[open] > .seo-summary { margin-bottom: var(--space-3); }
.seo-details-body > *:last-child { margin-bottom: 0; }
.seo-steps, .seo-usecases { margin: 0 0 var(--space-3); padding-left: var(--space-4); color: var(--color-text-primary); font-size: var(--font-size-body); line-height: var(--line-height-base); }
.seo-steps li, .seo-usecases li { margin-bottom: var(--space-2); }
.seo-faq dt { font-weight: var(--font-weight-semibold); margin-top: var(--space-3); }
.seo-faq dt:first-child { margin-top: 0; }
.seo-faq dd { margin: var(--space-1) 0 0; color: var(--color-text-secondary); font-size: var(--font-size-body); }

/* ==================== 他のツール ==================== */
.related-section { margin-top: var(--space-4); }
.related-heading { font-size: var(--font-size-heading); font-weight: var(--font-weight-semibold); margin: 0 0 var(--space-3); }
.related-tools-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-3); }
@media (min-width: 640px) { .related-tools-grid { grid-template-columns: repeat(3, 1fr); } }
.related-tool-card { display: flex; flex-direction: column; gap: var(--space-2); text-decoration: none; color: inherit; transition: box-shadow var(--transition-fast); }
.related-tool-card:hover { box-shadow: var(--shadow-modal); }
.related-tool-title { font-size: var(--font-size-body); font-weight: var(--font-weight-semibold); margin: 0; }
.related-tool-desc { font-size: var(--font-size-caption); color: var(--color-text-secondary); margin: 0; }

/* ==================== フッター ==================== */
.app-footer { max-width: 1000px; margin: 0 auto; padding: var(--space-4) var(--space-3) var(--space-6); text-align: center; }
.ad-slot { min-height: 0; }
.footer-links { font-size: var(--font-size-caption); }
.footer-links a { color: var(--color-text-secondary); }

/* ==================== 印刷（A4に1枚・余白なし） ==================== */
.print-area { display: none; }
@page { size: A4; margin: 0; }
@media print {
  body > *:not(#printArea) { display: none !important; }
  html, body { background: #fff !important; margin: 0; padding: 0; }
  .print-area { display: block !important; }
  .print-area img { display: block; width: 210mm; height: 262.5mm; margin: 0; page-break-after: avoid; } /* 4:5の画像をA4の幅いっぱいに（縦に引き伸ばさない） */
}




/* iPhone: 長押しで写真に保存してもらう画面 */
.save-sheet { position: fixed; inset: 0; background: rgba(0,0,0,.75); z-index: 1100; display: flex; align-items: center; justify-content: center; padding: var(--space-3); }
.save-sheet-inner { background: var(--color-surface, #fff); border-radius: var(--radius-medium, 12px); padding: var(--space-3); max-width: 480px; width: 100%; display: flex; flex-direction: column; align-items: center; gap: var(--space-2); }
.save-sheet-msg { font-size: var(--font-size-body); text-align: center; margin: 0; }
.save-sheet-inner img { display: block; max-width: 100%; max-height: 62vh; width: auto; height: auto; -webkit-touch-callout: default; user-select: auto; }

/* ==================== 2026-10-15 仕上がりの拡大表示（虫めがね）と、スマホの高さ調整つまみ（zoomview.js）==================== */
.zoom-btn { position: absolute; right: 6px; bottom: 6px; z-index: 3; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0; appearance: none; border: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.62); color: #fff; cursor: zoom-in; touch-action: manipulation; }
.zoom-btn:hover { background: rgba(0, 0, 0, 0.78); }
.zoom-btn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.zoom-overlay { position: fixed; inset: 0; z-index: 1000; background: #000; overscroll-behavior: contain; }
.zoom-overlay[hidden] { display: none; }
.zoom-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.zoom-img { display: block; flex: none; max-width: none; transform-origin: 50% 50%; will-change: transform; -webkit-user-drag: none; pointer-events: none; background: #fff; }
.zoom-close { position: absolute; top: max(8px, env(safe-area-inset-top)); right: max(8px, env(safe-area-inset-right)); z-index: 2; width: 48px; height: 48px; appearance: none; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.92); color: #111; font-size: 30px; line-height: 1; padding: 0 0 3px; cursor: pointer; touch-action: manipulation; }
.zoom-close:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
html.zoom-open, html.zoom-open body { overflow: hidden; }
.size-handle { display: none; }
@media (max-width: 1023.98px) {
  .zv-box.is-compact:not(.is-peek):not(.is-kb) .size-handle { display: flex; align-items: center; justify-content: center; height: 28px; margin-top: 0; cursor: ns-resize; touch-action: none; user-select: none; -webkit-user-select: none; }
  .size-handle-bar { display: block; width: 48px; height: 5px; border-radius: 3px; background: rgba(0, 0, 0, 0.32); transition: background 120ms ease; }
  .size-handle:hover .size-handle-bar, .size-handle:active .size-handle-bar { background: rgba(0, 0, 0, 0.55); }
  .size-handle:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; border-radius: 6px; }
  .zv-box.is-resizing .preview-canvas { transition: none !important; }
}

/* ===== 仕上がりの枠の中でのその場拡大（2本指で広げる）。canvas と重ね層を .zoom-inner に入れ、その入れ物に transform をかける（zoomview.js の setupInplaceZoom）===== */
.zoom-inner { position: relative; width: 100%; display: flex; justify-content: center; transform-origin: 0 0; }
.preview-frame.ip-frame { touch-action: pan-y; }
.preview-frame.is-zoomed { touch-action: none; user-select: none; -webkit-user-select: none; }
.preview-frame.is-zoomed .zoom-inner { will-change: transform; }
.zoom-reset { position: absolute; top: 6px; left: 6px; z-index: 4; min-width: 44px; min-height: 44px; padding: 0 14px; appearance: none; border: 0; border-radius: 22px; background: rgba(0, 0, 0, 0.62); color: #fff; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; touch-action: manipulation; }
.zoom-reset:hover { background: rgba(0, 0, 0, 0.78); }
.zoom-reset:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.zoom-reset[hidden] { display: none; }

/* ==================== 使い道の質問（保存・共有・印刷のあと。usage.js） ==================== */
/* 出力ボタンの帯の真上に重ねて出す（ボタンや画面の流れを動かさない）。帯は position: sticky（＝基準になる）なので relative は付けない（付けると固定が外れる） */
.usage-card {
  position: absolute; left: 0; right: 0; bottom: 100%; margin-bottom: var(--space-2); z-index: 30;
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-medium);
  box-shadow: var(--shadow-modal); padding: 6px var(--space-3) var(--space-2); display: flex; flex-direction: column; gap: 6px;
  color: var(--color-text-primary); font-size: 13px;
}
.usage-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-2); }
.usage-q { margin: 0; font-weight: var(--font-weight-semibold); font-size: 13px; line-height: 1.4; }
.usage-choices { display: flex; flex-wrap: wrap; gap: 4px; }
.usage-btn {
  appearance: none; flex: 1 1 auto; min-height: 34px; padding: 2px 8px; border-radius: var(--radius-small);
  border: 1px solid var(--color-border); background: var(--color-bg); color: var(--color-text-primary);
  font: inherit; font-size: 12.5px; line-height: 1.25; cursor: pointer; touch-action: manipulation;
}
.usage-btn:hover { border-color: var(--color-text-secondary); }
.usage-btn:focus-visible, .usage-close:focus-visible { outline: 2px solid var(--color-text-primary); outline-offset: 2px; }
.usage-close {
  appearance: none; flex: none; border: 0; background: transparent; color: var(--color-text-secondary);
  font: inherit; font-size: 12px; text-decoration: underline; padding: 2px 4px; min-height: 28px; cursor: pointer;
}
.usage-thanks { margin: 0; text-align: center; font-weight: var(--font-weight-semibold); padding: var(--space-2) 0; }

/* 使い道: 縦並びのラジオ＋送る */
.usage-list { display: flex; flex-direction: column; gap: 2px; margin: 6px 0 8px; }
.usage-opt { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 4px 6px; border-radius: 8px; font-size: 15px; line-height: 1.35; cursor: pointer; color: var(--color-text-primary); }
.usage-opt:hover { background: var(--color-fill, rgba(0,0,0,.04)); }
.usage-opt input { width: 20px; height: 20px; margin: 0; flex: 0 0 auto; accent-color: var(--color-accent); }
.usage-send { width: 100%; min-height: 44px; border: 0; border-radius: 10px; background: var(--color-accent); color: #fff; font: inherit; font-weight: var(--font-weight-semibold); cursor: pointer; }
.usage-send:disabled { opacity: .4; cursor: default; }
.usage-q { font-size: 15px !important; }


/* =====================================================================
   2026-11-02 v2: 「メンバー一覧／スタメン／画像にする」の3つに分ける（サッカー版 v2.4 と同じ画面の形・同じ部品の動き）
   PC(1024px以上)は左=仕上がり（画面に固定）／右=上にフォルダの見出し＋中身。スマホは縦1列で、切り替えは画面の下に固定
   ===================================================================== */
.more-info { margin: var(--space-3) 0 var(--space-2); border: 1px solid var(--color-border); border-radius: var(--radius-small); padding: var(--space-2) var(--space-3); }
.more-info > summary { cursor: pointer; font-size: var(--font-size-caption); font-weight: var(--font-weight-semibold); color: var(--color-accent); min-height: 24px; }
.more-info[open] > summary { margin-bottom: var(--space-2); }
.more-info .field-label:first-of-type { margin-top: 0; }
.design-card { padding: var(--space-4); }
.sub-card { margin-top: var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--color-border); }
.sub-card .sub-title { margin-top: 0; }
.input { width: 100%; }
.players-card { padding: var(--space-4); }
.players-note { margin: 0 0 var(--space-3); }

/* プレビュー（仕上がり） */
.preview-frame { position: relative; display: flex; justify-content: center; background: #e9e6e0; border-radius: var(--radius-small); overflow: hidden; }
.preview-canvas { display: block; width: auto; height: auto; max-width: 100%; max-height: 70vh; aspect-ratio: 4 / 5; background: #fff; touch-action: pan-y; }
.preview-busy { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, 0.6); font-size: var(--font-size-caption); color: var(--color-text-secondary); }
.view-card { padding: var(--space-3); }
.view-card .preview-frame { margin: 0; }
.view-hint { margin: var(--space-2) 0 0; }

/* デザイン一覧 */
.thumb-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-2); }
.thumb { appearance: none; border: 2px solid var(--color-border); border-radius: var(--radius-small); background: var(--color-surface); padding: 0; cursor: pointer; overflow: hidden; display: flex; flex-direction: column; font: inherit; color: inherit; min-width: 0; }
.thumb img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; background: #eee; }
.thumb span { font-size: 10px; line-height: 1.3; padding: 3px 1px; color: var(--color-text-secondary); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb[aria-selected="true"] { border-color: var(--color-accent); box-shadow: 0 0 0 2px var(--color-accent-tint); }
.thumb[aria-selected="true"] span { color: var(--color-accent); font-weight: var(--font-weight-semibold); }
.thumb:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.thumb-strip { display: none; }
@media (min-width: 640px) { .thumb span { font-size: 11px; } }

/* 仕上がりの上に重ねる当たり判定（透明なボタン）。打順の行・カード・ダイヤモンドの名前を押す場所 */
.hit-layer { position: absolute; z-index: 2; pointer-events: none; }
.hit-layer:not(.busy) .hit { pointer-events: auto; }
.hit { position: absolute; padding: 0; margin: 0; border: 0; border-radius: 10px; background: transparent; appearance: none; -webkit-appearance: none; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; cursor: pointer; touch-action: manipulation; }
.hit:hover { box-shadow: 0 0 0 2px rgba(255, 255, 255, .85), 0 0 0 4px rgba(0, 113, 227, .55); }
.hit:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 1px; }
.hit.is-sel { box-shadow: 0 0 0 3px rgba(255, 214, 10, .95), 0 0 0 5px rgba(0, 0, 0, .35); }

/* 切り替えとカードの形 */
.workspace, .col-left, .col-right { display: contents; }
.tabpane { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.next-btn { width: 100%; min-height: 44px; }
.tabs { position: sticky; top: 0; z-index: 19; background: var(--color-bg); padding: var(--space-2) 0 0; }
.tabs-inner { display: flex; gap: var(--space-1); padding: 0 var(--radius-medium); }
.tab { flex: 1 1 0; min-width: 0; min-height: 52px; position: relative; top: 1px; border: 1px solid var(--color-border); border-bottom: none; background: var(--color-bg); border-radius: var(--radius-medium) var(--radius-medium) 0 0; padding: 6px 2px; font: inherit; font-size: var(--font-size-caption); color: var(--color-text-secondary); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; line-height: 1.25; white-space: nowrap; }
.tab .ti { display: none; }
.tab .tc { font-size: 11px; }
.tab[aria-selected="true"] { background: var(--color-surface); color: var(--color-accent); font-weight: var(--font-weight-bold); box-shadow: inset 0 3px 0 var(--color-accent); z-index: 1; }
.tab:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; }
.tabpane > .card:first-child { border: 1px solid var(--color-border); }
.tabs ~ .tabpane { margin-top: calc(-1 * var(--space-4)); }

.row-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.row-actions .btn { min-height: 44px; }
.all-controls { display: flex; gap: var(--space-2); margin-top: var(--space-3); flex-wrap: wrap; }
.all-controls .btn { min-height: 44px; }
.bench-warn { color: var(--color-text-primary); background: var(--color-warning-tint); border-radius: 8px; padding: 6px 10px; margin: 0 0 var(--space-2); }

/* 出力ボタンの帯 */
.export-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; position: sticky; bottom: var(--space-2); background: var(--color-bg); padding-top: var(--space-2); z-index: 5; }
.export-actions .btn { flex: 1 1 auto; min-height: 44px; }

/* メンバーの一覧 */
.member-list { list-style: none; margin: 0; padding: 0; }
.mrow { display: grid; grid-template-columns: 44px minmax(0, 1fr) 64px auto 44px; grid-template-areas: "ph nm no st dl"; gap: 6px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--color-border); }
.mrow > .pbtn { grid-area: ph; }
.mrow .in-name { grid-area: nm; }
.mrow .in-num { grid-area: no; text-align: center; padding-left: 2px; padding-right: 2px; }
.mrow .badge-st { grid-area: st; }
.mrow .del { grid-area: dl; }
.mrow .input { min-height: 44px; padding: 6px 8px; font-size: 16px; min-width: 0; }
.badge-st { font-size: 11px; white-space: nowrap; border-radius: 999px; padding: 3px 8px; border: 1px solid var(--color-border); color: var(--color-text-secondary); text-align: center; }
.badge-st.is-start { background: var(--color-accent-tint); border-color: var(--color-accent); color: var(--color-accent); font-weight: var(--font-weight-bold); }
.mrow .del, .modal .del { appearance: none; width: 44px; height: 44px; border: 1px solid var(--color-border); background: var(--color-bg); border-radius: var(--radius-small); color: var(--color-text-secondary); font-size: 18px; cursor: pointer; padding: 0; }
.mrow .del:hover { color: var(--color-danger); }
.mrow .del:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
@media (max-width: 520px) {
  .mrow { grid-template-columns: 44px minmax(0, 1fr) 60px 44px; grid-template-areas: "ph nm no dl" ". st st st"; }
  .mrow .badge-st { justify-self: start; }
}
.pbtn { flex: none; width: 44px; height: 44px; padding: 0; border: 2px solid var(--color-border); border-radius: 50%; background: var(--color-bg); cursor: pointer; overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--color-text-secondary); line-height: 1.1; text-align: center; }
.pbtn canvas { width: 100%; height: 100%; display: block; }
.pbtn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.pbtn-big { width: 72px; height: 72px; font-size: 13px; }

/* 打順の一覧（行ぜんたいが「メンバーから選ぶ」ボタン） */
.lineup-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 6px; }
.lineup-pitcher { margin-top: 6px; }
.pitcher-label { font-size: 12px; font-weight: var(--font-weight-semibold); color: var(--color-text-secondary); margin: var(--space-2) 0 4px 2px; }
.prow { display: flex; align-items: center; gap: 6px; border: 2px solid var(--color-border); border-radius: 10px; padding: 4px 7px; background: var(--color-surface); min-width: 0; min-height: 56px; cursor: pointer; }
.prow.sel { border-color: var(--color-accent); background: var(--color-accent-tint); }
.prow-main { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 6px; min-height: 44px; appearance: none; border: 0; background: none; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.prow-main:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; border-radius: var(--radius-small); }
.prow .ordn { flex: none; width: 22px; text-align: right; font-weight: var(--font-weight-bold); font-size: 15px; color: var(--color-accent); }
.prow .ptag { flex: none; width: 34px; text-align: center; font-size: 11px; font-weight: 800; color: var(--color-text-secondary); background: var(--color-bg); border: 1px solid var(--color-border); border-radius: 5px; padding: 2px 0; }
.prow .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .who.none { color: var(--color-text-secondary); }
.prow .chev { flex: none; color: var(--color-text-secondary); font-size: 20px; line-height: 1; padding: 0 4px; }
.rp-face { flex: none; width: 36px; height: 36px; border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: var(--font-weight-bold); background: var(--color-bg); border: 1px solid var(--color-border); color: var(--color-text-secondary); }
.rp-face canvas { width: 100%; height: 100%; display: block; }

/* 控え・今日お休みのチップ */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; border: 1px solid var(--color-border); background: var(--color-surface); border-radius: 999px; padding: 3px 12px 3px 4px; font: inherit; font-size: var(--font-size-caption); color: var(--color-text-primary); cursor: pointer; }
.chip .rp-face { width: 32px; height: 32px; font-size: 12px; }
.chip .st { font-size: 11px; color: #fff; background: var(--color-accent); border-radius: 4px; padding: 0 5px; font-weight: var(--font-weight-bold); }
.chip .st.none { background: none; color: var(--color-text-secondary); font-weight: var(--font-weight-normal); padding: 0; }
.chip.off { color: var(--color-text-secondary); background: var(--color-bg); }
.chip.off .nm { text-decoration: line-through; }
.chip.off .st { background: none; color: var(--color-text-secondary); font-weight: var(--font-weight-normal); padding: 0; }
.chip.sel { box-shadow: 0 0 0 2px var(--color-accent); }
.chip:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* 下から出るシート（共通） */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); display: flex; align-items: flex-end; justify-content: center; z-index: 1500; }
.modal { background: var(--color-surface); border-radius: var(--radius-large) var(--radius-large) 0 0; box-shadow: var(--shadow-modal); padding: var(--space-4); width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; animation: modal-up var(--transition-base) ease-out; overscroll-behavior: contain; }
@media (min-width: 560px) { .modal-backdrop { align-items: center; } .modal { border-radius: var(--radius-large); } }
@keyframes modal-up { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.roster-sheet-title { margin: 0 0 var(--space-2); font-size: var(--font-size-heading, 18px); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); margin-bottom: var(--space-3); }
.sheet-head .roster-sheet-title { margin: 0; min-width: 0; }
.sheet-head .btn { min-height: 44px; flex: none; }
.modal > .sheet-head { position: sticky; top: calc(-1 * var(--space-4)); z-index: 2; background: var(--color-surface); margin: calc(-1 * var(--space-4)) calc(-1 * var(--space-4)) var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-border); }
html.modal-open, html.modal-open body { overflow: hidden; }
.modal-close-btn { width: 100%; margin-top: var(--space-4); }
.modal-photo-actions { display: flex; gap: var(--space-2); margin-top: var(--space-3); flex-wrap: wrap; }
.modal-photo-actions .btn { flex: 1 1 auto; }

/* 選手を選ぶシート */
.roster-pick-list { display: flex; flex-direction: column; }
.rp-current { display: grid; grid-template-columns: 36px minmax(0, 1fr); grid-template-areas: "face name" "acts acts"; align-items: center; gap: var(--space-2); padding: var(--space-2); margin-bottom: var(--space-2); background: var(--color-accent-tint); border-radius: var(--radius-small); }
.rp-current .rp-face { grid-area: face; }
.rp-current .rp-name { grid-area: name; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--font-weight-semibold); }
.rp-current .rp-acts { grid-area: acts; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.rp-current .rp-acts > * { min-height: 44px; min-width: 0; }
.rp-current .rp-acts select { font-size: 16px; padding: 0 6px; }
.rp-current .rp-acts button { border-radius: var(--radius-small); border: 1px solid var(--color-border); background: var(--color-surface); font: inherit; font-size: var(--font-size-caption); cursor: pointer; padding: 0 4px; }
.rp-current .rp-acts button:disabled { opacity: .4; cursor: default; }
.rp-current .rp-acts .rp-edit { grid-column: span 2; }
.rp-current .rp-acts .capbtn { grid-column: span 1; min-height: 44px; padding: 0 4px; }
.rp-current .rp-acts .capbtn[aria-pressed="true"] { background: #FFD60A; border-color: #E0B800; color: #1d1d1f; }
.roster-group { font-size: 12px; font-weight: var(--font-weight-bold); color: var(--color-text-secondary); margin: var(--space-3) 0 2px; }
.roster-pick { display: flex; align-items: center; gap: var(--space-2); width: 100%; min-height: 48px; padding: 6px 4px; border: none; border-bottom: 1px solid var(--color-border); background: none; font: inherit; color: var(--color-text-primary); text-align: left; cursor: pointer; }
.roster-pick .rp-face { width: 36px; height: 36px; }
.roster-pick .rp-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roster-pick .rp-state { flex: none; font-size: 12px; color: var(--color-text-secondary); white-space: nowrap; }
.roster-pick.is-off .rp-name { color: var(--color-text-secondary); }
.roster-pick:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.roster-empty { color: var(--color-accent); }
.roster-add { color: var(--color-accent); font-weight: var(--font-weight-semibold); }
.roster-add .rp-face { color: var(--color-accent); border-color: var(--color-accent); font-size: 20px; }
.roster-pick.is-new { background: var(--color-accent-tint); }
.roster-pick.is-new .rp-state { color: var(--color-accent); font-weight: var(--font-weight-semibold); }
.roster-pick:disabled { opacity: .5; cursor: default; }

/* 主将ボタン（サッカー版と同じ見た目: 押すと黄色）・主将の小さな印・投打の切り替え */
.capbtn { flex: none; appearance: none; min-height: 44px; padding: 0 var(--space-2); border-radius: var(--radius-small); border: 2px solid var(--color-border); background: var(--color-surface); color: var(--color-text-secondary); font: inherit; font-size: var(--font-size-caption); font-weight: var(--font-weight-semibold); cursor: pointer; }
.capbtn[aria-pressed="true"] { background: #FFD60A; border-color: #E0B800; color: #1d1d1f; }
.capbtn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.capbtn-wide { width: 100%; margin-top: 14px; }
.capmark { display: inline-block; flex: none; width: 1.5em; height: 1.5em; line-height: 1.5em; border-radius: 50%; background: #FFD60A; color: #1d1d1f; font-size: 11px; font-weight: 800; text-align: center; margin-left: 4px; vertical-align: middle; }
.tb-field { display: grid; grid-template-columns: 3em minmax(0, 1fr); gap: 6px var(--space-2); align-items: center; margin: var(--space-3) 0 0; }
.tb-field .field-label { margin: 0; }
.tb-seg button { min-height: 44px; }

/* 控えの役割シート */
.roles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.roles button { min-height: 48px; border-radius: 10px; border: 1px solid var(--color-border); background: var(--color-surface); font: inherit; color: var(--color-text-primary); cursor: pointer; }
.roles button[aria-pressed="true"] { background: var(--color-accent); border-color: var(--color-accent); color: #fff; font-weight: var(--font-weight-bold); }
.roles button:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.offrow { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); margin-top: 14px; padding: 10px 12px; border: 1px solid var(--color-border); border-radius: 10px; }
.offrow small { display: block; font-size: var(--font-size-caption); color: var(--color-text-secondary); }
.toggle { flex: none; min-width: 96px; min-height: 44px; border-radius: 999px; border: 1px solid var(--color-border); background: var(--color-surface); font: inherit; color: var(--color-text-primary); cursor: pointer; }
.toggle[aria-pressed="true"] { background: var(--color-bg); color: var(--color-text-secondary); text-decoration: line-through; }
.toggle:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* 新規選手・まとめて貼り付け */
.new-form { display: flex; gap: var(--space-3); align-items: center; }
.new-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.new-fields .input { min-height: 44px; font-size: 16px; }
.new-fields .in-num { width: 112px; text-align: center; }
.paste-text { min-height: 140px; font-family: inherit; font-size: 16px; line-height: 1.6; resize: vertical; margin-top: var(--space-2); }
.paste-preview { font-size: var(--font-size-caption); color: var(--color-text-secondary); margin: var(--space-2) 0 0; }
.paste-preview ul { margin: var(--space-1) 0 0; padding-left: var(--space-4); color: var(--color-text-primary); max-height: 28vh; overflow-y: auto; }
.paste-preview li.skip { color: var(--color-text-secondary); }

/* ---- パソコン（1024px以上）: 左=仕上がり（固定）／右=フォルダの見出し＋中身 ---- */
@media (min-width: 1024px) {
  main { max-width: 1180px; }
  .workspace { display: grid; grid-template-columns: minmax(400px, 480px) minmax(0, 1fr); gap: var(--space-4); align-items: start; }
  .col-left { display: block; position: sticky; top: 16px; }
  .col-right { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
  .preview-canvas { max-height: calc(100vh - 160px); }
  .tabs { position: static; padding-top: 0; }
  .thumb-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* ---- スマホ（1023.98px以下）: 縦1列。切り替えは画面の一番下に固定、保存・共有は「画像にする」だけ ---- */
@media (max-width: 1023.98px) {
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .col-left { display: block; }
  .tabs { position: fixed; top: auto; left: 0; right: 0; bottom: 0; z-index: 50; padding: 0 0 env(safe-area-inset-bottom); background: var(--color-surface); border-top: 1px solid var(--color-border); transition: transform var(--transition-base); }
  body.past-tool .tabs { transform: translateY(110%); }
  .tabs-inner { padding: 0; gap: 0; }
  .tab { top: 0; min-height: 60px; border: none; border-radius: 0; background: none; box-shadow: none; font-size: 11px; gap: 2px; }
  .tab .ti { display: block; font-size: 22px; line-height: 1; filter: grayscale(1); opacity: .55; }
  .tab .tc { display: none; }
  .tab[aria-selected="true"] { background: none; box-shadow: none; color: var(--color-accent); }
  .tab[aria-selected="true"] .ti { filter: none; opacity: 1; }
  .tab:focus-visible { outline-offset: -4px; }
  .tabs ~ .tabpane { margin-top: 0; }
  /* メンバー一覧では仕上がりを出さない */
  body[data-tab="members"] .col-left { display: none; }
  /* デザインの横一列は「画像にする」画面だけ */
  .thumb-strip { display: grid; grid-auto-flow: column; grid-auto-columns: 56px; gap: 6px; overflow-x: auto; overflow-y: hidden; margin-top: 6px; padding: 2px 0; scroll-snap-type: x proximity; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .thumb-strip::-webkit-scrollbar { display: none; }
  .thumb-strip .thumb { scroll-snap-align: start; }
  .thumb-strip .thumb span { font-size: 9px; line-height: 1.2; padding: 1px 0 2px; }
  body:not([data-tab="image"]) .thumb-strip { display: none; }
  /* 元の位置のデザイン一覧は、仕上がりのすぐ下の横一列と重複するのでスマホでは隠す */
  .design-card #designLabel, .design-card #thumbGrid { display: none; }
  body:not([data-tab="image"]) .export-actions { display: none; }
  .export-actions { bottom: calc(68px + env(safe-area-inset-bottom)); z-index: 40; }
  input, select, textarea { scroll-margin-bottom: 140px; }
  .app-header { padding: var(--space-3) var(--space-2) var(--space-1); text-align: left; }
  .app-logo { font-size: min(17px, 3.8vw); line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; }
  .app-tagline { display: none; }
  main { padding: 0 var(--space-2) var(--space-5); }
  .toast-container { bottom: calc(76px + env(safe-area-inset-bottom)); }
  body[data-tab="image"] .toast-container { bottom: calc(136px + env(safe-area-inset-bottom)); }
  /* 下から出るシートは「実際に見えている範囲」に置く（キーボードが出ても隠れない。--vv-h / --vv-top は app.js が入れる） */
  .modal-backdrop { top: var(--vv-top, 0px); bottom: auto; height: var(--vv-h, 100%); }
  .modal { max-height: calc(var(--vv-h, 100vh) - 24px); }
}
