/* このファイルは UIUX大臣の見本の部品を、そのまま写したもの（09_uiux/deliverables/screens/2026-09-27_score-grid/sg.css、社長の決定の追記25）。
   直すときは UIUX大臣の見本を直してから写す。道具に組むときの「つなぎ」は extra.css の末尾。 */
/* =====================================================================
   得点計算「紙の得点表」の見本の部品（sg = score grid）。UIUX大臣 2026-09-27
   土台: 08_design の tools.css（色・書体・文字の段・角丸）と v2.css（上の帯 .bar、ページ下 .footline）。
   新しい色・書体は足さない。値の説明: ../2026-09-27_得点計算の紙の得点表_画面案.md
   ===================================================================== */

/* ---- 器: スマホは縦1列。端は8px（格子に幅を回す）。人数が多いときは4px ---- */
.sgp { max-width: 560px; margin: 0 auto; padding: 8px 8px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; }
.sgp.is-dense { padding-left: 4px; padding-right: 4px; }
.has-pad .sgp { padding-bottom: calc(var(--padh, 300px) + 12px); }
.has-pad .footline { display: none; }
.sgp .bar__btn[hidden] { display: none; }

/* ---- 格子: 行＝項目（またはラウンド）、列＝人。1枚のカードの中に全部 ---- */
.sg {
  --lbl: 64px;     /* 項目名の列 */
  --gap: 4px;      /* マスの間（横）。人数が多いときは2px */
  --rh: 44px;      /* 行の高さ＝押せる最小 */
  --cfs: 20px;     /* マスの数字（Dela） */
  background: var(--c-card); border-radius: 16px; padding: 0 6px 6px;
}
.sg.is-dense { --lbl: 30px; --gap: 2px; --cfs: 16px; padding: 0 4px 4px; }
.sg__row, .sg__head { display: grid; grid-template-columns: var(--lbl) repeat(var(--n), minmax(0, 1fr)); column-gap: var(--gap); }
.sg__row { margin-top: 4px; }

/* 見出しの行＝合計の帯。上に固定して、下へ送っても・数字パッドを出しても合計と「戻す」が隠れない */
.sg__head { position: sticky; top: 0; z-index: 3; margin: 0 -6px; padding: 6px 6px 8px; border-radius: 16px 16px 0 0;
  background: var(--c-band); color: var(--c-on-band); align-items: end; }
