/* ===== 2. 解析状況と試合の選択 ===== */
.video-review { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.video-hub { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.hub-status { padding: 9px 16px; background: var(--md-surface-high); border-bottom: 1px solid var(--md-outline-variant);
  display: flex; flex-direction: column; gap: 7px; min-height: 48px; justify-content: center; }
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.status-main { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; min-width: 0; flex: 1; }
.status-texts { min-width: 0; flex: 1; }
.status-texts p { margin: 0; font-size: 13px; font-weight: 600; color: var(--md-on-surface); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-texts p:empty { display: none; }
.status-texts #video-message { color: var(--md-warning); font-weight: 500; white-space: normal; }
.review-progress { border: 0; padding: 0; }
.status-texts:has(#video-progress:not([hidden])) #video-opening,
.status-texts:has(#video-progress:not([hidden])) #hub-idle,
.status-texts:has(#video-opening:not(:empty)) #hub-idle,
#hub-idle:empty { display: none; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--md-success); flex-shrink: 0; }
.status-dot.idle { background: var(--md-outline); }
.hub-status:has(#video-progress:not([hidden])) .status-dot,
.hub-status:has(#video-opening:not(:empty)) .status-dot { background: var(--md-primary); box-shadow: 0 0 0 3px var(--md-primary-container); }
.hub-tools { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.status-meta { font-size: 12px; color: var(--md-on-surface-variant); font-family: var(--font-mono); }
#video-setup.awaiting-video, #video-side.awaiting-video { visibility: hidden; }
.progress-track { width: 100%; height: 4px; border-radius: 4px; background: var(--md-outline-variant); overflow: hidden; }
.progress-fill { height: 100%; width: 35%; background: var(--md-primary); border-radius: 4px; animation: md-indeterminate 1.4s infinite cubic-bezier(.4,0,.2,1); }
.progress-track[aria-valuenow] .progress-fill { animation: none; transition: width 150ms linear; }
@keyframes md-indeterminate { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
.hub-saved-note, .hub-range-panel { padding: 8px 16px; background: var(--md-surface-low); border-bottom: 1px solid var(--md-outline-variant);
  font-size: 12px; color: var(--md-on-surface-variant); }
.hub-range-panel:not([open]) { display: none; }
.hub-range-panel .video-options { gap: 10px; }
.hub-matches { padding: 5px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 50px; }
.match-scroller-wrap { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; }
.match-strip { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; min-height: 34px; overflow-x: auto; scroll-behavior: smooth;
  scrollbar-width: none; padding: 2px 4px;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 12px, #000 calc(100% - 20px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 12px, #000 calc(100% - 20px), transparent 100%); }
.match-strip::-webkit-scrollbar { display: none; }
.match-strip:empty { border: 1px dashed var(--md-outline-variant); border-radius: var(--md-shape-sm); -webkit-mask-image: none; mask-image: none; }
/* 試合の札は状態の色を保ち、選択は枠の太さと文字の太さで示す */
#video-match-options button { flex: 0 0 auto; height: 34px; padding: 0 13px; gap: 6px; border-radius: var(--md-shape-sm);
  border: 1px solid var(--md-outline); background: var(--md-surface-high); color: var(--md-on-surface); font-size: 13px; font-weight: 600;
  box-shadow: 0 1px 2px #0004; transition: background var(--md-motion-fast), border-color var(--md-motion-fast), transform var(--md-motion-fast); }
#video-match-options button:hover:enabled { transform: translateY(-1px); }
#video-match-options button > span { display: none; }
#video-match-options button > strong { font-weight: 700; }
#video-match-options button > small { font-size: 11px; }
#video-match-options button[data-state="todo"],
#video-match-options button[data-state="running"] { padding-right: 5px; }
#video-match-options button[data-state="todo"] > small,
#video-match-options button[data-state="running"] > small {
  display: inline-flex; align-items: center; gap: 3px; height: 24px; padding: 0 9px; border-radius: var(--md-shape-full);
  font-size: 12px; font-weight: 700; }
#video-match-options button[data-state="todo"] > small { background: var(--md-primary); color: var(--md-on-primary); }
#video-match-options button[data-state="todo"] > small::before { content: '▶'; font-size: 9px; }
#video-match-options button[data-state="todo"]:hover:enabled { background: var(--md-surface-highest); border-color: var(--md-primary); }
#video-match-options button[data-state="running"] {
  background: color-mix(in srgb, var(--md-warning) 13%, var(--md-surface-high)); border-color: var(--md-warning); }
#video-match-options button[data-state="running"] > small { background: var(--md-warning); color: var(--md-on-warning);
  animation: chip-pulse 1.2s ease-in-out infinite; }
#video-match-options button[data-state="running"] > small::after { content: '…'; }
@keyframes chip-pulse { 50% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--md-warning) 32%, transparent); } }
#video-match-options button[data-state="done"] {
  background: color-mix(in srgb, var(--md-success) 13%, var(--md-surface-high)); border-color: var(--md-success); }
#video-match-options button[data-state="done"]::before { content: '✓'; color: var(--md-success); font-size: 11px; }
#video-match-options button[aria-pressed="true"] { border-width: 2px; font-weight: 750; }
#video-match-options button[aria-pressed="true"] > strong { font-weight: 850; }
.scroll-arrow { width: 28px; height: 28px; min-height: 0; padding: 0; border: 0; border-radius: var(--md-shape-full); background: var(--md-surface-high);
  color: var(--md-on-surface-variant); display: grid; place-items: center; flex-shrink: 0; font-size: 14px; font-weight: 700; }

/* ===== 動画で確かめる ===== */
.video-grid { --board-w: clamp(120px, calc((100dvh - 384px) / 2), 236px);
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: start; }
.boards-pair { display: flex; align-items: flex-start; gap: 8px; background: var(--md-surface-low); padding: 10px 12px; border-radius: var(--md-shape-lg); }
.board-col { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 0; }
.board-head-row { width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 24px; }
.current-piece-slot { --review-cell: 6px; display: flex; align-items: center; justify-content: center; gap: 5px; height: 26px; width: 100%; }
.boards-pair canvas, .boards-pair .review-board-wrap { width: var(--board-w); }
.boards-pair canvas { height: auto; aspect-ratio: 1 / 2; }
#review-board { aspect-ratio: auto; }
#review-video { width: var(--board-w); max-width: none; }
.review-board-wrap { position: relative; }
.review-board.in-gap { opacity: .28; }
.review-gap { position: absolute; inset: 0; display: grid; place-items: center; padding: 7px; color: var(--md-on-surface); font-size: 13px; font-weight: 700; text-align: center; }
.side-pieces { padding-top: 54px; width: 44px; display: flex; justify-content: center; }
.video-controls-pane { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.track-box { background: var(--md-surface-low); border-radius: var(--md-shape-md); padding: 9px 12px; display: flex; flex-direction: column; gap: 6px; }
.track-head { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--md-on-surface-variant); }
.track-head output { font-family: var(--font-mono); font-weight: 700; color: var(--md-on-surface); }
.review-track input[type="range"] { display: block; width: 100%; margin: 0; accent-color: var(--md-primary); cursor: pointer; }
.review-marks { position: relative; margin-inline: 10px; height: 14px; }
.review-marks button { position: absolute; z-index: 1; transform: translateX(-50%); height: 18px; width: 18px; min-height: 0; border: 0; padding: 0; background: transparent; border-radius: 0; }
.review-marks button::after, .review-legend span::before { content: ''; display: block; margin: auto; width: 7px; height: 7px; border-radius: 50%; background: var(--mark); }
.review-legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 11px; color: var(--md-on-surface-variant); }
.review-legend span::before { display: inline-block; margin: 0 4px 0 0; vertical-align: 1px; }
[data-kind="spin"] { --mark: #a855f7; } [data-kind="tetris"] { --mark: #06b6d4; } [data-kind="choice"] { --mark: var(--md-warning); }
[data-kind="gap"] { --mark: var(--md-danger); } [data-kind="rise"] { --mark: #788496; }
[data-kind="gap"]::before, [data-kind="gap"]::after { width: 3px !important; height: 10px !important; border-radius: 2px !important; }
[data-kind="rise"]::before, [data-kind="rise"]::after { width: 4px !important; height: 9px !important; border-radius: 2px !important; }
.step-tick { position: absolute; bottom: 0; width: 1px; height: 4px; background: var(--md-outline-variant); }
.zoom-bracket { position: absolute; height: 9px; top: 5px; border: 1px solid var(--md-primary); background: color-mix(in srgb, var(--md-primary) 18%, transparent); border-radius: 2px; }
.review-compare-note { text-align: center; }
.rev-actions-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.rev-actions-row .md-btn { width: 100%; min-width: 0; }
.review-move-list { min-width: 0; }
.move-list-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.move-list-head h3 { font-size: 13px; font-weight: 700; }
#review-list-count { margin-inline-start: 6px; font-weight: 400; }
.hand-legend > summary { font-size: 11px; font-weight: 600; color: var(--md-primary); }
.hand-legend[open] { flex-basis: 100%; }
.move-list-head:has(.hand-legend[open]) { flex-wrap: wrap; }
#video-rows { list-style: none; display: flex; gap: 6px; margin: 6px 0 0; padding: 3px 2px 7px; overflow-x: auto; overflow-y: hidden; min-height: 76px;
  overscroll-behavior-inline: contain; }
#video-rows:empty { border: 1px dashed var(--md-outline-variant); border-radius: var(--md-shape-sm); }
#video-rows li { flex: none; }
#video-rows button { position: relative; display: grid; justify-items: center; align-content: center; gap: 2px; width: 46px; height: 66px; min-height: 0;
  padding: 2px 0; border: 1px solid var(--md-outline-variant); border-radius: var(--md-shape-sm); background: var(--md-surface-low);
  color: var(--md-on-surface-variant); font: 11px/1.1 var(--font-sans); user-select: none; }
#video-rows button[aria-current] { border: 2px solid var(--md-primary); background: var(--md-primary-container); color: var(--md-on-primary-container); }
#video-rows button.hand-gap { width: 10px; border: 0; background: transparent; }
.hand-gap::before { content: ''; width: 3px; height: 54px; border-radius: 2px; background: var(--md-danger); }
.hand-marks { display: flex; justify-content: space-between; position: absolute; top: 3px; inset-inline: 3px; font-size: 9px; font-weight: 700; color: var(--md-warning); }
.selection-banner { background: var(--md-surface-low); border-radius: var(--md-shape-md); padding: 10px 12px; display: grid; gap: 8px; }
.selection-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#review-move { font-weight: 700; font-size: 14px; }
#review-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
#review-choices:empty { display: none; }
#review-choices button { border-radius: var(--md-shape-sm); text-align: start; padding: 6px 10px; min-height: 40px; white-space: normal; }
#review-choices button[aria-pressed="true"] { background: var(--md-primary-container); color: var(--md-on-primary-container); border-color: var(--md-primary); }
#review-confirm { justify-self: start; }

/* ミノ（HOLD・NEXT・今・札） */
.review-pieces { --review-cell: 6px; display: grid; justify-items: center; gap: 4px; font-size: 10px; font-weight: 700; color: var(--md-on-surface-variant); }
.review-pieces > div { display: grid; gap: 5px; }
.review-piece { width: 38px; height: 24px; display: grid; place-items: center; background: var(--well-bg); border: 1px solid var(--md-outline-variant); border-radius: 5px; }
.review-piece > span { display: grid; }
.review-piece i { display: block; width: calc(var(--review-cell) - 1px); height: calc(var(--review-cell) - 1px); background: var(--piece); border-radius: 1px; }
.review-current { display: flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 700; color: var(--md-on-surface-variant); }
.review-token { display: inline-block; min-width: 22px; padding: 1px 4px; text-align: center; font-weight: 800; font-size: 11px; border-radius: 5px;
  color: #0b0e14; background: var(--piece); border: 1px solid transparent; }
.review-token.unseen { background: color-mix(in srgb, var(--piece) 30%, var(--md-surface-container)); border: 1px dashed var(--md-outline); color: var(--md-on-surface-variant); }
.review-token.current-mino { outline: 2px solid var(--md-primary); outline-offset: 1px; margin-inline-end: 4px; }
.review-token.invalid-mino { border: 1px dashed var(--md-danger); color: var(--md-danger); background: transparent; }
.review-token.empty-slot { background: var(--md-surface-high); color: var(--md-on-surface-variant); }

/* ===== 読み取りを直す ===== */
.subtle-correction { border: 1px dashed var(--md-outline-variant); border-radius: var(--md-shape-md); background: transparent; }
.subtle-correction-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 14px; font-size: 13px; color: var(--md-on-surface-variant); }
#correct-details:not([open]) .when-open, #correct-details[open] .when-closed { display: none; }
.subtle-correction-body { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; padding: 4px 14px 14px; align-items: start; }
.corr-source { display: grid; gap: 4px; justify-items: center; }
.corr-source canvas { width: clamp(140px, calc((100dvh - 260px) / 2), 260px); height: auto; aspect-ratio: 1 / 2; }
#correct-editor #board-editor { grid-template-columns: clamp(140px, calc((100dvh - 260px) / 2), 260px) minmax(0, 1fr); }
#video-edit-message:empty { display: none; }
#video-edit-message { padding: 0 14px 10px; }


.review-marks button:focus-visible { z-index: 3; }
#video-debug-indices { width: 9em; max-width: 100%; }
#video-debug-preview video { display: block; max-width: 100%; width: 120px; }
#video-debug-files a { color: var(--md-primary); }
