/* KIPzSwitch ブランド（サービスサイトと同一トンマナ: 紺×青×赤タリー）。
   スイッチャーは現場運用前提のため常時ダーク（紺基調）で固定する。 */
:root {
  --navy: #111a3a;
  --kipz-blue: #3b82f6;
  --tally: #ef4444;
  --bg: #0e1327;       /* 深い紺（LPのヒーローと同系） */
  --surface: #171e38;
  --line: #2a3354;
  --text: #eef1f5;
  --muted: #a9b4d4;
  --note-bg: #14224a;
  --note-text: #cfe0ff;
  --accent: #3b82f6;
  --live: #1f9d55;
  --stale: #b45309;
  --offline: #c11717;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; background: var(--bg); overflow: hidden; }

/* 画面=ビューポート高さに固定し、内部をflexで配分（スクロールなし＝1ページに収める） */
.app {
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg);
  color: var(--text);
  color-scheme: light dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

/* ---- ヘッダ: タイトル行 / 操作行 を縦に分けて窮屈さを回避 ---- */
header {
  flex: 0 0 auto;
  padding: 7px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #131c3d, var(--bg));   /* LPヒーローと同系の紺グラデ */
}
header h1 { margin: 0 0 8px; font-size: 16px; font-weight: 600; color: var(--text); }
/* ブランドロゴ ロックアップ（web-portalと同一。タリー=dotless ı の上 0.84em に赤ドット＋微発光） */
.logo.lockup { display: inline-flex; align-items: center; gap: 8px; }
.logo-mark { display: block; border-radius: 6px; }
.logo-word { font-weight: 800; letter-spacing: -0.02em; font-size: 19px; color: #fff; line-height: 1; }
.logo-word .z { color: var(--kipz-blue); }
.logo-word .ti { position: relative; display: inline-block; }
.logo-word .tally {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 0.84em;
  width: 0.26em; height: 0.26em; border-radius: 50%;
  background: var(--tally); box-shadow: 0 0 6px rgba(239,68,68,.75);
}
.logo-sub { font-size: 12px; font-weight: 700; color: var(--muted); margin-left: 4px; letter-spacing: .06em; }

.obs-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#obs-status { font-size: 13px; color: var(--muted); }
.obs-bar input {
  flex: 1 1 240px; min-width: 200px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 7px 9px; font-size: 14px;
}
.obs-bar input::placeholder { color: var(--muted); opacity: .8; }
.obs-bar button, .scene-btn {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 7px 12px; font-size: 14px; cursor: pointer;
}
.obs-bar button:hover, .scene-btn:hover { border-color: var(--accent); }

/* ---- 注意書き ---- */
.note {
  margin: 0; padding: 12px 16px;
  background: var(--note-bg); color: var(--note-text);
  border-bottom: 1px solid var(--line);
  font-size: 13px; line-height: 1.7;
}
.note p { margin: 0 0 4px; }
.note p:last-child { margin: 0; }
.note b { font-weight: 600; }

/* ---- OBS接続ステータスの状態色 ---- */
#obs-status[data-state="ok"]   { color: #1f9d55; font-weight: 600; }
#obs-status[data-state="warn"] { color: #d11; font-weight: 600; }

/* ---- スイッチャー操作バー（Studio / TAKE / CUT / テロップ） ---- */
.switcher-bar { flex: 0 0 auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 4px 16px; border-bottom: 1px solid var(--line); }
/* FB③: 上部バーのボタンを少しだけ小さく（各画面を広く。使いづらくない範囲でpadding/font微減） */
.switcher-bar .ctl { padding: 6px 12px; font-size: 13px; }
.telop-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 6px; }
.telop-bar input {
  flex: 1 1 200px; min-width: 160px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font-size: 14px;
}
.ctl {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 8px 14px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.ctl:hover:not(:disabled) { border-color: var(--accent); }
.ctl:disabled { opacity: .4; cursor: default; }
.ctl.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.ctl.take { background: #16c060; border-color: #16c060; color: #06351b; }
.ctl.cut  { background: #ff2d2d; border-color: #ff2d2d; color: #fff; }
.ctl.take:disabled, .ctl.cut:disabled { opacity: .4; }
/* ③FB: 日本語ラベル＋略語(TAKE/CUT)を併記して意味を明確に */
.ctl.take small, .ctl.cut small { font-size: 9px; font-weight: 800; opacity: .72; letter-spacing: .08em; margin-left: 2px; }
/* シーク中はバーの追従アニメを止める（ドラッグに即応） */
.mp-prog.mp-seekable.drag > i { transition: none; }
.mp-prog.mp-seekable.drag > i::after { opacity: 1; }
/* ③ 切替モード: ディゾルブ=紫 / カット=橙 で現在のモードを一目で */
.ctl.mode { background: #6a4ea0; border-color: #6a4ea0; color: #fff; }
.ctl.mode.is-cut { background: #c0892a; border-color: #c0892a; color: #2a1e06; }
/* ダイレクト: 1クリックで即本線＝誤操作の影響が大きいモードなので、ひと目で分かる強い色にする */
.ctl.mode.is-direct { background: #d94141; border-color: #d94141; color: #fff; }
/* ⑦ ディゾルブ時間（秒）。ディゾルブモード時のみ表示。 */
.dissolve-time { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.dissolve-time input { width: 52px; padding: 4px 6px; background: rgba(127,127,127,.12); color: inherit; border: 1px solid var(--line); border-radius: 6px; font: inherit; text-align: right; }
.bar-sep { width: 1px; align-self: stretch; min-height: 24px; background: var(--line); margin: 0 4px; }
/* 誤爆防止: 配信ボタン手前の区切りを右寄せの押し出しにして、配信開始/停止を右端に隔離する */
.bar-sep.push { margin-left: auto; }
/* 配信ボタン: 稼働中は赤で点灯。状況テキストは折り返さない。 */
.ctl.stream { margin-left: 22px; }   /* UX-A4: 録画ボタンとの誤タップ防止の明示ギャップ */
.ctl.stream.on { background: #ff2d2d; border-color: #ff2d2d; color: #fff; }
.stream-stat { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
/* 録画ボタン: 録画中は赤で点灯（配信とは独立）。状況テキストは折り返さない。 */
.ctl.rec.on { background: #ff2d2d; border-color: #ff2d2d; color: #fff; }
.ctl.rec.on::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #fff; margin-right: 6px; vertical-align: middle; animation: recBlink 1.1s ease-in-out infinite; }
@keyframes recBlink { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .ctl.rec.on::before { animation: none; } }
.rec-stat { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
/* テロップ/画像チップ: 中身(文字/サムネ)を見せつつタップで本線ON/OFF（即時） */
.chip { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; font-size: 13px; cursor: pointer; max-width: 230px; }
.chip:hover:not(:disabled) { border-color: var(--accent); }
.chip:disabled { opacity: .4; cursor: default; }
.chip.on { border-color: #ff2d2d; box-shadow: 0 0 0 1px #ff2d2d inset; }
.chip-label { font-weight: 600; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
.chip-state { font-size: 11px; font-weight: 700; color: #fff; background: #6b7280; border-radius: 999px; padding: 1px 6px; }
.chip.on .chip-state { background: #ff2d2d; }
.chip-prev { display: inline-flex; align-items: center; min-width: 56px; max-width: 130px; height: 26px; overflow: hidden; background: #1a1d23; border-radius: 4px; padding: 0 6px; }
.chip-prev .telop-txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 118px; line-height: 1.1; }
.chip-prev img { max-height: 24px; max-width: 118px; object-fit: contain; display: none; }
/* 字幕/画像の PVW・本線 バス操作（メインパネル）。PVW=緑 / 本線=赤 で押し間違い防止 */
.srcgrp { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 3px 6px; }
.srcgrp-label { font-size: 12px; font-weight: 700; color: var(--muted); }
.srcgrp-prev { display: inline-flex; align-items: center; justify-content: center; min-width: 60px; max-width: 120px; height: 26px; overflow: hidden; background: #1a1d23; border-radius: 4px; padding: 0 6px; }
.srcgrp-prev .telop-txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 108px; line-height: 1.1; }
.srcgrp-prev img { max-height: 24px; max-width: 108px; object-fit: contain; display: none; }
.busbtn { border-radius: 6px; padding: 5px 10px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; cursor: pointer; border: 2px solid; background: var(--bg); }   /* #32 タッチ最小44px（PVW/本線バスの押し間違い＝オンエア事故防止） */
.busbtn:disabled { opacity: .4; cursor: default; }
.busbtn.pvw { color: #16a34a; border-color: #16c060; }
.busbtn.pvw.on { background: #16c060; border-color: #16c060; color: #06351b; }
.busbtn.pgm { color: #dc2626; border-color: #ff2d2d; }
.busbtn.pgm.on { background: #ff2d2d; border-color: #ff2d2d; color: #fff; }
.telop-color { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); }
.telop-color input[type="color"] { width: 36px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
.telop-sel { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 7px 8px; font-size: 14px; }

/* ---- PVW / PGM モニター ---- */
/* モニター: 残り高さを全部使って可能な限り大きく。映像は contain でレターボックス */
/* モニター領域の高さは --mon-h（境界バーのドラッグで可変, #4）。既定58%。 */
/* モニタ領域の高さ=--mon-h（境界バーのドラッグで可変, #4）。未設定時は52vh。各モニタは
   この高さに合わせた16:9（高さ基準・width:auto）で歪まず、横は最大でも半分(50%)。 */
.monitors { flex: 0 0 auto; height: var(--mon-h, 52vh); display: flex; gap: 10px; padding: 4px 12px 2px; align-items: center; justify-content: center; }
/* ★iPad/Safari(幅700px超): flexアイテムの .mon を「height:100%→aspect-ratioで幅を導出」で置くと、
   Safariは幅を内容(0)から決めてしまい幅0＝モニタが見えない(実機FB 2026-07-23「PVW/PGMの枠が表示されない」)。
   幅を明示(flex-basis=モニタ高さ×16/9)し、高さは幅から導出する(幅→高さ方向のaspect-ratioは全ブラウザ安定)。
   -6px は .monitors の上下padding(4+2px)分。Chromeの見た目は従来と同一。 */
.mon-wrap { flex: 0 1 calc((var(--mon-h, 52vh) - 6px) * 16 / 9); max-width: calc(50% - 5px); height: 100%; min-width: 0; display: flex; align-items: center; justify-content: center; }
.mon { width: 100%; height: auto; max-height: 100%; aspect-ratio: 16 / 9; position: relative; background: #000; border-radius: 8px; overflow: hidden; border: 3px solid var(--line); }
.mon.pvw { border-color: #16c060; }
.mon.pgm { border-color: #ff2d2d; }
.mon video { width: 100%; height: 100%; object-fit: contain; background: #000; }
/* ④ クロスフェード/黒挟み対策の上層: 新映像を重ねJSがopacity/transitionを制御。背景は透過。PVWも同じ層で黒を回避 */
.mon video.pgm-fade, .mon video.pvw-fade { position: absolute; inset: 0; opacity: 0; background: transparent; pointer-events: none; }
/* PGMモニター上の画像オーバーレイ・プレビュー（左上アンカー、JSで位置/サイズ設定） */
.overlay-preview { position: absolute; pointer-events: none; max-width: none; height: auto; z-index: 1; opacity: 0; transition: opacity .4s ease; }
.overlay-preview.show { opacity: 1; }
.mon-label { position: absolute; top: 6px; left: 6px; z-index: 2; font-size: 11px; font-weight: 700; letter-spacing: .03em; padding: 2px 7px; border-radius: 4px; color: #fff; }
.mon.pvw .mon-label { background: #16c060; color: #06351b; }
.mon.pgm .mon-label { background: #ff2d2d; }
/* PGM操作行（映像枠の外＝視認性を下げない）: #2 本線音声 / #3 別ウィンドウ */
.mon-controls { flex: 0 0 auto; display: flex; align-items: center; justify-content: flex-end; gap: 6px; padding: 3px 16px 0; }
.mon-controls-label { font-size: 11px; font-weight: 700; color: var(--muted); margin-right: 2px; }
.mon-btn { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 4px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.mon-btn:hover { border-color: var(--accent); }
.mon-btn.on { background: #ff2d2d; border-color: #ff2d2d; color: #fff; }
/* 配布用モニターが上限人数に達している状態（これ以上は視聴を断っている＝運用者が気づけるように） */
.mon-btn.warn { background: #b45309; border-color: #f59e0b; color: #fff; }
.mon-lipsync { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; color: var(--muted); padding: 2px 8px; border: 1px solid var(--line); border-radius: 4px; white-space: nowrap; }
.mon-lipsync input[type=range] { width: 96px; accent-color: var(--accent); }
.mon-lipsync b { color: var(--text); min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.mon-btn:disabled { opacity: .5; cursor: default; }

/* PGMモニター上のテロップ・プレビュー（OBS合成の見た目を再現） */
/* テロップ: X/Y座標で任意位置（OBSは alignment=5/左上基準）。ON/OFFはopacityでディゾルブ */
.telop-overlay { position: absolute; inset: 0; padding: 0; box-sizing: border-box; pointer-events: none; opacity: 0; transition: opacity .4s ease; }
.telop-overlay.show { opacity: 1; }
.telop-txt { display: inline-block; line-height: 1.15; }
.telop-overlay .telop-txt { position: absolute; white-space: pre; }
/* ★iPad/Safari: 縦積み時は幅基準に切替。親(.monitors)がheight:autoなのに .mon が height:100% だと
   Safariでは高さ0に潰れ「タリー色の枠線だけ」になる（Chromeはaspect-ratioで救済するため気づけない）。 */
@media (max-width: 700px) { .monitors { flex-direction: column; align-items: stretch; height: auto; } .mon-wrap { flex: 1 1 0; max-width: none; height: auto; } .mon { width: 100%; height: auto; } .mon-divider { display: none; } }

/* PVW/PGMモニターと各カメラの大きさ配分を変える境界バー（#4） */
/* バーを上下ドラッグでモニタ(--mon-h)と各カメラの大きさ配分を変える。 */
.mon-divider { display: flex; flex: 0 0 auto; height: 14px; align-items: center; justify-content: center; cursor: ns-resize; touch-action: none; }
.mon-divider .grip { width: 56px; height: 4px; border-radius: 3px; background: var(--line); transition: background .1s, width .1s; }
.mon-divider:hover .grip, body.resizing-mon .mon-divider .grip { background: var(--accent); width: 80px; }
body.resizing-mon { cursor: ns-resize; user-select: none; -webkit-user-select: none; }
body.resizing-mon video, body.resizing-mon iframe { pointer-events: none; }

/* ---- テロップ詳細設定（アコーディオン） ---- */
.telop-details { padding: 2px 16px 8px; border-bottom: 1px solid var(--line); }
.telop-details > summary { cursor: pointer; font-size: 13px; color: var(--muted); padding: 4px 0; user-select: none; }
.telop-grid { display: flex; flex-wrap: wrap; gap: 8px 14px; padding-top: 8px; align-items: center; }
.telop-grid label { font-size: 13px; color: var(--text); display: inline-flex; align-items: center; gap: 5px; }
.telop-grid input[type="text"] { width: 110px; }
.telop-grid input[type="number"] { width: 60px; }
/* ビットレート系は5桁(例:12000)+スピナー分の幅が要る。60pxだと「12000」が見切れて「1.2M」に誤読される(FB 2026-07-22①) */
#st-vbitrate, #st-abitrate, #st-recbitrate { width: 86px; }
.telop-grid input[type="text"], .telop-grid input[type="number"], .telop-grid select {
  background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px; font-size: 13px;
}
.telop-grid input[type="color"] { width: 32px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
/* 配信設定: URL/キーは1行いっぱい使う */
.telop-grid label.wide { flex: 1 1 100%; }
.telop-grid label.wide input[type="text"], .telop-grid label.wide input[type="password"] { flex: 1 1 auto; width: auto; min-width: 0; }

/* ---- 画像オーバーレイ ---- */
.img-details { padding: 2px 16px 8px; border-bottom: 1px solid var(--line); }
.img-details > summary { cursor: pointer; font-size: 13px; color: var(--muted); padding: 4px 0; user-select: none; }
.img-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 0; }
.img-upload { cursor: pointer; }
.img-hint { font-size: 12px; color: var(--muted); }
.img-list { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.img-cell { position: relative; width: 96px; height: 54px; border: 2px solid var(--line); border-radius: 6px; overflow: hidden; background: #000; cursor: pointer; }
.img-cell.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.img-cell img { width: 100%; height: 100%; object-fit: contain; display: block; }
.img-del { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; line-height: 16px; padding: 0; border: none; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; font-size: 13px; cursor: pointer; }

/* ---- コントロール ドロワー（テロップ・画像をまとめる） ---- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 19; }
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; height: 100dvh; width: min(400px, 92vw);
  background: var(--bg); color: var(--text); border-left: 1px solid var(--line);
  box-shadow: -8px 0 24px rgba(0,0,0,.3);
  transform: translateX(101%); transition: transform .22s ease; z-index: 20;
  display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-head { flex: 0 0 auto; display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); font-weight: 600; }
/* タブ（テロップ / 画像 / 配信） */
.drawer-tabs { flex: 0 0 auto; display: flex; gap: 4px; padding: 8px 12px 0; border-bottom: 1px solid var(--line); }
.tab-btn { flex: 1 1 auto; background: transparent; color: var(--muted); border: 1px solid transparent; border-bottom: none; border-radius: 8px 8px 0 0; padding: 8px 6px; font-size: 14px; font-weight: 600; cursor: pointer; }
.tab-btn:hover { color: var(--text); }
.tab-btn.on { color: var(--text); background: var(--surface); border-color: var(--line); }
.tab-pane { display: none; }
.tab-pane.on { display: block; }
/* タブ上部の小プレビュー（編集しながら見た目を確認） */
.pane-prev { position: relative; height: 92px; margin: 10px 0; border-radius: 8px; display: flex; align-items: center; justify-content: center; overflow: hidden; border: 1px solid var(--line); background-color: #14161b; background-image: linear-gradient(45deg,#23262d 25%,transparent 25%),linear-gradient(-45deg,#23262d 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#23262d 75%),linear-gradient(-45deg,transparent 75%,#23262d 75%); background-size: 16px 16px; background-position: 0 0,0 8px,8px -8px,-8px 0; }
.telop-prev .telop-txt { line-height: 1.15; white-space: pre-wrap; text-align: center; max-width: 96%; }
.pane-prev-img { max-width: 96%; max-height: 86px; object-fit: contain; display: none; }
.pane-prev-empty { color: var(--muted); font-size: 13px; }
.note-min { margin: 8px 0 0; font-size: 12px; color: var(--muted); line-height: 1.6; }
/* 情報タブ（iPhone接続先など） */
.info-h { font-size: 13px; font-weight: 700; margin: 14px 0 4px; color: var(--text); }
.info-list { display: flex; flex-direction: column; gap: 6px; }
.info-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.info-key { font-weight: 700; font-size: 13px; min-width: 42px; color: var(--text); }
.info-val { font-size: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; word-break: break-all; flex: 1 1 200px; color: var(--text); }
.info-copy { font-size: 12px; font-weight: 600; padding: 5px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; }
.info-copy:hover { border-color: var(--accent); }
.preset-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.preset { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; font-size: 13px; cursor: pointer; }
.preset:hover { border-color: var(--accent); }
.drawer-body { flex: 1 1 auto; overflow-y: auto; padding: 8px 14px 24px; }
.drawer-body h3 { font-size: 14px; font-weight: 600; margin: 16px 0 6px; }
.drawer-body h3:first-of-type { margin-top: 6px; }
.drawer-body .note { margin: 0 0 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }

/* ---- シーンボタン（プログラム＝赤 / プレビュー＝緑） ---- */
#scene-list { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 16px; }
.scene-btn.preview { border-color: #16c060; background: #16c060; color: #06351b; }
.scene-btn.program { border-color: #ff2d2d; background: #ff2d2d; color: #fff; }

/* ---- プレビュー グリッド ---- */
/* カメラタイル: 4列×2行。グリッド全体を 32:9 にすると各セルが16:9になり、タイルが隙間なく詰まる。 */
.grid-wrap { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 2px 12px 6px; }
#grid {
  aspect-ratio: 32 / 9;         /* 4列×2行の16:9セル → グリッド全体は 32:9 */
  /* ①修正: height:100%だと幅制約時にアスペクト比が壊れ、セルが16:9でなくなる。
     max-width/max-heightの両方＋アスペクト比で「収まる最大の32:9」にすると各セルが必ず16:9。 */
  max-width: 100%; max-height: 100%;
  overflow: hidden;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 4px;
}
/* スマホは2列。縦長になるのでグリッド比を 16:9 (=2列×2行) に。 */
@media (max-width: 560px) { #grid { aspect-ratio: 16 / 9; grid-template-columns: repeat(2, 1fr); } }

.tile {
  position: relative;
  min-height: 0; min-width: 0;   /* セル(=16:9)を隙間なく充填。映像は cover で埋める */
  background: #000;          /* タイルは常に黒地 */
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--line);
  cursor: pointer;          /* タップで切替 */
  transition: border-color .08s;
}
.tile:hover { border-color: var(--accent); }
/* 次に出す候補（プレビュー）＝緑枠タリー（programが後勝ちなので両方なら赤優先） */
.tile.preview {
  border-color: #16c060;
  box-shadow: 0 0 0 2px #16c060, 0 0 10px rgba(22,192,96,.5);
}
.tile.preview::before {
  content: "PVW";
  position: absolute; top: 6px; right: 6px;
  background: #16c060; color: #06351b;
  font-size: 10px; font-weight: 700; letter-spacing: .04em;
  padding: 2px 6px; border-radius: 4px; z-index: 1;
}
/* 現在プログラム（オンエア）のタイル＝赤枠タリー */
.tile.program {
  border-color: #ff2d2d;
  box-shadow: 0 0 0 2px #ff2d2d, 0 0 12px rgba(255,45,45,.6);
}
.tile.program::after {
  content: "ON AIR";
  position: absolute; top: 6px; left: 6px;
  background: #ff2d2d; color: #fff;
  font-size: 10px; font-weight: 700; letter-spacing: .04em;
  padding: 2px 6px; border-radius: 4px;
}
.tile video { width: 100%; height: 100%; object-fit: cover; background: #000; }

/* 各カメラの音声VUメーター（#1）。タイル右端の縦メーター。下から伸び、上ほど黄→赤。 */
.vu { position: absolute; right: 4px; top: 22px; bottom: 26px; width: 5px; border-radius: 3px; overflow: hidden; z-index: 2;
  background: linear-gradient(to top, #16c060 0%, #16c060 55%, #ffd23f 78%, #ff2d2d 100%); opacity: .9; }
.vu i { display: block; position: absolute; left: 0; right: 0; top: 0; height: 100%; background: rgba(0,0,0,.6); transition: height .04s linear; }
.vu[data-clip="1"] { box-shadow: 0 0 6px rgba(255,45,45,.85); }
/* #5 PGMモニタ横の本線VUメーター（ソースタイルのVUと同じ見た目・モニタ用に太く/縦長） */
.mon-vu { position: absolute; right: 6px; top: 26px; bottom: 10px; width: 8px; border-radius: 4px; overflow: hidden; z-index: 3;
  background: linear-gradient(to top, #16c060 0%, #16c060 55%, #ffd23f 78%, #ff2d2d 100%); opacity: .92; pointer-events: none; }
.mon-vu i { display: block; position: absolute; left: 0; right: 0; top: 0; height: 100%; background: rgba(0,0,0,.6); transition: height .05s linear; }
.mon-vu[data-clip="1"] { box-shadow: 0 0 7px rgba(255,45,45,.9); }

/* 音声タブ（#10）: レベル(緑)としきい値(線)＋コンプ/リミッター/ゲート */
.aud-target { display: block; margin: 4px 0 10px; font-size: 13px; }
.aud-target select { margin-left: 8px; }
.aud-meter { position: relative; height: 18px; border-radius: 5px; background: #111; overflow: hidden; margin: 0 0 2px; border: 1px solid var(--line); }
.aud-vu { position: absolute; inset: 0; }
.aud-vu i { display: block; height: 100%; width: 0%; background: linear-gradient(to right, #16c060 0%, #16c060 60%, #ffd23f 80%, #ff2d2d 100%); transition: width .05s linear; }
.aud-th { position: absolute; top: -2px; bottom: -2px; width: 2px; z-index: 2; }
.aud-th.comp  { background: #58a6ff; }   /* コンプのしきい値 = 青 */
.aud-th.limit { background: #ff7a2d; }   /* リミッターの上限 = 橙 */
.aud-th.gate-open  { background: #c678dd; }  /* ゲート開く閾値 = 紫(②) */
.aud-th.gate-close { background: #7d5a9e; }  /* ゲート閉じる閾値 = 灰紫(②) */
/* ③ メーター現在値・dB目盛・凡例 */
.aud-meter-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--muted); margin: 2px 0 4px; }
.aud-meter-top b { font-variant-numeric: tabular-nums; font-weight: 700; color: #16c060; }
.aud-scale { position: relative; height: 12px; margin: 3px 0 4px; font-size: 10px; color: var(--muted); }
.aud-scale span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.aud-scale span:first-child { transform: none; }
.aud-scale span:last-child { transform: translateX(-100%); }
.aud-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 10.5px; color: var(--muted); margin: 0 0 12px; }
.aud-legend i { display: inline-block; width: 12px; height: 3px; vertical-align: middle; margin-right: 4px; border-radius: 2px; }
.aud-fx { border: 1px solid var(--line); border-radius: 8px; margin: 8px 0; overflow: hidden; }
.aud-fx-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; background: rgba(127,127,127,.08); font-weight: 600; }
.aud-fx-head .sw { display: inline-flex; align-items: center; gap: 5px; font-weight: 500; font-size: 13px; cursor: pointer; }
.aud-fx-body { padding: 6px 10px 10px; }
.aud-fx:not(.on) .aud-fx-body { opacity: .45; }
.aud-fx-body label { display: flex; align-items: center; gap: 8px; margin: 7px 0; font-size: 13px; }
.aud-fx-body label input[type=range] { flex: 1; min-width: 0; }
.aud-fx-body label b { min-width: 62px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.aud-fx-note { margin: 2px 10px 10px; font-size: 11.5px; line-height: 1.55; opacity: .72; }
.aud-gr { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; opacity: .8; }
.aud-gr-bar { flex: 1; height: 8px; background: #111; border-radius: 4px; overflow: hidden; }
.aud-gr-bar i { display: block; height: 100%; width: 0%; background: #ff7a2d; transition: width .08s linear; }

.tile-bar {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 9px;
  background: linear-gradient(transparent, rgba(0,0,0,0.75));
  color: #fff;
}
.cam-name { font-weight: 600; font-size: 13px; color: #fff; }

/* N-8 カメラタイルのミュート表示（ミキサーを開いていなくても無音に気づける） */
.tile-mute { position: absolute; top: 6px; left: 6px; z-index: 3; display: flex; align-items: center; gap: 3px;
  background: #b3241c; color: #fff; font-size: 10px; font-weight: 800; letter-spacing: .02em; padding: 2px 7px; border-radius: 999px; box-shadow: 0 1px 4px rgba(0,0,0,.5); }
.tile-mute[hidden] { display: none; }
.tile.cam-muted { outline: 2px solid rgba(179,36,28,.7); outline-offset: -2px; }

.badge {
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
  padding: 3px 8px; border-radius: 999px;
  background: #6b7280; color: #fff;
}
.badge[data-state="live"]    { background: var(--live); }
.badge[data-state="stale"]   { background: var(--stale); }
.badge[data-state="offline"] { background: var(--offline); }
.badge[data-state="connecting"] { background: #6b7280; }

/* ⑥ ソース受信状態テーブル（診断） */
.srcstat { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 12px; }
.srcstat th, .srcstat td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--line); }
.srcstat th { color: var(--muted); font-weight: 600; }
.srcstat .ss-ok { color: var(--live, #16c060); font-weight: 700; }
.srcstat .ss-ng { color: var(--muted); }

/* 通知トースト（音声設定の保存/適用・試聴の案内など） */
/* UX-A2: トーストは下部中央のコンテナに縦積み（同座標で重ならない） */
.toast-box { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column-reverse; align-items: center; gap: 8px; pointer-events: none; }
.toast { max-width: 90vw; background: #1f2430; color: #fff; border: 1px solid var(--line, #3a3f47); padding: 10px 16px; border-radius: 8px; font-size: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.45); opacity: 1; transition: opacity .3s; }
.toast.bad { border-color: #ff4d4f; }
.toast.hide { opacity: 0; }
/* UX-A2: 要対処アラートのstickyバナー（上部・解消かユーザーが閉じるまで表示） */
#sys-banners { position: fixed; top: 0; left: 0; right: 0; z-index: 9998; display: flex; flex-direction: column; }
.sys-banner { display: flex; align-items: center; gap: 10px; padding: 9px 14px; background: #3a2b12; color: #ffd9a0; border-bottom: 1px solid #7a5a1f; font-size: 14px; font-weight: 700; }
.sys-banner.bad { background: #4a1512; color: #ffc7c4; border-bottom-color: #a03430; animation: sysBannerPulse 1.6s ease-in-out infinite; }
@keyframes sysBannerPulse { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.25); } }
@media (prefers-reduced-motion: reduce) { .sys-banner.bad { animation: none; } }
.sys-banner-msg { flex: 1 1 auto; }
.sys-banner-x { flex: 0 0 auto; min-width: 40px; min-height: 32px; border-radius: 6px; border: 1px solid currentColor; background: transparent; color: inherit; cursor: pointer; }
/* UX-A2: 制御切断中はタイルを減光して「操作が効かない」を視覚化（::afterは本線タリーで使用済みのため減光のみ） */
body.obs-down .tile { filter: grayscale(.7) brightness(.55); }
/* UX-D4/FB①: 未受信タイルを畳むトグル（BGMミニバーの左端に配置。カメラソースに密着させない） */
.hide-offline-btn { flex: 0 0 auto; margin-right: 10px; white-space: nowrap; }
#grid.hide-offline .tile.offline:not(.preview):not(.program) { display: none; }
/* UX-D2: マスターストリップ（右端・VU大きめ） */
.mx-strip.master { border-color: #7a2a2a; background: #241318; }
.mx-vu.master { width: 16px; }
/* UX-D1: ラベルの名前変更入力 */
.mx-rename { width: 84px; font-size: 12px; font-weight: 700; background: #0c1120; color: var(--text); border: 1px solid var(--accent); border-radius: 6px; padding: 2px 6px; text-align: center; }

/* 音声タブ: 全カメラ設定の保存/読込 行 */
.aud-io { display: flex; align-items: center; gap: 8px; margin: 6px 0 2px; flex-wrap: wrap; }
.aud-io-label { font-size: 12px; color: var(--muted); }

/* ==== 複数オーバーレイ（テロップ/画像） ==== */
/* 上部バーのアイテムチップ（横スクロール。各チップに PVW / 本線 スイッチ） */
/* FB④: テロップ/画像チップの帯。基準幅を広げて使えるエリアを右へ拡張（狭い時はrec/配信が別行に落ちる挙動は維持）。 */
.ovl-strip { display: flex; align-items: center; gap: 6px; flex: 1 1 360px; min-width: 160px; overflow-x: auto; padding: 2px; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
/* FB④: 一括PVW/本線ボタン（帯の先頭にsticky＝スクロールしても常に左端に見える） */
.ovl-bulk-group { position: sticky; left: 0; z-index: 1; flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; background: var(--bg); padding-right: 4px; }
.ovl-bulk { flex: 0 0 auto; min-height: 36px; padding: 4px 8px; font-size: 12px; }
.ovl-chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 3px 6px; cursor: pointer; }
.ovl-chip.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.ovl-chip .chip-prev { min-width: 44px; max-width: 96px; }
.ovl-add { flex: 0 0 auto; padding: 5px 10px; white-space: nowrap; }
/* ドロワーのアイテム一覧 */
.ovl-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.ovl-row { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; cursor: pointer; }
.ovl-row.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.ovl-row-label { flex: 1 1 auto; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.busbtn.del { color: var(--muted); border-color: var(--line); }
.busbtn.del:hover { color: #fff; background: #c11717; border-color: #c11717; }
/* レイヤー入替（▲▼）と一覧の注記 */
.busbtn.z { color: var(--muted); border-color: var(--line); padding: 5px 7px; }
.busbtn.z:hover:not(:disabled) { color: #fff; border-color: var(--accent); }
.busbtn.z:disabled { opacity: .3; cursor: default; }
.layer-note { font-size: 11px; font-weight: 500; color: var(--muted); margin-left: 6px; }
.op-sep { flex-basis: 100%; height: 1px; background: var(--line); margin: 2px 0; }
.op-del { color: #ff6b6b; border-color: #c11717; }
textarea#op-text { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px; font-size: 13px; resize: vertical; }

/* モニター上のオーバーレイレイヤー（PVW=編集可 / PGM=表示のみ） */
.ovl-layer { position: absolute; inset: 0; z-index: 2; overflow: hidden; pointer-events: none; }
.ovl-layer.edit { pointer-events: auto; touch-action: none; }
.ovl-item { position: absolute; opacity: 0; transition: opacity .4s ease; pointer-events: none; }
.ovl-layer.edit .ovl-item { pointer-events: auto; transition: opacity .2s ease; cursor: grab; touch-action: none; }
.ovl-item.show { opacity: 1; }
.ovl-item img { display: block; width: 100%; height: auto; -webkit-user-drag: none; user-select: none; -webkit-user-select: none; pointer-events: none; }
/* 選択枠＋四隅ハンドル（PVWのみ） */
.ovl-item .hd { display: none; }
.ovl-item.sel { outline: 2px solid var(--accent); outline-offset: 1px; }
.ovl-item.sel .hd { display: block; position: absolute; width: 16px; height: 16px; background: #fff; border: 2px solid var(--accent); border-radius: 50%; z-index: 3; touch-action: none; }
/* #21 端に置いた素材(全画面の蓋絵や左/上寄せ)でも四隅ハンドルが .mon の overflow:hidden で切れて掴めない→内側寄せ(-2px)でヒット域を枠内に確保 */
.ovl-item.sel .hd.nw { left: -2px; top: -2px; cursor: nwse-resize; }
.ovl-item.sel .hd.ne { right: -2px; top: -2px; cursor: nesw-resize; }
.ovl-item.sel .hd.sw { left: -2px; bottom: -2px; cursor: nesw-resize; }
.ovl-item.sel .hd.se { right: -2px; bottom: -2px; cursor: nwse-resize; }
/* テキストのインライン編集ボックス（PVW上のその場入力） */
.ovl-editbox { position: absolute; z-index: 5; min-width: 120px; min-height: 1.4em; background: rgba(10,14,24,.85); color: #fff; border: 2px solid var(--accent); border-radius: 6px; padding: 2px 6px; line-height: 1.25; resize: none; white-space: pre; overflow: hidden; }
/* ==== VTR / BGM ==== */
/* VTRチップ（切替バー）: PVW=緑 / 本線=赤 のタリー表示 */
.ctl.vtrbtn.preview { background: #16c060; border-color: #16c060; color: #06351b; }
.ctl.vtrbtn.program { background: #ff2d2d; border-color: #ff2d2d; color: #fff; }
/* モニタ上のVTR簡易プレビュー（映像レイヤーの上・オーバーレイ層の下） */
.vtr-mon { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; display: none; z-index: 1; pointer-events: none; }
.vtr-mon.show { display: block; }
.mon-controls-spacer { flex: 1 1 auto; }
/* ===== 動画/BGM ミニプレイヤー（VTR=大・実映像プレビュー / BGM=小・1行） ===== */
.miniplayers { flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px; padding: 6px 16px 0; }
/* 格納バー: ▾/▸ でミニプレイヤーを開閉。畳むと #mp-vtr / #mp-bgm を隠し、PVW/PGM・カメラ段が広がる。 */
.mp-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mp-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 5px; padding: 2px 10px; cursor: pointer; line-height: 1.5; letter-spacing: .02em; }
.mp-toggle:hover { border-color: var(--accent); color: var(--text); }
.mp-caret { font-size: 10px; display: inline-block; }
.mp-toggle-label { white-space: nowrap; }
.miniplayers.collapsed { padding-top: 3px; padding-bottom: 3px; }
.miniplayers.collapsed #mp-vtr, .miniplayers.collapsed #mp-bgm { display: none; }
.mp { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.mp.empty { opacity: .62; }
.mp-badge { flex: 0 0 auto; font-size: 11px; font-weight: 800; white-space: nowrap; padding: 2px 7px; border-radius: 5px; letter-spacing: .02em; }
.mp-badge.vtr { color: #04121a; background: var(--kipz-blue); }
.mp-badge.bgm { color: #f2f0ff; background: #6d5cf0; }
.mp-name { min-width: 0; font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-time { flex: 0 0 auto; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mp-remain { flex: 0 0 auto; font-size: 12px; font-weight: 800; color: #9fe6b6; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mp-remain.soon { color: #ff8a8a; }
.mp-btn { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.mp-btn:hover:not(:disabled) { border-color: var(--accent); }
.mp-btn:disabled { opacity: .38; cursor: default; }
.mp-btn.on { background: #c0892a; border-color: #c0892a; color: #fff; }
.mp-btn.mp-pvw.preview { background: #16c060; border-color: #16c060; color: #06351b; }
.mp-btn.mp-pgm.program { background: #ff2d2d; border-color: #ff2d2d; color: #fff; }
.mp-vol { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.mp-vol input[type="range"] { width: 84px; }
/* ③ 🔊アイコン=クリックでミュート/解除。ミュート中は赤系で明示 */
.mp-mute { border: 1px solid var(--line); background: #10182b; color: var(--fg); border-radius: 6px; font-size: 14px; line-height: 1; padding: 3px 5px; cursor: pointer; }
.mp-mute:hover:not(:disabled) { border-color: var(--acc); }
.mp-mute.muted { background: #3a1220; border-color: #b3324c; }
.mp-mute:disabled { opacity: .45; cursor: default; }
/* VU（横バー＝素の音声レベル。緑→黄→赤。0dB付近で枠が赤） */
.mp-vu { flex: 0 0 auto; width: 70px; height: 10px; border-radius: 3px; background: #0c1120; border: 1px solid var(--line); overflow: hidden; }
.mp-vu.mp-vu-sm { width: 44px; height: 8px; }
.mp-vu > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #16c060 0%, #16c060 62%, #e6c619 80%, #ff4147 100%); transition: width .06s linear; }
.mp-vu.clip { box-shadow: inset 0 0 0 1px #ff4147; }
/* シークバー（YouTube式: クリック/ドラッグで移動・ホバーで太く・つまみ表示） */
.mp-seek-bar { position: relative; height: 7px; border-radius: 4px; background: #0c1120; overflow: visible; touch-action: none; }
.mp-seek-bar > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 4px; transition: width .25s linear; }
.mp-seek-bar.on { cursor: pointer; }
.mp-seek-bar.on:hover { height: 11px; }
.mp-seek-bar.drag > i { transition: none; }
.mp-seek-bar.on > i::after { content: ''; position: absolute; right: -7px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.55); opacity: 0; transition: opacity .12s; }
.mp-seek-bar.on:hover > i::after, .mp-seek-bar.drag > i::after { opacity: 1; }
/* --- VTR: 大きめ。左=実映像プレビュー（クリック=PVW / ダブル=本線）、右=情報+操作 --- */
.mp-vtr { padding: 8px 10px; align-items: stretch; }
.mp-hit { position: relative; flex: 0 0 auto; width: 150px; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; background: #000; cursor: pointer; border: 2px solid var(--line); }
.mp-hit:hover { border-color: var(--accent); }
.mp-vtr.on-pvw .mp-hit { border-color: #16c060; box-shadow: 0 0 0 1px #16c060; }
.mp-vtr.on-pgm .mp-hit { border-color: #ff3b3b; box-shadow: 0 0 0 1px #ff3b3b; }
.mp-vtr.empty .mp-hit { cursor: default; }
.mp-preview { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.mp-hit .mp-badge { position: absolute; left: 4px; top: 4px; z-index: 2; }
.mp-hint { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; font-size: 10px; font-weight: 700; text-align: center; color: #fff; background: rgba(8,12,22,.66); padding: 2px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-vtr.on-pgm .mp-hint { background: rgba(200,30,30,.74); }
.mp-vtr .mp-mid { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; justify-content: center; }
.mp-vtr .mp-row1 { display: flex; align-items: baseline; gap: 8px; }
.mp-vtr .mp-row1 .mp-name { flex: 1 1 auto; }
.mp-vtr .mp-ctl { display: flex; align-items: center; gap: 6px; }
.mp-ctl-sp { flex: 1 1 auto; }
/* --- BGM: コンパクト1行 --- */
.mp-bgm { padding: 4px 10px; min-height: 34px; gap: 8px; }
.mp-bgm .mp-badge { font-size: 13px; padding: 2px 6px; }
.mp-bgm .mp-name { flex: 0 1 auto; max-width: 220px; font-size: 12px; }
.mp-bgm .bgm-seek { flex: 1 1 auto; }
.mp-bgm .mp-btn { padding: 3px 7px; }
.mp-bgm .mp-vol input[type="range"] { width: 64px; }
@media (max-width: 820px) { .mp-hit { width: 108px; } .mp-vol input[type="range"] { width: 56px; } .mp-bgm .mp-name { max-width: 120px; } }
/* ① TAKE/CUT 押下フィードバック（押した瞬間に強く光る＝効いた合図） */
@keyframes btnflash { 0% { box-shadow: 0 0 0 0 rgba(255,255,255,.95), 0 0 14px 4px rgba(255,255,255,.7); filter: brightness(1.7); } 100% { box-shadow: 0 0 0 10px rgba(255,255,255,0); filter: brightness(1); } }
.ctl.flash { animation: btnflash .42s ease-out; }
/* メディアライブラリ（動画=🎬 / 音楽=🎵 で自動仕分け。行クリックでVTR/BGMにセット） */
.media-lib-h { font-size: 12px; font-weight: 800; color: var(--muted); margin: 12px 0 4px; letter-spacing: .02em; }
.media-list { display: flex; flex-direction: column; gap: 6px; margin: 6px 0; }
.media-item { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; cursor: pointer; transition: border-color .12s, background .12s; }
.media-item:hover { border-color: var(--accent); background: #1a2238; }
.media-item.sel { border-color: var(--accent); background: #17223c; box-shadow: inset 0 0 0 1px var(--accent); }
.media-thumb { flex: 0 0 auto; width: 56px; height: 32px; object-fit: cover; border-radius: 4px; background: #0c1120; }
.media-thumb.ph { background: #0c1120 center/20px no-repeat; }
.media-ic { flex: 0 0 auto; }
.media-ic-big { flex: 0 0 auto; width: 40px; height: 32px; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; background: #0c1120; border-radius: 4px; }
.media-meta { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.media-item .media-name { flex: 0 1 auto; }
.media-sub { font-size: 11px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.media-selbadge { flex: 0 0 auto; font-size: 10px; font-weight: 800; color: #fff; background: var(--accent); border-radius: 4px; padding: 1px 6px; }
.media-fmt { flex: 0 0 auto; font-size: 10px; font-weight: 800; color: #f4c542; background: rgba(244,197,66,.14); border: 1px solid rgba(244,197,66,.4); border-radius: 4px; padding: 1px 5px; white-space: nowrap; cursor: help; }
.media-name { flex: 1 1 auto; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.media-size { font-size: 11px; color: var(--muted); white-space: nowrap; }
.media-del { flex: 0 0 auto; }
.media-item .ctl { padding: 5px 9px; font-size: 12px; }
.media-box { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 6px 0 12px; }
.media-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0; }
.media-time { font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.media-seek { width: 100%; margin: 4px 0; }
.media-vol { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.media-vol input[type="range"] { width: 130px; }

/* 合成: 左右パン（2画面splitのみ表示） */
.comp-pan-row { flex-wrap: wrap; }
.comp-pan-lbl { flex: 1 0 100%; font-size: 12px; color: var(--muted); }
.comp-pan { flex: 1 1 46%; display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.comp-pan input[type="range"] { width: 100%; }

/* PVW上のツールボタン（テキスト/画像の追加・編集ロック） */
.pvw-tools { position: absolute; right: 6px; top: 6px; display: flex; gap: 6px; z-index: 6; }
.pt-btn { display: inline-flex; align-items: center; font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 6px; border: 1px solid rgba(255,255,255,.35); background: rgba(10,14,24,.55); color: #fff; cursor: pointer; }
.pt-btn:hover { border-color: var(--accent); }
.pt-btn:disabled, .pt-btn.off { opacity: .4; pointer-events: none; }
.pt-btn.on { background: #c0892a; border-color: #c0892a; }

/* ===== 合成レイアウト（2画面 / ワイプPinP）モニタープレビュー ===== */
.comp-layer { position: absolute; inset: 0; z-index: 1; background: #000; overflow: hidden; display: none; pointer-events: none; }
.comp-layer.show { display: block; }
.comp-layer video { position: absolute; background: #000; }
/* 2画面(横): 左右ハーフをcoverで充填（黒帯なしの2ショット） */
.comp-layer.split .comp-a { left: 0; top: 0; width: 50%; height: 100%; object-fit: cover; border-right: 1px solid rgba(255,255,255,.3); }
.comp-layer.split .comp-b { right: 0; top: 0; width: 50%; height: 100%; object-fit: cover; }
/* ワイプ(PinP): A=全画面(contain=単一カメラと同じ見え方)、B=小窓(cover) */
.comp-layer.pip .comp-a { inset: 0; width: 100%; height: 100%; object-fit: contain; }
.comp-layer.pip .comp-b { object-fit: cover; border: 2px solid #fff; box-shadow: 0 2px 10px rgba(0,0,0,.6); border-radius: 3px; }
.comp-layer.pip.tl .comp-b { left: 3%; top: 4%; }
.comp-layer.pip.tr .comp-b { right: 3%; top: 4%; }
.comp-layer.pip.bl .comp-b { left: 3%; bottom: 4%; }
.comp-layer.pip.br .comp-b { right: 3%; bottom: 4%; }

/* 合成ボタンの状態（PVW=緑 / 本線=赤） */
.ctl.compbtn.preview { background: #16c060; border-color: #16c060; color: #06351b; }
.ctl.compbtn.program { background: #ff2d2d; border-color: #ff2d2d; color: #fff; }

/* 配信の健全性チップ（緑=良好 / 黄=やや不安定 / 赤=不安定） */
.stream-health { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 10px; white-space: nowrap; color: #fff; }

/* 合成ポップオーバー */
.comp-pop { position: fixed; z-index: 60; width: 336px; max-width: 94vw; background: #131a30; color: var(--text); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.55); padding: 10px 12px; display: none; }
.comp-pop.open { display: block; }
.comp-pop-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.comp-x, .kbd-x { background: transparent; border: 0; color: var(--muted); font-size: 16px; cursor: pointer; line-height: 1; }
.comp-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 7px 0; font-size: 13px; }
.comp-row > label { display: flex; gap: 4px; align-items: center; }
.comp-row select { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 5px 6px; font-size: 13px; }
.comp-lay, .comp-corner, .comp-swap { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font-size: 13px; font-weight: 700; cursor: pointer; }
.comp-lay.on, .comp-corner.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.comp-lay:hover, .comp-corner:hover, .comp-swap:hover { border-color: var(--accent); }
.comp-corners { display: inline-grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.comp-size { flex: 1; }
.comp-actions { justify-content: space-between; }
.comp-note { font-size: 11px; color: var(--muted); line-height: 1.5; margin: 6px 0 0; }

/* キーボードショートカット ヘルプ */
.kbd-help-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 9998; display: none; align-items: center; justify-content: center; }
.kbd-help-backdrop.open { display: flex; }
.kbd-help { background: #131a30; color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; width: 420px; max-width: 92vw; box-shadow: 0 16px 48px rgba(0,0,0,.6); }
.kbd-help-head { display: flex; justify-content: space-between; align-items: center; font-weight: 800; font-size: 16px; margin-bottom: 10px; }
.kbd-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.kbd-table td { padding: 7px 6px; border-bottom: 1px solid var(--line); }
.kbd-table td:first-child { width: 42%; }
.kbd-table kbd { display: inline-block; background: var(--bg); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 2px 7px; font-weight: 700; font-size: 12.5px; }
.kbd-note { font-size: 11.5px; color: var(--muted); margin: 12px 0 0; line-height: 1.5; }

/* 使い方ガイド（初回チュートリアル）。ショートカット一覧と同じトーンでまとめる */
.tut-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.62); z-index: 9999; display: none; align-items: center; justify-content: center; padding: 16px; }
.tut-backdrop.open { display: flex; }
.tut-box { background: #131a30; color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 18px 22px 16px; width: 480px; max-width: 94vw; box-shadow: 0 18px 54px rgba(0,0,0,.6); }
.tut-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.tut-head-t { font-weight: 800; font-size: 13px; letter-spacing: .04em; color: var(--muted); }
.tut-x { background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; line-height: 1; }
.tut-x:hover { color: var(--text); }
.tut-body { min-height: 210px; text-align: center; padding: 8px 4px 2px; }
.tut-icon { font-size: 44px; line-height: 1; margin: 6px 0 10px; }
.tut-title { font-size: 19px; font-weight: 800; margin: 0 0 12px; }
.tut-p { font-size: 14px; line-height: 1.75; color: #d7ddec; margin: 0 0 10px; text-align: left; }
.tut-dots { display: flex; gap: 7px; justify-content: center; margin: 6px 0 14px; }
.tut-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.tut-dot.on { background: var(--accent); }
.tut-actions { display: flex; gap: 10px; justify-content: space-between; }
.tut-actions button { flex: 1 1 0; min-height: 44px; border-radius: 8px; font-size: 15px; font-weight: 700; cursor: pointer; border: 1px solid var(--line); }
.tut-actions .ghost { background: transparent; color: var(--text); }
.tut-actions .ghost:hover:not(:disabled) { border-color: var(--accent); }
.tut-actions .ghost:disabled { opacity: .4; cursor: default; }
.tut-actions .primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.tut-actions .primary:hover { filter: brightness(1.08); }
.tut-skip { display: block; margin: 12px auto 0; background: none; border: none; color: var(--muted); font-size: 12px; text-decoration: underline; cursor: pointer; }
.tut-skip:hover { color: var(--text); }

/* 複数人接続の人数表示（共有編集） */
.share-peers { font-size: 11px; font-weight: 700; color: #06351b; background: #16c060; padding: 2px 9px; border-radius: 10px; white-space: nowrap; }

/* アプリ内確認ダイアログ（window.confirm代替。iPad前提の大きめボタン） */
/* ★確認ダイアログは常に最前面。ミキサー(z9200)・使い方ガイド(9999)・ショートカット(9998)の裏に隠れると、
   本番中に「配信/録画を停止しますか？」が見えず押せず＝停止できない放送・課金事故になるため、全オーバーレイより上。 */
.uiconfirm-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 100000; display: flex; align-items: center; justify-content: center; }
.uiconfirm { background: var(--panel, #1b1e24); border: 1px solid var(--line, #333); border-radius: 12px; padding: 18px 20px 16px; max-width: min(440px, 88vw); box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.uiconfirm-msg { margin: 0 0 14px; font-size: 14.5px; line-height: 1.65; white-space: pre-wrap; }
.uiconfirm-row { display: flex; gap: 10px; justify-content: flex-end; }
.uiconfirm-row .ctl { min-width: 108px; min-height: 40px; font-size: 14px; }
.uiconfirm-ok { background: #d94141; border-color: #d94141; color: #fff; font-weight: 700; }
.uiconfirm-ng { opacity: .85; }

/* 解析不能メディア（拡張子だけ動画/破損疑い）の注意表示 */
.media-item.media-broken { opacity: .55; }
.media-fmt.media-warn { background: #7a2c2c; color: #ffd9d9; border-color: #a33; }

/* ================= 🎚 ミキサー（音声専用ビュー） ================= */
/*   フルスクリーンに近いオーバーレイ。cam1〜8＋VTR/BGMの縦ストリップを横並び（狭い画面は横スクロール）。
     iPadタッチ前提: フェーダーは縦（-90度回転＝全ブラウザで確実）・ミュートはmin44pxのタッチ領域。 */
/* UX-D3: 画面内ミキサーは全面被覆→下部ドロワーに（フェーダー操作中もPGM/PVWとタリーが見える=実卓の作法） */
.mx-panel { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 9200; background: rgba(10, 14, 30, .97); display: flex; flex-direction: column; max-height: 72vh; overflow-y: auto; border-top: 2px solid #33507f; box-shadow: 0 -10px 34px rgba(0, 0, 0, .55); }
.mx-panel[hidden] { display: none; }
/* ⑥ 別ウインドウで開いたミキサー: オーバーレイ指定を解除して窓いっぱいに */
.mx-win-body { margin: 0; background: var(--bg); color: var(--text); }
.mx-panel.mx-in-win { position: static; inset: auto; z-index: auto; height: 100vh; max-height: none; border-top: none; box-shadow: none; background: var(--bg); }
.mx-panel.mx-in-win #mixer-popout { display: none; }   /* UX-②: 既に別窓なら「⧉別窓」は不要 */
#mixer-popout { font-size: 13px; white-space: nowrap; padding: 0 10px; }
.mx-head { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.mx-title { font-weight: 800; font-size: 16px; white-space: nowrap; }
.mx-note { flex: 1 1 auto; color: var(--muted); font-size: 12px; line-height: 1.4; }
.mx-close { flex: 0 0 auto; min-width: 44px; min-height: 44px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 17px; cursor: pointer; }
.mx-close:hover { border-color: var(--accent); }

/* ストリップ列（縦は中央寄せ・横ははみ出したらスクロール） */
.mx-strips { flex: 1 1 auto; display: flex; align-items: flex-start; justify-content: safe center; gap: 10px; padding: 20px 16px 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.mx-strip { position: relative; flex: 0 0 96px; display: flex; flex-direction: column; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 6px 8px; }
.mx-strip.media { border-color: #3a4a7a; background: #182144; }   /* VTR/BGMはカメラと見分けやすく */
.mx-strip.off { opacity: .45; }                                    /* 未セット（VTR/BGM）は薄く */
.mx-sep { flex: 0 0 1px; align-self: stretch; margin: 8px 4px; background: var(--line); }
.mx-label { font-weight: 700; font-size: 13px; white-space: nowrap; }

/* VU＋フェーダーの本体。高さはビューポートに応じて可変（フェーダー長=回転した入力のwidthと同じ式で一致させる） */
.mx-body { display: flex; align-items: stretch; justify-content: center; gap: 8px; width: 100%; height: clamp(140px, 26vh, 240px); }   /* UX-D3: ドロワー内に収まる高さへ */
.mx-vu { position: relative; width: 9px; border-radius: 4px; overflow: hidden;
  background: linear-gradient(to top, #16c060 0%, #16c060 55%, #ffd23f 78%, #ff2d2d 100%); opacity: .92; }
.mx-vu i { display: block; position: absolute; left: 0; right: 0; top: 0; height: 100%; background: rgba(0, 0, 0, .6); transition: height .05s linear; }
.mx-vu[data-clip="1"] { box-shadow: 0 0 7px rgba(255, 45, 45, .9); }
.mx-strip.muted .mx-vu { opacity: .35; filter: grayscale(1); }     /* ミュート中はVUをグレーに */

/* 縦フェーダー: -90度回転（min=下・max=上）。タッチ領域=入力の高さ44px */
.mx-fader-wrap { position: relative; width: 48px; height: 100%; }
/* UX-B2: ユニティ(0dB=上端)と-10dB(56.2%)の目盛線 */
.mx-fader-wrap::before { content: '0dB'; position: absolute; top: -2px; left: 100%; margin-left: 2px; font-size: 9px; color: var(--muted); line-height: 1; }
.mx-fader-wrap::after { content: ''; position: absolute; top: 43.8%; left: 6px; right: 6px; height: 1px; background: rgba(255,255,255,.22); pointer-events: none; }
/* UX-B1: フェーダー上でのスクロールジェスチャを無効化（誤タッチの値飛び防止とセット） */
.mx-fader { touch-action: none; }
/* UX-B3: ピークホールド線 */
.mx-vu .pk { position: absolute; left: 0; right: 0; height: 2px; background: #fff; top: 100%; opacity: 0; transition: top .08s linear; pointer-events: none; }
/* UX-B3: 目安ゾーン（声はこの帯に= -18〜-9dB）をスケール列に薄く表示 */
.mx-scale-body::before { content: ''; position: absolute; top: 15%; height: 15%; left: 26px; width: 7px; background: rgba(22,192,96,.30); border-radius: 2px; pointer-events: none; }
/* UX-B4: ゲート開閉LED */
.mxd-gate-led { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: #2a3146; border: 1px solid #4a5578; margin-left: 8px; vertical-align: middle; }
.mxd-gate-led.open { background: #16c060; border-color: #16c060; box-shadow: 0 0 6px rgba(22,192,96,.8); }
.mxd-gate-led.disabled { opacity: .35; }
.mx-fader { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) rotate(-90deg);
  width: clamp(140px, 26vh, 240px); height: 44px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; }   /* UX-D3: mx-bodyの高さと一致必須 */
.mx-fader::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: #0c1120; border: 1px solid var(--line); }
.mx-fader::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 38px; margin-top: -17px; border-radius: 6px;
  background: linear-gradient(#e8ecf5, #aeb9d6); border: 1px solid #55608a; box-shadow: 0 2px 6px rgba(0, 0, 0, .5); cursor: pointer; }
.mx-fader::-moz-range-track { height: 6px; border-radius: 3px; background: #0c1120; border: 1px solid var(--line); }
.mx-fader::-moz-range-thumb { width: 20px; height: 38px; border-radius: 6px; background: linear-gradient(#e8ecf5, #aeb9d6); border: 1px solid #55608a; cursor: pointer; }
.mx-fader:disabled { opacity: .4; }

/* 音量値・ミュートボタン */
.mx-val { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; line-height: 1; }
.mx-mute { min-width: 56px; min-height: 44px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font-size: 18px; cursor: pointer; }
.mx-mute:hover { border-color: var(--accent); }
.mx-mute.muted { background: #7f1d1d; border-color: #ff4d4f; }
.mx-mute:disabled { opacity: .5; cursor: default; }

/* ミキサー: GR(圧縮量)メーター・AFLソロ・ch選択・チャンネル詳細パネル */
.mx-label { background: transparent; border: 1px solid transparent; color: #dfe6f5; font-weight: 700; font-size: 13px; white-space: nowrap; border-radius: 7px; padding: 3px 8px; cursor: pointer; }
.mx-strip.sel .mx-label { border-color: #4a7bd8; background: #16264a; color: #cfe0ff; }
/* N-10 ① 選択強調を強く（枠全体タッチで選択→どれが選択中か一目で）。afl(box-shadow)と併用できるよう outline を使う */
.mx-strip.sel { outline: 2px solid #4a7bd8; outline-offset: -2px; background: #101d38; }
.mx-strip.afl { box-shadow: inset 0 0 0 2px #d98a1f; }
/* N-11 本線(オンエア)ストリップに赤バッジ */
.mx-strip.onair::before { content: 'ON AIR'; position: absolute; top: -9px; left: 50%; transform: translateX(-50%); background: #c0261f; color: #fff; font-size: 9px; font-weight: 800; letter-spacing: .5px; padding: 1px 6px; border-radius: 6px; white-space: nowrap; box-shadow: 0 1px 4px rgba(0,0,0,.5); }
/* ③ dBスケール列（VU左・上ほど細かい目盛） */
.mx-scale { flex: 0 0 42px; background: transparent; border-color: transparent; padding-left: 0; padding-right: 0; }
.mx-scale-cap { color: var(--muted); opacity: .7; cursor: default; }
.mx-scale-body { position: relative; width: 38px; height: clamp(140px, 26vh, 240px); }   /* UX-D3: mx-bodyと一致 */
.mx-tick { position: absolute; right: 2px; transform: translateY(-50%); display: flex; align-items: center; gap: 4px; font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mx-tick span { min-width: 18px; text-align: right; }
.mx-tick::after { content: ''; display: block; width: 7px; height: 1px; background: var(--line); }
.mx-gr { position: relative; width: 6px; border-radius: 3px; overflow: hidden; background: #241a12; }
.mx-gr i { display: block; position: absolute; left: 0; right: 0; top: 0; height: 0%; background: linear-gradient(to bottom, #ff9d3f, #ff5a2d); transition: height .07s linear; }
.mx-afl { min-width: 44px; min-height: 44px; border-radius: 8px; border: 1px solid #55608a; background: #0d1424; color: #cbd4ea; font-size: 12px; font-weight: 700; cursor: pointer; }   /* #32 タッチ最小44px */
.mx-afl:hover { border-color: #d98a1f; }
.mx-afl.on { background: #d98a1f; border-color: #d98a1f; color: #241400; }
/* FB③: 音声固定ch(📌 常時ON)。ONのchは緑の枠＋「常時ON」バッジで一目で分かる */
.mx-pin { min-width: 44px; min-height: 44px; border-radius: 8px; border: 1px solid #55608a; background: #0d1424; font-size: 14px; cursor: pointer; filter: grayscale(1) opacity(.75); }
.mx-pin:hover { border-color: #2fb168; filter: none; }
.mx-pin.on { background: #123822; border-color: #2fb168; filter: none; box-shadow: 0 0 6px rgba(47,177,104,.45); }
.mx-strip.pinned { box-shadow: inset 0 0 0 2px #2fb168; }
.mx-strip.pinned::after { content: '常時ON'; position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%); background: #2fb168; color: #04170c; font-size: 9px; font-weight: 800; letter-spacing: .5px; padding: 1px 6px; border-radius: 6px; white-space: nowrap; box-shadow: 0 1px 4px rgba(0,0,0,.5); }
.mx-strip.pinned.afl { box-shadow: inset 0 0 0 2px #2fb168, inset 0 0 0 4px #d98a1f; }

.mx-detail { flex: 0 0 auto; border-top: 1px solid #2a3350; background: #0d1220; padding: 10px 16px 14px; max-height: 38vh; overflow-y: auto; }
.mxd-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.mxd-title { font-size: 14px; color: #e8ecf5; }
.mxd-level { display: flex; align-items: baseline; gap: 6px; color: #8b96b5; font-size: 12px; }
.mxd-db { color: #e8ecf5; font-variant-numeric: tabular-nums; }
.mxd-io { margin-left: auto; display: flex; gap: 6px; }
.mxd-meter { position: relative; height: 12px; border-radius: 6px; background: #0c1120; border: 1px solid #2a3350; overflow: hidden; }
/* FB⑤: JSはfill=子の<i>のwidthを更新する。親(.mxd-vu)をwidth:0%にしていたためメーターが常に不可視だった→親=トラック全幅、子=fill */
.mxd-vu { position: relative; height: 100%; width: 100%; }
.mxd-vu i { display: block; height: 100%; width: 0%; background: linear-gradient(to right, #16c060 0%, #16c060 60%, #ffd23f 82%, #ff2d2d 100%); transition: width .06s linear; }
.mxd-th { position: absolute; top: -2px; width: 2px; height: 16px; transform: translateX(-1px); }
.mxd-th.comp { background: #58a6ff; } .mxd-th.limit { background: #ff7a2d; } .mxd-th.gopen { background: #c678dd; } .mxd-th.gclose { background: #7d5a9e; }
.mxd-scale { position: relative; height: 12px; color: #6b7694; font-size: 10px; }
.mxd-scale span { position: absolute; transform: translateX(-50%); }
.mxd-rows { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px 16px; margin-top: 6px; }
.mxd-fx { background: #151b2e; border: 1px solid #2a3350; border-radius: 9px; padding: 8px 10px; }
.mxd-fx-h { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: #cfd6e8; margin-bottom: 4px; }
.mxd-fx label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #aab4cf; margin: 4px 0; }
.mxd-fx label input[type=range] { flex: 1; }
.mxd-fx label b { min-width: 58px; text-align: right; color: #e8ecf5; font-variant-numeric: tabular-nums; font-weight: 500; }
.mxd-gr { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #aab4cf; margin-top: 4px; }
.mxd-gr-bar { flex: 1; height: 8px; border-radius: 4px; background: #241a12; overflow: hidden; }
.mxd-gr-bar i { display: block; height: 100%; width: 0%; background: linear-gradient(to right, #ff9d3f, #ff5a2d); transition: width .07s linear; }
