/* ============================================================
   E-計算！ Sports — 分野の色（../assets/css/ek.css の v2 層の上に重ねる）
   赤 #B3261E（白の上で 6.54:1、企画書 第9章の4 で決定）。暗い表示は #F28B82（7.59:1）。
   公開のときも ek.css は変えず、ここに持つ（分野一覧の点の色だけ、公開のときに ek.css へ足す）。
   部品の見た目は ../assets/css/ek-simple.css。
   ============================================================ */
html[data-section="sports"] { --accent: #B3261E; --accent-ink: #FFFFFF; --accent-soft: #F9E9E8; }
@media (prefers-color-scheme: dark) {
  html[data-section="sports"]:where(:not([data-theme="light"])) { --accent: #F28B82; --accent-ink: #1B0E0D; --accent-soft: rgba(242, 139, 130, .16); }
}
html[data-section="sports"][data-theme="dark"] { --accent: #F28B82; --accent-ink: #1B0E0D; --accent-soft: rgba(242, 139, 130, .16); }

/* ---- 一覧 ---- */
.sp-wait { margin: 24px 0; padding: 16px 18px; border-radius: var(--r); background: var(--accent-soft); color: var(--ink); font-size: 15px; }

/* ---- 印刷：入力・広告・ボタンを消し、結果だけを出す（企画書 付録B） ---- */
@media print {
  .site-header, .site-footer, .ek-ad, .adsbygoogle, .sp-noprint, button:not(.sp-p):not(.sp-nm) { display: none !important; }
  /* 表の中の名前はボタンなので、印刷では文字として出す */
  .sp-p, .sp-nm { border: 0 !important; background: none !important; color: #000 !important; }
  .sp-print { width: 100% !important; }
  thead { display: table-header-group; }
  tr { break-inside: avoid; }
}

/* ---- 計算の形の切り替え（1人／チーム全員） ---- */
.sp-tabs { display: flex; gap: 6px; margin: 14px 0 0; flex-wrap: wrap; }
.sp-tabs button { appearance: none; border: 1px solid var(--grid); background: transparent; color: var(--ink-2); border-radius: 999px; padding: 8px 16px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.sp-tabs button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.sp-tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- 入力の見出し（ラジオの組など、label にできないもの） ---- */
.field > .lbl { display: block; font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 5px; }
html[data-ui="v2"] .field > .lbl .hint { display: block; margin: 3px 0 0; font-size: 12px; font-weight: 400; color: var(--muted); line-height: 1.6; }

/* ---- 貼り付けの欄 ---- */
.field textarea { width: 100%; box-sizing: border-box; min-height: 9em; padding: 10px 12px; border: 1px solid var(--grid); border-radius: var(--r); background: var(--bg, #fff); color: var(--ink); font: 14px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; resize: vertical; }
.field textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---- 結果の表・注記・ボタン ---- */
.sp-table td:first-child { text-align: left; }
.sp-rule { margin: 10px 0 0; font-size: 13px; color: var(--ink-2); line-height: 1.7; }
.sp-note { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.7; }
.sp-errors { margin: 12px 0 0; padding: 10px 14px; border-radius: var(--r); background: color-mix(in srgb, #D97A2B 12%, transparent); font-size: 13.5px; }
.sp-errors p { margin: 0 0 4px; }
.sp-errors ul { margin: 0; padding-left: 1.2em; }
.sp-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 12px 0 0; }
.sp-btn { appearance: none; border: 1px solid var(--accent); background: transparent; color: var(--accent); border-radius: var(--r); padding: 8px 14px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.sp-btn:hover { background: var(--accent-soft); }
.sp-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#copyMsg { font-size: 13px; color: var(--ink-2); }

/* ---- 結果の中の小見出し（スプリット表など） ---- */
.sp-h3 { margin: 18px 0 6px; font-size: 15px; }

/* ---- 道具のページ（#10・#11・#13・#23） ---- */
.sp-resume { margin: 14px 0 0; padding: 12px 16px; border-radius: var(--r); background: var(--accent-soft); font-size: 14px; }
.sp-resume p { margin: 0; }
.sp-record ul { margin: 6px 0 0; padding-left: 1.2em; font-size: 13px; }

/* トーナメント表：回戦ごとの列。スマホでは横にずらして見る */
.sp-bracket-wrap { overflow-x: auto; margin: 12px 0 0; padding: 4px 0 8px; }
.sp-bracket-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sp-bracket { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 1fr); gap: 14px; min-width: max-content; }
.sp-col { display: flex; flex-direction: column; min-width: 150px; }
.sp-col-h { margin: 0 0 6px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); text-align: center; }
.sp-col-body { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 8px; }
.sp-col-third { justify-content: flex-end; }
.sp-m { display: flex; flex-direction: column; border: 1px solid var(--grid); border-radius: var(--r); background: var(--bg, #fff); overflow: hidden; }
.sp-m[data-status="stale"] { border-color: #D97A2B; }
.sp-p { appearance: none; display: flex; justify-content: space-between; align-items: center; gap: 6px; width: 100%; min-height: 36px; padding: 6px 10px; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 14px; text-align: left; overflow-wrap: anywhere; }
.sp-p + .sp-p { border-top: 1px solid var(--grid); }
button.sp-p { cursor: pointer; }
button.sp-p:hover { background: var(--accent-soft); }
button.sp-p:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.sp-p.sp-win { font-weight: 700; background: var(--accent-soft); }
.sp-p.sp-lose { color: var(--muted); }
.sp-p.sp-pick { outline: 2px dashed var(--accent); outline-offset: -3px; }
.sp-bye, .sp-tbd { color: var(--muted); font-size: 13px; }
.sp-mark { font-size: 12px; }
.sp-score, .sp-st { padding: 2px 10px 4px; font-size: 12px; color: var(--muted); }
.sp-st { color: #9A4A00; }
.sp-list { margin-top: 12px; }

@media print {
  @page { size: A4 landscape; margin: 10mm; }
  .sp-bracket-wrap { overflow: visible; }
  .sp-bracket { grid-auto-columns: minmax(110px, 1fr); gap: 8px; }
  .sp-p { min-height: 22px; padding: 2px 6px; font-size: 11px; }
  .sp-list[open] { break-before: page; }
}

/* 総当たり：時間割・結果の入力・星取表 */
.sp-ref { display: block; font-size: 12px; color: var(--muted); }
.sp-sched td, .sp-cross td, .sp-cross th { white-space: nowrap; }
.sp-after-lunch td { border-top: 2px solid var(--accent); }
.sp-self { color: var(--muted); text-align: center; }
.sp-res { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.sp-res li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 0; border-bottom: 1px solid var(--grid); font-size: 14px; }
.sp-res-t { min-width: 6em; }
.sp-res-n { width: 3.2em; padding: 6px 8px; border: 1px solid var(--grid); border-radius: var(--r); font: inherit; text-align: center; background: var(--bg, #fff); color: var(--ink); }
.sp-res-n:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.sp-res-pk { padding: 6px; border: 1px solid var(--grid); border-radius: var(--r); font: inherit; }

/* ダブルスの表・チーム分け */
.sp-rot td { white-space: nowrap; }
.sp-nm { appearance: none; border: 0; background: transparent; color: inherit; font: inherit; padding: 2px 4px; border-radius: 6px; cursor: pointer; }
.sp-nm:hover { background: var(--accent-soft); }
.sp-nm:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sp-nm.sp-pick { outline: 2px dashed var(--accent); outline-offset: 1px; background: var(--accent-soft); }
.sp-vs { color: var(--muted); font-size: 12px; }
.sp-gtag { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: var(--accent-soft); font-size: 11.5px; color: var(--ink-2); }
.sp-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.sp-group { border: 1px solid var(--grid); border-radius: var(--r); padding: 10px 12px; }
.sp-group h3 { margin: 0 0 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.sp-gsum { font-size: 12px; font-weight: 400; color: var(--muted); }
.sp-group ul { list-style: none; margin: 0; padding: 0; }
.sp-group li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 0; border-top: 1px solid var(--grid); font-size: 14px; }
.sp-move { padding: 3px 4px; border: 1px solid var(--grid); border-radius: 6px; font: inherit; font-size: 12.5px; background: var(--bg, #fff); color: var(--ink); }
@media print { .sp-groups { grid-template-columns: repeat(3, 1fr); } .sp-group { break-inside: avoid; } }
.field > input[type="text"], .field > select { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--grid); border-radius: var(--r); background: var(--bg, #fff); color: var(--ink); font: inherit; font-size: 15px; }
.field > input[type="text"]:focus, .field > select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
/* ボウリング：スコア表と本数のボタン（#18） */
.sp-bowl { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); border: 1px solid var(--grid); border-radius: var(--r); overflow: hidden; }
.sp-fr { display: flex; flex-direction: column; align-items: stretch; padding: 4px 3px 6px; border-left: 1px solid var(--grid); text-align: center; }
.sp-fr:first-child { border-left: 0; }
.sp-fr.sp-cur { background: var(--accent-soft); box-shadow: inset 0 -3px 0 var(--accent); }
.sp-fn { font-size: 11.5px; color: var(--muted); }
@media (max-width: 560px) {
  .sp-bowl { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .sp-fr:nth-child(6) { border-left: 0; }
  .sp-fr:nth-child(n+6) { border-top: 1px solid var(--grid); }
}
.sp-balls { display: flex; justify-content: flex-end; gap: 2px; min-height: 22px; }
.sp-ball { display: inline-block; min-width: 1.4em; padding: 0 2px; border: 1px solid var(--grid); border-radius: 4px; font-size: 13px; font-weight: 700; line-height: 20px; }
.sp-cum { padding-top: 4px; font-size: 17px; font-weight: 700; min-height: 1.4em; }
.sp-pad { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; margin: 14px 0 0; }
.sp-pad button { appearance: none; min-height: 48px; border: 1px solid var(--accent); border-radius: var(--r); background: transparent; color: var(--accent); font: inherit; font-size: 18px; font-weight: 700; cursor: pointer; }
.sp-pad button.sp-pad-x { background: var(--accent); color: var(--accent-ink); }
.sp-pad button:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); }
.sp-pad button:disabled { border-color: var(--grid); background: transparent; color: var(--muted); opacity: .45; cursor: default; }
.sp-pad button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ギア比の表（#20） */
.sp-gear th, .sp-gear td { white-space: nowrap; text-align: center !important; }
.sp-gear caption { caption-side: top; text-align: left; font-size: 12.5px; color: var(--muted); padding: 0 0 6px; }
.sp-gear td.sp-cur { background: var(--accent-soft); font-weight: 700; }
.sp-gear td.sp-same { box-shadow: inset 0 0 0 2px var(--accent); }
.sp-gear td.sp-tasuki { color: var(--muted); }

/* ゴルフ：隠しホールの選択（#15） */
.sp-holes { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 4px; margin: 6px 0 0; }
.sp-hole { appearance: none; display: flex; flex-direction: column; align-items: center; padding: 4px 0; border: 1px solid var(--grid); border-radius: 8px; background: transparent; color: var(--ink); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.sp-hole small { font-size: 11px; font-weight: 400; color: var(--muted); }
.sp-hole[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.sp-hole[aria-pressed="true"] small { color: var(--accent-ink); }
.sp-hole:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sp-holes-h { margin: 10px 0 0; font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.sp-mk { display: inline-block; margin: 0 4px 0 0; padding: 0 6px; border-radius: 999px; border: 1px solid var(--accent); font-size: 11.5px; color: var(--accent); white-space: nowrap; }
@media (max-width: 420px) { .sp-holes { grid-template-columns: repeat(5, 1fr); } }
@media print { .sp-pad { display: none; } }

/* 暑さ指数の区分の帯（#22）。色だけでなく区分名と境目の数も出す */
.sp-heat { position: relative; margin: 16px 0 26px; padding-top: 26px; }
.sp-heat-bar { display: flex; height: 34px; border-radius: var(--r); overflow: hidden; border: 1px solid var(--grid); }
.sp-heat-seg { display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 700; color: #1a1a1a; white-space: nowrap; overflow: hidden; }
.sp-heat-0 { background: #DCEBF7; } .sp-heat-1 { background: #E6F2D8; } .sp-heat-2 { background: #FBEFC5; } .sp-heat-3 { background: #F8D2B0; } .sp-heat-4 { background: #F2B8B5; }
.sp-heat-mark { position: absolute; top: 0; transform: translateX(-50%); font-size: 13px; color: var(--ink); }
.sp-heat-mark::after { content: ""; position: absolute; left: 50%; top: 20px; width: 2px; height: 42px; margin-left: -1px; background: var(--ink); }
.sp-heat-ticks { position: relative; height: 16px; font-size: 11.5px; color: var(--muted); }
.sp-heat-ticks span { position: absolute; transform: translateX(-50%); top: 2px; }
@media (max-width: 420px) { .sp-heat-seg { font-size: 10px; } }