.sg.is-dense .sg__head { margin: 0 -4px; padding: 6px 4px 8px; }
.sg__p { min-width: 0; overflow: hidden; display: flex; flex-direction: column; align-items: center; text-align: center; }
.sg__nm { max-width: 100%; font-size: var(--fs-small); font-weight: 700; line-height: 1.4; letter-spacing: .02em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sg.is-dense .sg__nm { text-overflow: clip; letter-spacing: 0; font-size: 11px; }
.sg[style*="--n:9"] .sg__nm, .sg[style*="--n:10"] .sg__nm { max-width: 2.1em; }  /* 9〜10人は名前を2字に */
.sg__c.is-mini b { transform-origin: center; }
.sg__sum { transform-origin: center; }  /* 36pxの列に3字まで（隣の名前と続けて読まれないように） */
/* 合計: 列の幅いっぱいまで大きく。48px（表示の段）から、入らなければ 40→32→24→20→16 と下げる（JS の fit） */
.sg__sum { display: inline-block; font-family: var(--f-num); font-weight: 400; font-size: 48px; line-height: 1.05; letter-spacing: 0;
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.sg__rk { min-height: 22px; display: flex; align-items: center; font-size: 11px; font-weight: 700; line-height: 1.2; }
.sg__rk .tag { height: 22px; padding: 0 7px; font-size: 11px; letter-spacing: .04em; }
.sg.is-dense .sg__rk .tag { padding: 0 3px; letter-spacing: 0; }
.sg__p.is-cur .sg__nm { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; } /* 今入れている人（名前に下線。色だけにしない） */

/* 角のマス: 「戻す」。帯と一緒に固定するので、いつも同じ場所に見える */
.sg__undo { align-self: stretch; min-height: 56px; border: 0; border-radius: 12px; background: rgba(255, 253, 247, .14); color: var(--c-on-band);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0; cursor: pointer; }
.sg__undo svg { width: 22px; height: 22px; display: block; }
.sg__undo small { font-size: 11px; font-weight: 700; line-height: 1.2; letter-spacing: .02em; }
.sg__undo:disabled { opacity: .45; }
.sg.is-dense .sg__undo small { display: none; }  /* 30px の列では字を省き、形だけ（aria-label は残す） */

/* 項目名の列: 13px 太字。1つの重み（×5 など）を下に小さく */
.sg__lbl { display: flex; flex-direction: column; justify-content: center; min-height: var(--rh); padding-left: 2px;
  font-size: var(--fs-small); font-weight: 700; line-height: 1.25; letter-spacing: 0; font-feature-settings: "palt"; word-break: auto-phrase; overflow-wrap: anywhere; }
.sg__lbl small { font-size: 11px; font-weight: 700; line-height: 1.2; color: var(--c-hint); }
.sg__lbl .rn { font-family: var(--f-num); font-weight: 400; font-size: var(--fs-body); line-height: 1; }   /* ラウンドの番号 */

/* マス: 入力欄と同じ地（薄い卓色）と下の線（入力できる場所の目印。紙の白との差が小さいため）。数字だけ */
.sg__c { min-width: 0; min-height: var(--rh); border: 0; border-bottom: 2px solid var(--c-field-line); border-radius: 8px 8px 3px 3px; padding: 0 2px; cursor: pointer;
  background: var(--c-field); color: var(--c-text); display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; }
.sg__c b { font-family: var(--f-num); font-weight: 400; font-size: var(--cfs); line-height: 1.05; letter-spacing: 0; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sg__c small { font-size: 11px; font-weight: 700; line-height: 1.2; color: var(--c-hint); letter-spacing: 0; white-space: nowrap; }
.sg__c.is-active { outline: 3px solid var(--c-focus); outline-offset: -1px; position: relative; z-index: 1; }
.sg__c.is-mini b { font-size: 12px; }  /* 4桁が入らない狭い列だけ（JS の fit が付ける） */

/* 同点のときだけ使う行: 少し離して、薄い字・中が空の枠 */
.sg__row.is-tie { margin-top: 12px; }
.sg__row.is-tie .sg__lbl { color: var(--c-hint); }
.sg__row.is-tie .sg__c { background: transparent; border-bottom-color: var(--c-hint); box-shadow: inset 0 0 0 2px var(--c-field); }

/* ラウンドの行（スカルキング・得点表） */
.sg__row.is-past { --rh: 36px; }
.sg__row.is-cur .sg__lbl .rn { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--c-tag); color: var(--c-on-tag); }
.sg__row.is-cur { --rh: 52px; }
.sg__row.is-future .sg__c { background: transparent; border-bottom-color: transparent; box-shadow: inset 0 0 0 2px var(--c-field); }
.sg__row.is-future .sg__lbl { color: var(--c-hint); }
.sg__c .bw { display: flex; gap: 6px; align-items: baseline; font-size: 11px; font-weight: 700; color: var(--c-hint); line-height: 1.1; }
.sg__c .bw b { font-size: var(--cfs); color: var(--c-text); }
.sg.is-dense .sg__c .bw { flex-direction: column; gap: 0; align-items: center; }
.sg__c .bw i { font-style: normal; }
.sg__add { grid-column: 2 / -1; min-height: 44px; }
.sg__addrow { margin-top: 8px; }

/* 注意の1行（スカルキング: 取った数の合計が合わない）。数字パッドの真上 */
.sg-warn { font-size: var(--fs-small); font-weight: 700; line-height: 1.6; padding: 0 6px; }
.sg-warn::before { content: "！ "; }

/* ---- 数字パッド（下から。暗い幕は敷かない＝格子を見ながら入れる。キーボードは出さない） ---- */
.sp { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; max-width: 560px; margin: 0 auto;
  background: var(--c-card); border-radius: 24px 24px 0 0; box-shadow: 0 -2px 0 var(--c-field);
  padding: 6px 10px calc(10px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 6px; }
.sp__head { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 4px; }
.sp__who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.sp__who b { font-size: var(--fs-body); font-weight: 700; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sp__who span { font-size: var(--fs-small); font-weight: 700; color: var(--c-hint); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sp__val { font-family: var(--f-num); font-size: var(--fs-head); line-height: 1; min-width: 3ch; text-align: right; padding: 8px 10px; border-radius: 10px;
  background: var(--c-field); border-bottom: 2px solid var(--c-field-line); font-variant-numeric: tabular-nums; }
.sp__close { font-size: var(--fs-small); }
.sp__keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.sp__keys button { min-height: 48px; border: 0; border-radius: 12px; background: var(--c-field); color: var(--c-text); cursor: pointer; padding: 0;
  font-family: var(--f-num); font-size: 24px; line-height: 1; }
.sp__keys .st { font-size: 18px; }                                                      /* 刻み（−1 ＋1 など） */
.sp__keys .t { font-family: var(--f-text); font-size: var(--fs-body); font-weight: 700; } /* 字のボタン（消す） */
.sp__keys .go { grid-column: span 2; background: var(--c-press); color: var(--c-on-press); font-family: var(--f-text); font-size: var(--fs-body); font-weight: 700; letter-spacing: .06em; }
.sp__keys button:disabled { background: transparent; color: var(--c-hint); opacity: .5; cursor: default; }
.sp__keys .off { visibility: hidden; }
/* スカルキング: 予想・取った数・ボーナスの切り替え（選んだものは卓の緑の面＋字。色だけにしない: 選んだ方は下線も） */
.sp__tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.sp__tabs button { min-height: 44px; border: 0; border-radius: 12px; background: var(--c-field); color: var(--c-text); cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 0 10px; font-size: var(--fs-small); font-weight: 700; }
.sp__tabs button b { font-family: var(--f-num); font-weight: 400; font-size: 20px; }
.sp__tabs [aria-pressed="true"] { background: var(--c-band); color: var(--c-on-band); }
.sp__tabs [aria-pressed="true"] span { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
:root[data-theme="dark"] .sp__tabs [aria-pressed="true"] { outline: 2px solid var(--mint); outline-offset: -2px; }

/* ---- スカルキングのパッド: 電話の並び（社長の決定の追記59。UIUX大臣の画面案 2026-09-27_スカルキングのパッド A案、見本 pad.css の値のまま） ----
   予想・取った数・ボーナスで同じ 3列×4段・同じ高さ（タブを替えてもパッドが動かない）。1が左上・0が下の真ん中・消すが左下 */
.sp--phone .sp__head { height: 48px; }
.sp--phone .sp__pm { min-width: 56px; min-height: 44px; border: 0; border-radius: 12px; background: var(--c-field); color: var(--c-text);
  font-family: var(--f-text); font-size: var(--fs-body); font-weight: 700; cursor: pointer; }
.sp--phone .sp__keys { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sp--phone .sp__keys button { min-height: 52px; }
.sp--phone .sp__keys .go { grid-column: auto; }
/* 押せない数は、形を残して中を空ける（格子の「まだ先の回」のマスと同じ形。新しい色は使わない） */
.sp--phone .sp__keys button:disabled { background: transparent; box-shadow: inset 0 0 0 2px var(--c-field); color: var(--c-hint); opacity: .6; }
/* タブの字を2行に折らない（「ボーナ／ス」を直す。「−120」でもタブの幅を変えない） */
/* タブの幅は 予想:取った数:ボーナス = 5:6:7（字の長さの順。比は固定なので値が変わっても動かない）。
   1280 の左の列（340px）でも「ボーナス−120」を縮めすぎずに入れる（UIUX大臣の公開前の確認 2026-09-27） */
.sp--phone .sp__tabs { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr) minmax(0, 7fr); }
.sp--phone .sp__tabs button { padding: 0 8px; }
.sp--phone .sp__tabs span { white-space: nowrap; letter-spacing: 0; }
.sp--phone .sp__tabs b { font-size: 18px; white-space: nowrap; }

/* ---- B案（スカルキング・今のラウンドを大きく）: 行＝人 ---- */
.rb { background: var(--c-card); border-radius: 16px; padding: 0 6px 6px; }
.rb__nav { display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; gap: 4px; padding: 6px 0; }
.rb__nav b { text-align: center; font-size: var(--fs-body); font-weight: 700; }
.rb__nav button { min-height: 44px; border: 0; border-radius: 12px; background: var(--c-field); color: var(--c-text); font-size: 20px; font-weight: 700; cursor: pointer; }
.rb__row { display: grid; grid-template-columns: minmax(0, 1fr) 52px 52px 56px 92px; gap: 4px; align-items: center; margin-top: 4px; }
.rb__row.rb__h { font-size: 11px; font-weight: 700; color: var(--c-hint); text-align: center; margin: 0; }
.rb__who { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding-left: 4px; }
.rb__who .tag { height: 20px; padding: 0 6px; font-size: 11px; }
.rb__who .rk { font-size: 11px; font-weight: 700; color: var(--c-hint); line-height: 1.2; }
.rb__nm { max-width: 100%; font-weight: 700; font-size: var(--fs-body); line-height: 1.2; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rb__row .sg__c { min-height: 48px; }
.rb__row .sg__c b { font-size: 24px; }
.rb__pt { text-align: center; font-family: var(--f-num); font-size: var(--fs-body); line-height: 1.1; }
.rb__pt small { display: block; font-family: var(--f-text); font-size: 11px; font-weight: 700; color: var(--c-hint); }
.rb__tot { justify-self: stretch; min-width: 0; min-height: 48px; border-radius: 12px; background: var(--c-band); color: var(--c-on-band); display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.rb__tot .sg__sum { font-size: 32px; }
.rb__tot .tag { height: 20px; padding: 0 5px; font-size: 11px; }
.rb__tot .rk { font-size: 11px; font-weight: 700; }

/* ---- パソコン（900px以上）: 左に数字パッド（いつも出しておく）、右に格子。数字のキーでも入る ---- */
@media (min-width: 900px) {
  .sgp { max-width: 1120px; padding: 24px; display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 12px 16px; align-items: start; }
  .sgp > .bar { grid-column: 1 / -1; }
  .sgp > .side { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 12px; }
  .sgp > .main { display: flex; flex-direction: column; gap: 12px; }
  .sg { --lbl: 150px; --rh: 48px; --cfs: 24px; }
  .sg.is-dense { --lbl: 96px; --gap: 4px; --cfs: 20px; }
  .sg__lbl { font-size: var(--fs-body); padding-left: 8px; }
  .sg__lbl small { font-size: var(--fs-small); }
  .sg.is-dense .sg__undo small { display: block; }
  .sp { position: static; max-width: none; width: 100%; margin: 0; border-radius: 16px; box-shadow: none; padding: 8px 12px 12px; }
  .sp__keys button, .sp--phone .sp__keys button { min-height: 56px; }
  .sp__close { display: none; }
  .has-pad .sgp { padding-bottom: 24px; }
  .has-pad .footline { display: block; }
  .rb__row { grid-template-columns: minmax(0, 1fr) 72px 72px 72px 140px; }
  .rb__tot .sg__sum { font-size: 40px; }
}
@media (max-width: 899px) { .side, .main { display: contents; } }

/* ---- 高さが低いスマホ（375×667）: パッドのボタンを44pxに ---- */
@media (max-height: 700px) and (max-width: 899px) {
  .sp__keys button, .sp--phone .sp__keys button { min-height: 44px; }
  .sp--phone .sp__keys { gap: 6px; }
  .sp--phone .sp__head { height: 44px; }
  .sp { gap: 4px; }
  .bar { min-height: 48px; padding: 2px 4px; }
}
