/* ============================================================================
   Sports Coder 2 試合の管理（S4）・記録と書き出し（S5）— 本物のアプリで足した物だけ。
   入口・モード選択・試合一覧・試合の準備・記録の画面の見た目は wire.css（ワイヤー v1.3 の css/ui.css の写し・手で直さない）がそのまま当たる。ここは:
   チームの丸い札・試合一覧の日付の見出し・試合の項目の並び・見本の絵・名簿の表（顔写真）・手打ちの行・顔写真の切り抜き・引き出しの中・
   記録の画面の「試合終了の大得点」のプレビュー（S5）
   ============================================================================ */

/* ---- チームの丸い札（ロゴがあればロゴ・無ければ略称をチーム色の上に） ---- */
.mg-lg { display: grid; place-items: center; border-radius: 50%; background: var(--tc); font-weight: 900; font-size: 12px; overflow: hidden; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.mg-lg img { width: 100%; height: 100%; object-fit: contain; background: #16191e; }

/* ---- 試合一覧: 同じ列に2日以上ある時の日付の見出し ---- */
.mg-date { font-size: 11.5px; font-weight: 800; color: var(--dim); letter-spacing: .06em; padding: 2px 2px 0; border-bottom: 1px dashed var(--line); }

/* ---- 試合の項目（大会名・回戦・日付・開始予定 ／ 何試合目・会場・長さ） ---- */
.mg-meta1 { grid-template-columns: 2fr 1fr 1fr 1fr; gap: 10px; }
.mg-meta2 { grid-template-columns: repeat(4, 1fr); gap: 10px; }

/* ---- 見た目（A〜F）と見本の絵（出力と同じ描き方を 1/4 で） ---- */
.mg-pickrow { display: grid; grid-template-columns: minmax(0, 1fr) 480px; gap: 16px; align-items: start; }
.mg-pickcol { min-width: 0; }
.mg-pv { position: relative; width: 480px; height: 270px; border-radius: 6px; overflow: hidden; background: repeating-conic-gradient(#2a2d33 0 25%, #1c1f24 0 50%) 0 0 / 24px 24px; }
.mg-pvstage { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; transform-origin: 0 0; transform: scale(.25); pointer-events: none; }
@media (max-width: 1180px) {
  .mg-pickrow { grid-template-columns: minmax(0, 1fr); }
}

/* ---- 名簿の表（顔写真・外す） ---- */
.mg-roster td input { min-width: 0; }
.mg-phcell { white-space: nowrap; }
.mg-phl { cursor: pointer; display: inline-flex; align-items: center; }
.mg-thumb { width: 27px; height: 30px; border-radius: 4px; object-fit: cover; vertical-align: middle; background: #0c0e11; }
.mg-phx { margin-left: 4px; width: 18px; height: 18px; border-radius: 50%; font-size: 11px; line-height: 18px; color: #f3aaa4; border: 1px solid #7d3a36; vertical-align: middle; }
.mg-phx:hover { background: #3a1413; }
/* 「写真」の見出しに添える撮り方の一行（S9・表は .tblwrap が横に流せるので列が広がっても画面ははみ出さない） */
.mg-roster th.mg-phhead small { display: block; max-width: 104px; font-size: 10px; font-weight: 600; line-height: 1.35; color: var(--dim); white-space: normal; }

/* ---- 名簿の手打ちの行（背番号 → 名前 → Enter で次の人） ---- */
.mg-addrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; padding: 8px; border-radius: 7px; background: #161a1f; border: 1px solid var(--line2); }

/* ---- チームを作る・直す ---- */
.mg-logorow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---- 顔写真の切り抜き（9:10 の枠・顔を上の丸に合わせる・S9 で案内／回転／プレビューを足した） ---- */
/* ★枠は 270×300 のまま（cropmath.ts の FRAME_W／FRAME_H と同じ数＝ここを変えると位置合わせがずれる） */
.modal.mg-crop { width: 820px; border-color: var(--accent); max-height: 94vh; overflow-y: auto; }
.modal.mg-crop h3 small { font-size: 12px; color: var(--dim); font-weight: 600; margin-left: 6px; }
.mg-cropwrap { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.mg-cropframe { position: relative; flex: 0 0 270px; width: 270px; height: 300px; overflow: hidden; border-radius: 6px; background: #000; cursor: grab; touch-action: none; border: 1px solid var(--line2); }
.mg-cropframe:active { cursor: grabbing; }
.mg-cropframe canvas { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; user-select: none; pointer-events: none; }
.mg-face { position: absolute; left: 50%; top: 12%; width: 44%; height: 44%; transform: translateX(-50%); border: 2px dashed rgba(255, 255, 255, .8); border-radius: 50%; pointer-events: none; box-shadow: 0 0 0 999px rgba(0, 0, 0, .08); }
.mg-cropside { flex: 1; min-width: 300px; }
.mg-cropside p { font-size: 12.5px; line-height: 1.7; color: #d5dade; margin: 0 0 8px; }
.mg-cropside .fld input[type=range] { width: 100%; }
.mg-cropguide { margin: 0 0 10px; padding-left: 18px; font-size: 12.5px; line-height: 1.7; color: #d5dade; }
.mg-cropguide b { color: #fff; }
.mg-croprot { display: flex; gap: 8px; margin-top: 8px; }

/* テロップに出るとこう見えます（S9・出力と同じ描き方で、写真の出る所に寄って描く） */
.mg-croppv { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.mg-croppvh { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.mg-croppvh .note { font-size: 11px; }
.mg-cropdes { display: flex; align-items: center; gap: 4px; margin: 6px 0 8px; }
.mg-cropdes .note { margin-right: 4px; font-size: 11px; }
.mg-cropdes .btn { min-width: 30px; justify-content: center; font-weight: 800; }
.mg-cropdes .btn.on { background: #2d5ea8; border-color: #4f8ef7; color: #fff; }
.mg-croppvrow { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.mg-pvitem { display: flex; flex-direction: column; gap: 3px; }
.mg-pvitem > span { font-size: 11px; color: var(--dim); }
.mg-pvbox { position: relative; overflow: hidden; border-radius: 6px; border: 1px solid var(--line2); background: repeating-conic-gradient(#2a2d33 0 25%, #1c1f24 0 50%) 0 0 / 12px 12px; }
.mg-pvbox.band { width: 300px; height: 104px; }
.mg-pvbox.card { width: 140px; height: 162px; }
.mg-pvbox .mg-pvstage { transform: scale(.15); }   /* 寄り方は画面側が上書きする（cropmath の fitView） */

/* ---- 送出卓の「準備」の引き出しの中（上の帯なし） ---- */
body.embed .wrap { padding-top: 12px; }

/* ---- 記録と書き出し（S5）: 試合終了の大得点のプレビュー（枠の幅に合わせて縮める・出力と同じ描き方） ---- */
.mg-bigpv { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; border: 1px solid var(--line2); background: repeating-conic-gradient(#2a2d33 0 25%, #1c1f24 0 50%) 0 0 / 20px 20px; }
.mg-bigpv .mg-pvstage { transform: scale(.32); }   /* 幅に合わせて画面側が上書きする（取り消し線は wire.css の .rectbl tr.void がそのまま当たる） */

/* ---- S7: チームマスタの一覧・詳細（/teams・/teams/:id・点検 P1-1） ---- */
.mg-color { display: inline-block; width: 13px; height: 13px; border-radius: 3px; background: var(--tc); border: 1px solid rgba(255, 255, 255, .18); vertical-align: -2px; margin-right: 6px; }
#teamTbl td, #teamMatches td { vertical-align: middle; }
#teamTbl .btn, #teamMatches .btn { margin-right: 4px; }
#teamTbl a b { color: #e8eaed; }
#teamTbl tr:hover a b { color: #fff; }

/* ---- S7: 試合一覧の絞り込み（今日＋未終了／過去の大会も見る・点検 P1-5） ---- */
.mg-filter { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; }
