/* 日別ページの C「六角形の地図」（クラスは dm- で始める。site.css の予算の外）。色は site.css の :root の変数を使い、足りない色は
   この節の中だけで決める。style 属性は使わない（CSP）。止める・順に見る・閉じるは JS が動いたときだけ見せる（hidden） */
.dm { --panel-lo: #0e1b36; --soft: #1a2f52; --pace: #8FD3FF; --pace-rgb: 143, 211, 255; --ease: cubic-bezier(.2, .8, .2, 1);
  font-variant-numeric: tabular-nums; margin: 0 0 26px; }
.dm .p-high, .dm .pc-high { --pace: #ff8a8a; --pace-rgb: 255, 138, 138; --bp: .9s; }
.dm .p-mid, .dm .pc-mid { --pace: #8FD3FF; --pace-rgb: 143, 211, 255; --bp: 1.6s; }
.dm .p-slow, .dm .pc-slow { --pace: #4fd88a; --pace-rgb: 79, 216, 138; --bp: 2.6s; }
.dm .a-high { --act: #ff8a8a; } .dm .a-mid { --act: #8FD3FF; } .dm .a-slow { --act: #4fd88a; }
.dm p, .dm ul, .dm ol { margin: 0; padding: 0; list-style: none; }
.dm h2 { margin: 24px 0 6px; }
.dm h3 { margin: 0; }
.dm button { font: inherit; margin: 0; color: inherit; }
.dm a { text-decoration: none; }
.dm-lead { color: var(--muted); font-size: 14px; line-height: 1.75; margin: 0 0 8px !important; }
.dm-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; color: var(--muted); font-size: 12px; line-height: 1.6; margin: 0 0 12px !important; }
.dm-keys { display: inline-flex; gap: 6px; }
.dm-pk { padding: 1px 10px; border: 1px solid currentColor; border-radius: 999px; font-size: 11px; font-weight: 700; color: var(--pace); }

/* --- 舞台: 左に地図・右に札（せまい画面は縦） --- */
.dm-stage { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
@media (min-width: 860px) { .dm-stage { grid-template-columns: minmax(0, 1.62fr) minmax(0, 1fr); } }
.dm-left { min-width: 0; }
.dm-ctl { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; }
.dm-ctl > button { min-height: 44px; padding: 0 14px; margin-bottom: 8px; border: 1px solid var(--grid); border-radius: 999px; background: var(--navy); cursor: pointer; font-size: 12px; font-weight: 700; color: var(--ice); }
.dm-ctl > button:hover { background: var(--panel); border-color: var(--ice); }
.dm-hole { box-shadow: 0 0 16px rgba(143, 211, 255, .22); }
.dm-pause { margin-left: auto; color: var(--muted) !important; }

/* --- 地図: 場ごとの塊（SVG）と、真ん中の六角形 --- */
.dm-map { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; isolation: isolate; }
.dm-fx { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; }
.dm-fx0 { z-index: 0; }
.dm-fx1 { z-index: 3; }
.dm-cl { position: relative; z-index: 1; display: block; width: 66%; max-width: 390px; height: auto; overflow: visible; justify-self: start; }
.dm-cl:nth-of-type(even) { justify-self: end; }
.dm-n1 .dm-cl { justify-self: center; }
.dm-hub { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 148px; padding: 14px 9%; text-align: center; color: var(--text); background: var(--grid);
  clip-path: polygon(5% 0, 95% 0, 100% 50%, 95% 100%, 5% 100%, 0 50%); }
.dm-hub::before { content: ""; position: absolute; left: 2px; right: 2px; top: 2px; bottom: 2px; z-index: -1; background: linear-gradient(180deg, #1c3566, #0f2040);
  clip-path: polygon(5% 0, 95% 0, 100% 50%, 95% 100%, 5% 100%, 0 50%); transition: background .3s; }
.dm-hub:hover::before { background: linear-gradient(180deg, #25447f, #13294f); }
.dm-hub:focus-visible { outline: 3px solid var(--ice); outline-offset: 2px; }
.dm-hub-date { font-size: 26px; line-height: 1.1; font-weight: 800; letter-spacing: .02em; }
.dm-hub-date small { margin-left: 4px; font-size: 12px; color: var(--muted); font-weight: 700; }
.dm-hub-lines { display: grid; grid-template-columns: repeat(2, minmax(0, auto)); gap: 4px 18px; justify-content: center; text-align: left; }
.dm-hub-lines li { padding-left: 8px; border-left: 2px solid rgba(143, 211, 255, .35); font-size: 12px; line-height: 1.4; color: #dbe6f5; }
.dm-hub-basis { max-width: 92%; font-size: 11px; line-height: 1.45; color: var(--muted); }
@media (max-width: 859px) {
  .dm-cl, .dm-cl:nth-of-type(even) { width: min(100%, 300px); justify-self: center; }
}

/* --- 六角形 --- */
.dm-hex { cursor: pointer; outline: none; }
.dm-glow { fill: var(--pace); opacity: .22; animation: dm-breath var(--bp, 1.6s) ease-in-out infinite alternate; pointer-events: none; }
@keyframes dm-breath { from { opacity: .08; } to { opacity: .5; } }
.dm-shape { fill: var(--pace); }
.dm-ring { fill: var(--act, var(--pace)); }
.dm-fill { fill: #14264a; transition: fill .25s; }
.dm-hex:hover .dm-fill { fill: #1d386c; }
.dm-hex.is-sel .dm-fill { fill: #26498a; }
.dm-hex:focus-visible .dm-shape, .dm-hex.is-sel .dm-shape { stroke: #eef2f8; stroke-width: 2.5; stroke-linejoin: round; }
.dm-hex { transition: opacity .3s; }
.dm-map.has-sel .dm-hex:not(.is-sel) { opacity: .78; }
.dm-map.has-sel .dm-hex:not(.is-sel):hover, .dm-map.has-sel .dm-hex:not(.is-sel):focus-visible { opacity: 1; }
.dm-rn, .dm-tt, .dm-pc, .dm-res { text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.dm-rn { fill: var(--text); font-size: 13px; font-weight: 800; }
.dm-tt { fill: #c9d6e8; font-size: 6.4px; }
.dm-pc { fill: var(--pace); font-size: 8px; font-weight: 800; }
.dm-res { fill: var(--hit); font-size: 6px; font-weight: 800; }
.dm-hex.is-miss .dm-res { fill: #e6a3a3; }
.dm-cl-name { fill: var(--ice); font-size: 13px; font-weight: 800; letter-spacing: .3em; }
@media (max-width: 719px) {
  .dm-tt { display: none; }
  .dm-pc { font-size: 9px; }
  .dm-rn { font-size: 14px; }
  .dm-res { font-size: 6.6px; }
}
.dm.is-paused .dm-glow { animation-play-state: paused; }

/* --- 開いた札 --- */
.dm-panel { position: relative; isolation: isolate; min-width: 0; }
.dm-p-bg { position: absolute; left: 0; top: 0; right: 0; bottom: 0; z-index: -1; border-radius: 16px; border: 1px solid var(--grid); background: linear-gradient(180deg, #15294d, #0e1d3a); box-shadow: 0 18px 50px rgba(0, 0, 0, .35); transform-origin: 0 0; }
.dm-p-body { position: relative; display: grid; gap: 12px; padding: 16px; min-width: 0; }
.dm-close { display: none; }
@media (min-width: 860px) {
  .dm-panel { position: sticky; top: 12px; max-height: calc(100vh - 24px); display: flex; flex-direction: column; }
  .dm-p-body { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--grid) transparent; }
}
.dm-p-kick { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 12px; color: var(--muted); }
.dm-p-kick b { color: var(--ice); font-size: 13px; }
.dm-p-title { font-size: 20px; line-height: 1.3; color: var(--text) !important; }
.dm-lab { font-size: 12px; color: var(--muted); margin-bottom: 6px !important; }
.dm-pband { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.dm-pseg { display: flex; flex-direction: column; padding: 5px 9px; border: 1px solid var(--line); border-radius: 10px; color: var(--pace); background: var(--panel-lo); }
.dm-pseg span { font-size: 11px; line-height: 1.4; }
.dm-pseg b { font-size: 16px; line-height: 1.3; }
.dm-pseg.is-top { background: rgba(var(--pace-rgb), .15); border-color: rgba(var(--pace-rgb), .6); }
.dm-p-act { display: inline-flex; width: fit-content; max-width: 100%; padding: 2px 12px; border: 1px solid currentColor; border-radius: 999px; font-size: 13px; font-weight: 800; color: var(--pace); background: rgba(var(--pace-rgb), .1); }
.dm-marks li { display: grid; grid-template-columns: 22px 28px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid #1d3257; }
.dm-marks li:first-child { border-top: 0; }
.dm-mk { text-align: center; font-size: 17px; line-height: 1; color: var(--ice); }
.dm-un { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 3px; border: 1px solid var(--grid); border-radius: 6px; background: var(--panel-lo); font-size: 12px; font-weight: 800; line-height: 1; }
.dm-nm { min-width: 0; overflow-wrap: anywhere; font-size: 13.5px; font-weight: 800; }
.dm-fin { font-size: 12px; color: var(--muted); white-space: nowrap; }
.dm-btns { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.dm-btn { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 6px 12px; border: 1px solid var(--grid); border-radius: 12px; background: var(--panel); color: var(--text); font-size: 13px; font-weight: 800; line-height: 1.3; text-align: center; }
.dm-btn:hover { background: #1a3160; border-color: var(--ice); color: var(--text); }
.dm-btn.pri { background: var(--ice); border-color: var(--ice); color: #0B1A33; }
.dm-btn.pri:hover { background: #b3e2ff; color: #0B1A33; }

/* --- 小さな展開の絵（JS が動いたときだけ） --- */
.dm-mini { display: none; }
.dm.is-live .dm-mini { display: block; }
.dm-mtabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.dm-mt { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 48px; padding: 4px 2px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-lo); color: var(--muted); cursor: pointer; line-height: 1.25; transition: background .2s, border-color .2s; }
.dm-mt b { font-size: 13px; }
.dm-mt small { font-size: 10px; font-weight: 700; }
.dm-mt.cur { border-color: var(--pace); color: var(--pace); background: #142a52; }
.dm-mt[aria-pressed="true"] { box-shadow: 0 0 0 2px rgba(var(--pace-rgb), .35); }
.dm-mt:hover { border-color: var(--pace); }
.dm-mini-stage { margin-top: 8px; height: 190px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #07122a; }
.dm-mini-cv { display: block; width: 100%; height: 100%; }
.dm-mini-cap { margin-top: 6px !important; font-size: 11px; line-height: 1.5; color: var(--muted); }
.dm-mini-res { margin-top: 4px !important; font-size: 12.5px; line-height: 1.7; min-height: 5.2em; }
.dm-still { margin: 10px 0 0; }
.dm-still figcaption { margin-bottom: 4px; font-size: 13px; font-weight: 800; color: var(--pace); }
.dm-still .dm-mini-stage { height: 164px; margin-top: 0; }
.dm-still .dm-mini-res { min-height: 0; }

/* --- 展開の穴をたどる --- */
.dm-tour { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; padding: 8px 10px; border: 1px solid var(--ice); border-radius: 12px; background: rgba(143, 211, 255, .09); line-height: 1.4; }
.dm-tl { display: block; flex: 1 1 150px; }
.dm-tl b { display: block; color: var(--ice); font-size: 13px; }
.dm-tl small { display: block; font-size: 11px; color: var(--muted); }
.dm-tb { display: flex; gap: 6px; }
.dm-tb button { min-height: 44px; min-width: 56px; padding: 0 12px; border: 1px solid var(--grid); border-radius: 10px; background: var(--panel); font-size: 12px; font-weight: 800; cursor: pointer; }
.dm-tb button:hover { border-color: var(--ice); background: #1a3160; }

/* --- せまい画面: 下からせり上がる札 --- */
.dm-scrim { position: fixed; left: 0; top: 0; right: 0; bottom: 0; z-index: 40; background: rgba(5, 12, 26, .66); opacity: 0; pointer-events: none; transition: opacity .35s; }
.dm-scrim.on { opacity: 1; pointer-events: auto; }
.dm-lock { overflow: hidden; }
@media (max-width: 859px) {
  .dm.is-live .dm-panel { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: flex; flex-direction: column; width: 100%; max-width: 680px; margin: 0 auto; height: min(75vh, 720px); height: min(75dvh, 720px);
    transform: translateY(105%); visibility: hidden; transition: transform .45s var(--ease), visibility 0s .45s; }
  .dm.is-live .dm-panel.is-open { transform: none; visibility: visible; transition: transform .45s var(--ease); }
  .dm.is-live .dm-p-bg { border-radius: 20px 20px 0 0; }
  .dm.is-live .dm-p-body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 60px 16px calc(24px + env(safe-area-inset-bottom)); align-content: start; }
  .dm.is-live .dm-panel::before { content: ""; position: absolute; left: 50%; top: 8px; width: 44px; height: 4px; margin-left: -22px; border-radius: 2px; background: var(--grid); z-index: 2; }
  .dm.is-live .dm-close { display: inline-flex; align-items: center; justify-content: center; position: absolute; right: 10px; top: 14px; z-index: 3; min-width: 64px; min-height: 44px; padding: 0 12px; border: 1px solid var(--grid); border-radius: 12px; background: var(--panel); font-size: 13px; font-weight: 800; cursor: pointer; }
  .dm.is-live .dm-close:hover { border-color: var(--ice); }
  .dm.is-live .dm-p-title { font-size: 19px; }
  /* ボタンは札の下に張り付く（札の中をめくっても「このレースの展開を見る」がいつも見える）。3 つ（または 2 つ）を 1 行に並べる */
  .dm.is-live .dm-btns { position: sticky; bottom: calc(-24px - env(safe-area-inset-bottom)); z-index: 2; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); grid-template-columns: none; gap: 6px; margin: 0 -16px calc(-24px - env(safe-area-inset-bottom)); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #0e1d3a; }
  .dm.is-live .dm-btn { padding: 4px 6px; font-size: 12px; }
}

/* --- 動きを減らす設定: 息・光・移りなし（止まった色と文字で読める） --- */
@media (prefers-reduced-motion: reduce) {
  .dm *, .dm *::before, .dm-scrim { animation: none !important; transition: none !important; }
  .dm-glow { opacity: .28; }
}
