/* 試合レポートの見た目。09_surge/report_template.html の <style> をそのまま移し、
   CSP（style-src 'self'）で使えない style 属性の代わりのクラスと、読み込み中・エラーの案内を末尾に足した */
:root {
  --bg: #11151c; --panel: #1a2029; --line: #2c3542; --text: #e6e9ee; --muted: #9aa4b2;
  --accent: #5aa9ff; --deal: #3ddc84; --take: #ff5c5c; --kill: #ffd447; --row-hover: #222a35; --row-sel: #24364d;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 "Yu Gothic UI", "Meiryo", system-ui, sans-serif; }
.page-head { padding: 14px 20px 8px; }
.back-link { display: inline-block; margin-bottom: 4px; color: var(--accent); text-decoration: none; font-size: 13px; }
.back-link:hover { text-decoration: underline; }
h1 { margin: 0 0 4px; font-size: 20px; overflow-wrap: anywhere; }
h2 { margin: 0 0 8px; font-size: 16px; }
h3 { margin: 0 0 8px; font-size: 15px; }
main { padding: 8px 20px 40px; }
section { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 16px; }
.hint { color: var(--muted); font-size: 12px; margin: 0 0 8px; }
/* 評価表 */
.table-wrap { max-height: 420px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th { position: sticky; top: 0; background: #202835; cursor: pointer; user-select: none; z-index: 1; }
th.sorted-asc::after { content: " ▲"; color: var(--accent); }
th.sorted-desc::after { content: " ▼"; color: var(--accent); }
td.name, th.name, td.text { text-align: left; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--row-hover); }
tbody tr.selected { background: var(--row-sel); }
.pos { color: var(--deal); } .neg { color: var(--take); } .dim { color: var(--muted); }
/* マッチサマリ（試合の情報は見出しと値の組、その下にサージ境界値） */
dl.meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin: 0 0 14px; }
dl.meta > div { background: #141a22; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; min-width: 0; }
dl.meta dt { color: var(--muted); font-size: 12px; }
dl.meta dd { margin: 0; font-size: 14px; font-weight: bold; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.surge-block { border-top: 1px solid var(--line); padding-top: 12px; }
/* 数値の出どころの一文（マッチサマリの見出しの下） */
.data-note { margin: -2px 0 10px; font-size: 12.5px; color: var(--text); opacity: .85; }
.data-note::before { content: "ⓘ "; color: var(--accent); }
/* 理論値（推定値）のバッジ。フォーカス・マウスで説明（.est-tip）を出す。小さく、見出しの横（表の見出しは下の行） */
.est { position: relative; display: inline-block; margin-left: 4px; padding: 0 4px; border: 1px solid #7a6630; border-radius: 3px;
       color: #e8c86a; font-size: 10px; font-weight: normal; line-height: 15px; vertical-align: middle; white-space: nowrap; cursor: help; }
.est:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.est-tip { display: none; position: absolute; z-index: 30; left: 0; top: calc(100% + 4px); width: max-content; max-width: 240px; white-space: normal;
           padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: rgba(10,13,18,.96); color: var(--text);
           font-size: 12px; line-height: 1.5; text-align: left; }
.est:hover .est-tip, .est:focus .est-tip { display: block; }
.est.est-right .est-tip { left: auto; right: 0; }
.est.closed .est-tip { display: none; }
th.est-th .est { display: block; width: max-content; margin: 2px 0 0 auto; }
th.est-th .est-tip { left: auto; right: 0; }
.stat .est { margin-left: 2px; }
/* 記録が欠けた値（点線の下線）。マウスを乗せる・フォーカス（タップ）で説明（data-note）を出す。説明はセルの文字に入れない */
td.missing { position: relative; text-decoration: underline dotted var(--muted); text-underline-offset: 3px; cursor: help; }
td.missing:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
td.missing:hover::after, td.missing:focus::after { content: attr(data-note); position: absolute; z-index: 30; right: 0; top: calc(100% + 2px);
  width: max-content; max-width: 220px; white-space: normal; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px;
  background: rgba(10,13,18,.96); color: var(--text); font-size: 12px; line-height: 1.5; text-align: left; text-decoration: none; }
td.missing.tip-left:hover::after, td.missing.tip-left:focus::after { right: auto; left: 0; }
/* マッチサマリのグラフ（合計資材数・高さの推移）。SVG は report_charts.js が枠の幅に合わせて描く（線・点の色は SVG の属性） */
.chart-block { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 14px; min-width: 0; }
.chart-block[hidden] { display: none; }
.chart { width: 100%; min-width: 0; overflow: hidden; }
.chart svg { display: block; max-width: 100%; height: auto; }
.chart .grid { stroke: #252d39; stroke-width: 1; }
.chart .axis-line { stroke: #4a5566; stroke-width: 1; }
.chart .phase-line { stroke: #4a5566; stroke-width: 1; stroke-dasharray: 3 3; }
.chart .axis-text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .axis-title { fill: var(--muted); font-size: 11.5px; }
.chart circle.pt { stroke: var(--panel); stroke-width: 2; }
.chart circle.hit { fill-opacity: 0; }
/* 点の当たり判定（列の幅いっぱいの見えない rect）。マウスを乗せる・フォーカスで薄く色を付け、フォーカスの輪を出す */
.chart .pivot { fill: transparent; cursor: pointer; outline: none; }
.chart .pivot:hover { fill: rgba(255,255,255,.05); }
.chart .pivot:focus-visible { fill: rgba(90,169,255,.12); stroke: var(--accent); stroke-width: 1.5; }
#tip .tip-line + .tip-line { margin-top: 2px; }
/* 高さのグラフで上限（40 ボックス）より高い点は、上の端に見える点で示す */
.chart circle.hit.clipped { fill-opacity: 1; stroke: var(--panel); stroke-width: 1; }
.chart-note { color: var(--muted); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 12px; color: var(--text); }
.chart-key { display: inline-flex; align-items: center; gap: 6px; }
.chart-swatch { flex: none; }
/* 選手の詳細: 上に選手の情報（横いっぱいの枠）と区間・時刻、下に左マップ・右タイムライン */
.player-panel { display: flex; gap: 12px; align-items: flex-start; background: #141a22; border: 1px solid var(--line); border-radius: 8px;
                padding: 10px; margin-bottom: 12px; }
.player-pick { flex: 0 0 240px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
/* チーム戦（Duo 以上）: プルダウンの左に「選手 / チーム」の切り替え */
.player-pick.has-mode { flex-basis: 300px; }
.pick-row { display: flex; gap: 6px; align-items: center; min-width: 0; }
.pick-row select { flex: 1; min-width: 0; }
.pick-mode { display: inline-flex; flex: none; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.pick-mode label { display: inline-flex; align-items: center; gap: 4px; padding: 5px 8px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.pick-mode label + label { border-left: 1px solid var(--line); }
.pick-mode input { margin: 0; }
.pick-mode[hidden] { display: none; } /* ソロの試合では出さない（display の指定より hidden を優先） */
.ctl-label { color: var(--muted); font-size: 12px; white-space: nowrap; }
.view-ctl { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.phase-row { display: flex; gap: 8px; align-items: baseline; }
.time-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; }
.time-row .slider-row { flex: 2 1 260px; min-width: 0; }
.time-row .readout { flex: 1 1 260px; }
/* 左にマップ、右にタイムライン。マップは 2026-11-17 に前の大きさ（min(88vh, 幅 - 右の列 640px - 間 16px)）の 9 割にして左に寄せ、
   空いた幅はすべて右の列へ（1366px の画面で右の列はおよそ 700px）。狭い画面（1200px 以下）は前と同じ（縦に積み、マップは 88vh まで・中央） */
.detail { display: grid; grid-template-columns: min(79.2vh, calc(90% - 590.4px)) minmax(0, 1fr); gap: 16px; align-items: start; }
.side > * + * { margin-top: 12px; }
.map-box { position: relative; min-width: 0; }
.map-wrap { position: relative; width: 100%; }
@media (max-width: 1200px) {
  .detail { grid-template-columns: minmax(0, 1fr); }
  .map-wrap { max-width: 88vh; margin: 0 auto; }
}
canvas { width: 100%; height: auto; display: block; border-radius: 6px; background: #0b0e13; }
canvas.zoomed { cursor: grab; } canvas.dragging { cursor: grabbing; }
.zoom-ctl { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; align-items: center; }
.zoom-ctl button { min-width: 36px; height: 32px; border: 1px solid var(--line); border-radius: 6px; background: rgba(15,20,27,.9);
                   color: var(--text); font: inherit; font-size: 16px; cursor: pointer; }
.zoom-ctl button:hover { background: #24364d; }
.zoom-ctl #zoom-reset { font-size: 12px; padding: 0 8px; }
.zoom-ctl span { background: rgba(15,20,27,.9); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; font-size: 12px; color: var(--muted); }
/* 表示の切り替え（全員の動線・周囲250m）: 拡大・縮小（右上）と対になるよう地図の左上に重ねる。地図の上でも読めるよう半透明の暗い下地。
   右上のボタン（およそ 180px）とぶつからない幅までにし、狭いときは文字を折り返す */
.map-opts { position: absolute; top: 8px; left: 8px; max-width: calc(100% - 200px); display: flex; flex-direction: column; gap: 2px;
            background: rgba(15,20,27,.78); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; font-size: 12.5px; }
.map-opts label { display: flex; align-items: center; gap: 6px; cursor: pointer; line-height: 1.35; }
.map-opts input { margin: 0; flex: none; }
#tip { position: fixed; pointer-events: none; background: rgba(10,13,18,.95); border: 1px solid var(--line); border-radius: 6px;
       padding: 6px 8px; font-size: 12px; display: none; z-index: 10; white-space: nowrap; }
select { width: 100%; background: #0f141b; color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 6px; font: inherit; }
.stats { flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 6px; min-width: 0; }
.stat { background: #141a22; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
.stat b { display: block; font-size: 16px; }
.stat small { color: var(--muted); }
/* チームの枠: 1366px の画面で 1 段に収まるよう欄を少し細くし、資材の合計（木 / レンガ / 鉄）は 2 欄分の幅 */
.stats.team-stats { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
.stat.wide { grid-column: span 2; }
.stat b { font-variant-numeric: tabular-nums; }
/* メンバーの色（地図の動線・位置、タイムラインの名前。report.js の MEMBER_COLORS と同じ） */
.m0 { color: #ff6fd8; } .m1 { color: #a98bff; } .m2 { color: #e8f27a; } .m3 { color: #9ef0ff; }
.phases { display: flex; flex-wrap: wrap; gap: 4px; }
.phases label { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 14px;
                padding: 2px 8px; cursor: pointer; font-size: 12px; }
.phases input { margin: 0; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.slider-row { display: flex; align-items: center; gap: 8px; }
/* タイムスライダーの再生（▶ / ⏸）と速さ（×10 / ×20 / ×60）。スライダーの左 */
.play-btn { flex: none; min-width: 36px; height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; background: #0f141b;
            color: var(--text); font: inherit; font-size: 14px; line-height: 1; cursor: pointer; }
.play-btn:hover { background: #24364d; }
.play-btn:focus-visible, .play-speed:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
select.play-speed { flex: none; width: auto; padding: 4px 6px; font-size: 13px; }
input[type=range] { flex: 1; }
.readout { font-variant-numeric: tabular-nums; font-size: 13px; }
.legend { color: var(--muted); font-size: 12px; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.legend i { font-style: normal; }
.nodata { color: var(--muted); padding: 24px; text-align: center; }
/* サージ・タイムライン（出来事の列つき） */
#timeline tbody tr { cursor: pointer; }
/* 右の列（1366px の画面で 703px。狭い画面では縦に積む）に出来事の列まで横スクロールなしで収まるよう、長い見出し・フェーズ・境界値との差・出来事は折り返す */
#timeline th, #timeline td { padding: 4px 5px; vertical-align: top; }
#timeline th.wrap, #timeline td.name:nth-child(7), #timeline td.evs { white-space: normal; }
#timeline td.name:nth-child(7) { min-width: 4em; }
#timeline th.wrap { min-width: 3.5em; }
#timeline th.wrap:nth-child(3) { min-width: 4.2em; }
#timeline td.evs { text-align: left; min-width: 11em; padding: 3px 5px; }
#timeline td.name:nth-child(2) { white-space: normal; min-width: 5em; }
/* 右の列の幅の余り（広い画面・2026-11-17 にマップを 9 割にして空いた分）は、出来事の列だけが受け取る（出来事の文が折り返しにくいように）。
   表は auto のままで、ほかの列には小さな幅を指定する（中身より狭くはならないので、ほかの列は前とほぼ同じ幅のまま）。
   境界値との差だけは前の幅（およそ 6em）を残す */
#timeline th:not(:last-child) { width: 1px; }
#timeline th:nth-child(7) { width: 6em; }
/* 資材（木 / レンガ / 鉄）は1列にまとめ、折り返さない。右の列に収まるよう（2026-11-17 までは 1366px の画面で 638px だった）、字を少し小さく・間を詰め、
   資材のある試合だけ出来事の列の最小幅を 9em にする（資材の無い試合の見た目は変えない） */
#timeline td.mats { font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 11.5px; word-spacing: -0.08em; padding-left: 2px; padding-right: 2px; }
#timeline.has-mats td.evs { min-width: 9em; }
/* 資材の見出し: 英語の「(W/B/M)」は空白が無く列の最小の幅を決めてしまうので、足りない時だけ途中でも折る。
   日本語は語の途中（「レ/ンガ」など）では折らず、「/」や括弧の所だけで折る */
html[lang="en"] #timeline th.mats { overflow-wrap: anywhere; }
html[lang="ja"] #timeline th.mats { word-break: keep-all; }
/* 日本語は文字の間でも折り返せてしまうので、空白（「 / 」など）の所だけで折り返す。長い名前だけは途中で折る */
#timeline td.name:nth-child(2), #timeline .ev { word-break: keep-all; overflow-wrap: break-word; }
#timeline .ev { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 6px; padding: 1px 4px; border-radius: 4px;
                font-size: 12px; line-height: 1.45; }
#timeline .ev + .ev { margin-top: 2px; }
#timeline .ev:hover { background: #2d3a4c; }
#timeline .ev .t { color: var(--muted); font-variant-numeric: tabular-nums; }
#timeline .ev .who { font-weight: bold; }
/* チームの資材: メンバーごとに 1 行（名前は長ければ「…」で切る。名前の全体はマウスを乗せると出る） */
#timeline td.team-mats .mrow { display: flex; gap: 4px; justify-content: flex-end; }
#timeline td.team-mats .mname { display: inline-block; max-width: 5em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#timeline tr.ev-only td { color: var(--muted); }
#timeline tr.alert-in td { background: rgba(255,92,92,0.16); border-top: 2px solid var(--take); border-bottom: 2px solid var(--take); }
#timeline tr.alert-out td { background: rgba(61,220,132,0.12); border-top: 2px solid var(--deal); border-bottom: 2px solid var(--deal); }
#timeline tr.warn td { background: rgba(255,212,71,0.10); border-top: 1px dashed var(--kill); border-bottom: 1px dashed var(--kill); }
#timeline tr.now td { outline: 1px solid var(--accent); }
.tl-key { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 11px; }
.tl-key.alert-in { background: rgba(255,92,92,0.2); border: 1px solid var(--take); }
.tl-key.alert-out { background: rgba(61,220,132,0.15); border: 1px solid var(--deal); }
.tl-key.warn { background: rgba(255,212,71,0.12); border: 1px dashed var(--kill); }
#surge-table tr.surge td { background: rgba(255,170,80,0.10); }
/* テンプレートの style 属性の置き換え */
.table-wrap.tw-full { max-height: none; }
.table-wrap.tw-tl { max-height: min(80vh, 900px); }
.table-wrap.tw-200 { max-height: 200px; }
.legend i.c-deal { color: var(--deal); }
.legend i.c-take { color: var(--take); }
.legend i.c-kill { color: var(--kill); }
.legend i.c-white { color: #fff; }
#tip hr.tip-sep { border: 0; border-top: 1px solid #2c3542; margin: 4px 0; }
/* 読み込み中・エラーの案内 */
.status { margin: 8px 20px; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.status a { color: var(--accent); margin-left: 8px; }
.lang-menu { display: inline-flex; gap: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.lang-menu button { background: var(--panel); color: var(--muted); border: 0; padding: 4px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.lang-menu button + button { border-left: 1px solid var(--line); }
.lang-menu button:hover { color: var(--text); }
.lang-menu button.on { background: var(--accent); color: #07121f; font-weight: bold; cursor: default; }
.status .consent { display: block; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.status .consent a { margin-left: 0; }
/* 見本（/sample）の上の帯。ログインへのボタンが右に付き、狭い幅では折り返す */
.sample-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 8px 20px 0; padding: 10px 14px; background: #1b2a3d; border: 1px solid var(--accent); border-radius: 8px; }
.sample-banner p { flex: 1 1 320px; margin: 0; }
.sample-banner .cta { display: inline-block; background: var(--accent); color: #07121f; font-weight: bold; text-decoration: none; padding: 8px 22px; border-radius: 8px; }
.sample-banner .cta:hover { filter: brightness(1.1); }
/* スマホの幅: 左右の余白 16px。詳細は縦に積む（右の列はマップの下） */
@media (max-width: 700px) {
  .page-head { padding: 12px 16px 4px; }
  .sample-banner { margin: 8px 16px 0; }
  main { padding: 8px 16px 32px; }
  .status { margin: 8px 16px; }
  section { padding: 10px; }
  .player-panel { flex-direction: column; align-items: stretch; }
  .player-pick, .player-pick.has-mode { flex: none; }
  .phase-row { flex-direction: column; gap: 4px; }
  /* 地図の左上の表示の切り替えは、地図を隠しすぎないよう字を小さくし、右上のボタン（およそ 160px）の手前まで広げる */
  .map-opts { max-width: calc(100% - 176px); padding: 3px 6px; font-size: 11px; }
  .map-opts label { gap: 4px; }
}

/* 共有ボタン（マッチサマリのカードの見出しの右端） */
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-head h2 { min-width: 0; }
.share { position: relative; display: flex; align-items: center; gap: 8px; flex: none; }
.share-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; color: var(--text);
             background: #202835; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.share-btn:hover { background: var(--row-hover); }
.share-btn:focus-visible, .share-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.share-status { font-size: 12px; color: var(--deal); }
.share-menu { position: absolute; z-index: 40; top: calc(100% + 4px); right: 0; width: max-content; min-width: 160px; max-width: calc(100vw - 32px);
              padding: 4px; background: rgba(10,13,18,.96); border: 1px solid var(--line); border-radius: 6px; }
.share-menu[hidden], .share-url[hidden] { display: none; }
.share-item { display: block; width: 100%; padding: 8px 10px; color: var(--text); background: none; border: 0; border-radius: 4px; font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.share-item:hover { background: var(--row-hover); }
.share-url { width: 100%; margin-top: 4px; padding: 6px; color: var(--text); background: #141a22; border: 1px solid var(--line); border-radius: 4px; font: inherit; font-size: 12px; }
