html, body { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* UI改修 3段目: the race picture as a plain tool — white frame, 3〜4px corners, solid lines; the
   broadcast figures white on near-black, the 実況 tag in red. */
.track-replay { background: #fff; border: 1px solid #d3d9df; border-radius: 4px; overflow: hidden; font-family: var(--ui-font); }
.track-replay button { font-size: .73rem; font-weight: 750; cursor: pointer; font-family: var(--ui-font); }
.replay-screen { position: relative; background: #6f956b; }
/* B-6: no race bar above the picture while the race is on, so the picture takes that room. */
.track-view { width: 100%; height: clamp(260px, min(95vw, 100svh - 186px), 580px); display: block; cursor: pointer; }
/* Top right: the ? button only (B-7 beta: no camera / speed buttons), and under it the finish board once the leader nears the line (they never overlap). */
.replay-corner { position: absolute; top: 7px; right: 7px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; pointer-events: none; }
.replay-tools { display: flex; align-items: flex-start; gap: 4px; }
/* B-6: the ? in a dark frame, 34px square. */
.replay-corner .replay-help { flex: none; width: 34px; height: 34px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 3px; background: #18201cd9; color: #fff; font-size: .8rem; font-weight: 900; line-height: 1; pointer-events: auto; }
/* A tap on the picture pauses the race; a mark shows while it is paused. */
.replay-screen[data-paused="true"]::after { content: "一時停止中（タップで再開）"; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); white-space: nowrap; padding: 4px 10px; border-radius: 3px; background: #18201ce6; color: #fff; font-size: .72rem; font-weight: 750; pointer-events: none; }
.replay-loading { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; gap: 8px; padding: 12px; background: #18201ce6; color: #fff; font-size: .85rem; font-weight: 750; }
.track-replay [hidden] { display: none; }
.replay-loading button { min-height: 40px; padding: 5px 12px; border-radius: 3px; color: #111613; border: 1px solid #fff; background: #fff; }
/* 位置取り strip under the picture. */
/* B-6b: a panel of its own: a hard dark edge on top and a darker ground than the picture's (the canvas veils it), room for the race's name
   and the surface under the course plan. */
.position-view { display: block; width: 100%; height: 78px; box-sizing: content-box; background: #44604a; border-top: 2px solid #18201c; }
/* The broadcast figures in three cells, then the commentary on a line of its own. */
.replay-info { background: #18201c; color: #fff; }
.replay-stats { display: grid; grid-template-columns: 1fr 1.1fr 1.2fr; border-bottom: 1px solid #ffffff26; }
.replay-stats div { display: grid; gap: 1px; padding: 5px 9px 6px; min-width: 0; }
.replay-stats div + div { border-left: 1px solid #ffffff26; }
.replay-stats small { color: #b4bdb8; font-size: .58rem; font-weight: 700; }
.replay-stats b { overflow: hidden; color: #fff; font-size: .92rem; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; text-overflow: ellipsis; }
.replay-stats div:last-child b { font-size: .78rem; line-height: 1.35; }
.replay-call { display: flex; align-items: center; gap: 8px; min-height: 56px; margin: 0; padding: 7px 10px; background: #141c18; color: #cfd9d2; font-size: .82rem; font-weight: 500; line-height: 1.7; }
.replay-call::before { content: "実況"; flex: none; padding: 2px 6px; border-radius: 2px; background: #d61f26; color: #fff; font-size: .62rem; font-weight: 800; line-height: 1.3; }
.replay-call-body { flex: 1; min-width: 0; color: #cfd9d2; font-weight: 500; }
.call-gate { display: inline-grid; place-items: center; min-width: 16px; height: 16px; padding: 0 2px; border-radius: 3px; font-family: var(--num-font); font-size: .66rem; font-weight: 900; line-height: 1; vertical-align: middle; position: relative; top: -1.5px; margin: 0 6px 0 2px; font-variant-numeric: tabular-nums; }
.call-horse { color: #fff; font-weight: 800; }
/* The running-order strip is gone (the discs beside the course plan show the order); the rule stays as the hidden stub. */
.replay-track { display: none; flex-wrap: nowrap; }
/* The bets on this race, with what the running order would pay now; 的中圏 and 的中 go to the top. */
.replay-tickets { margin: 8px 7px; border: 1px solid #d3d9df; border-radius: 3px; background: #fff; overflow: hidden; }
.replay-tickets .ticket-sum { margin: 0; padding: 5px 8px; border-bottom: 1px solid #d3d9df; background: #f4f6f8; color: #55605a; font-size: .66rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.replay-tickets .ticket-sum:empty { display: none; }
.replay-tickets ul { display: grid; margin: 0; padding: 0; list-style: none; max-height: 260px; overflow-y: auto; }
.replay-tickets li { display: grid; grid-template-columns: 52px 84px minmax(0, 1fr) 58px; align-items: center; gap: 4px 6px; min-height: 32px; padding: 3px 8px; background: #fff; font-size: .72rem; }
.replay-tickets li + li { border-top: 1px solid #e3e7eb; }
.ticket-type { color: #111613; font-weight: 800; white-space: nowrap; }
.ticket-combo { display: flex; align-items: center; gap: 0; }
.ticket-combo b { flex: none; box-sizing: border-box; display: inline-grid; place-items: center; width: 21px; min-width: 21px; height: 21px; border-radius: 3px; border: 1px solid #0003; font-size: .7rem; font-variant-numeric: tabular-nums; }
/* B-5a: ▶ and - are cells of a fixed 10px, so the gate numbers stand in the same columns row after row. */
.ticket-combo i { flex: none; display: inline-grid; place-items: center; width: 10px; color: #8a949c; font-style: normal; font-size: .64rem; font-weight: 900; }
.ticket-combo svg { flex: none; width: 10px; height: 8px; color: #78847e; }
.ticket-stake { justify-self: start; color: #55605a; font-size: .68rem; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.replay-tickets em { justify-self: end; padding: 2px 6px; border-radius: 2px; color: #55605a; font-size: .68rem; font-style: normal; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.replay-tickets li[data-result="live"] { background: #e5f3eb; }
.replay-tickets li[data-result="live"] em { background: #0a6335; color: #fff; }
.replay-tickets li[data-result="hit"] { background: #fdecec; }
.replay-tickets li[data-result="hit"] em { background: #d61f26; color: #fff; }
.replay-tickets li[data-result="miss"] { opacity: .55; }
.replay-tickets li[data-ticket="owner"] .ticket-type { color: #532c8c; }
.replay-tickets li[data-ticket="side"] .ticket-type { color: #b45a06; }
.replay-results { margin: 8px 7px 8px; width: calc(100% - 14px); }

/* ゴール着順掲示板: yellow figures on black, as the course's electric boards show them; the red 確定 lamp at the top left. */
.finish-display { display: flex; gap: 3px; padding: 4px; border: 1px solid #ffffff40; border-radius: 3px; background: #000; color: #ffd24c; pointer-events: none; }
/* B-3a: the 確定 lamp has its place from the start, dark until every runner is home, then red: the board keeps its width. */
.finish-display::before { content: "確定"; align-self: flex-start; padding: 1px 3px; border: 1px solid #333; border-radius: 2px; background: #1c1c1c; color: #4a4a4a; font: 800 9px/1.2 var(--ui-font); letter-spacing: .04em; white-space: nowrap; }
.finish-display[data-confirmed="true"]::before { border-color: #d61f26; background: #d61f26; color: #fff; }
.finish-display[hidden] { display: none; }
/* B-3a: every cell the same width, so a long 着差 does not widen the board as the runners come home. B-5a: 31px (it was 26px) with a
   smaller 着差, and the fractions as one character (2½ 1½ 3½), so アタマ and 2½ side by side keep clear of each other. */
.finish-display span { display: grid; grid-template-columns: minmax(0, 1fr); width: 31px; min-width: 31px; padding: 2px 2px; border-radius: 2px; background: #000; text-align: center; }
.finish-display small { color: #c9a23a; font-size: 9px; font-weight: 700; }
.finish-display b { padding: 0; color: #ffd24c; font: 800 16px/1.15 var(--ui-font); font-variant-numeric: tabular-nums; }
.finish-display i { min-height: 10px; color: #ffd24c; opacity: .9; font: 700 8.5px/1.2 var(--ui-font); font-style: normal; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* 着差 sits on the boundary between a place and the one before it (2着 under the gap to 1着): B-2, centred on the middle of
   the 3px gap between the two cells (the cell's 3px padding and half the gap to the left of its content). */
.finish-display span i { justify-self: start; transform: translateX(calc(-50% - 3.5px)); }
