/* style-youtube.css — YouTubeアプリ(.qn-yt*)専用。JSはqn-app-youtube.js。style-apps.cssの直後に読む(順序で上書き) */

/* PC=左パネル(375px、#pcV2Panelと同幅)+右ステージ。SP=縦積み(ステージ→パネル)、全体が1本スクロール */
.qn-yt {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 375px 1fr;
  grid-template-rows: minmax(0, 1fr) auto;
  color: var(--text-bright);
  font-family: var(--font-body, 'Instrument Sans'), sans-serif;
  font-size: var(--fs-body);
}

.qn-yt-panel {
  grid-column: 1;
  grid-row: 1 / span 2;
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.qn-yt-panel-header {
  padding: 14px 16px 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-display, 'Instrument Sans'), sans-serif;
  font-size: var(--fs-title);
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: none;
  color: var(--icon-muted);
  flex-shrink: 0;
}

.qn-yt-panel-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 0 16px;
  scrollbar-gutter: stable;
}

.qn-yt-sec {
  padding: 16px 16px 4px 20px;
}

.qn-yt-sec {
  display: none;
}

.qn-yt[data-panel="library"] .qn-yt-sec-library,
.qn-yt[data-panel="markers"] .qn-yt-sec-markers,
.qn-yt[data-panel="playlists"] .qn-yt-sec-playlists,
.qn-yt[data-panel="backup"] .qn-yt-sec-backup,
.qn-yt[data-panel="import"] .qn-yt-sec-import,
.qn-yt[data-panel="text"] .qn-yt-sec-text,
.qn-yt[data-panel="keyboard"] .qn-yt-sec-keyboard {
  display: block;
}

.qn-yt-sec-head {
  display: none;
}


.qn-yt-sec-head h3 {
  margin: 0;
  font-family: var(--font-display, 'Instrument Sans'), sans-serif;
  font-size: var(--fs-heading);
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: none;
  color: var(--text-bright);
}

.qn-yt-count {
  font-size: var(--fs-small);
  color: var(--icon-muted);
  font-variant-numeric: tabular-nums;
}

.qn-yt-input-block {
  padding-bottom: 8px;
}

.qn-yt-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.qn-yt-input {
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-field);
  border: 1px solid var(--border-subtle);
  background: var(--bg-1c1c24); /* 入力欄はPLAYERのexport-filename-input等と同じ(角丸=--radius-field, 背景#1c1c24) */
  color: var(--text-bright);
  font-family: inherit;
  font-size: var(--fs-body);
  outline: none;
  transition: border-color var(--dur-hover, 130ms) ease, background var(--dur-hover, 130ms) ease;
}

.qn-yt-input::placeholder {
  color: var(--icon-muted);
}

.qn-yt-input:focus {
  border-color: var(--accent-primary);
  background: var(--bg-22222c);
}

.qn-yt-btn {
  flex-shrink: 0;
  height: var(--btn-h);
  padding: 0 var(--btn-pad-x);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: none;
  color: var(--text-bright);
  font-family: var(--font-display, 'Instrument Sans'), sans-serif;
  font-size: var(--fs-btn);
  font-weight: 700;
  letter-spacing: 0.4px;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--dur-hover, 130ms) ease, border-color var(--dur-hover, 130ms) ease,
              color var(--dur-hover, 130ms) ease, transform var(--dur-press, 100ms) ease;
}

.qn-yt-btn:hover:not(:disabled) {
  background: var(--bg-hover-subtle);
  border-color: rgba(var(--ov), 0.28);
}

.qn-yt-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.qn-yt-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.qn-yt-btn.primary {
  background: var(--accent-primary);
  border-color: transparent;
  color: var(--text-pure-white, #fff);
}

.qn-yt-btn.primary:hover:not(:disabled) {
  background: var(--accent-hover-1);
  border-color: transparent;
}

.qn-yt-btn.on {
  background: var(--accent-primary);
  border-color: transparent;
  color: var(--text-pure-white, #fff);
}

.qn-yt-btn.mini {
  height: 26px;
  padding: 0 10px;
  font-size: var(--fs-micro);
}

.qn-yt-message {
  min-height: 18px;
  font-size: var(--fs-small);
  color: var(--danger, #ef4444);
}

.qn-yt-message.ok {
  color: #34d399;
}

.qn-yt-sync {
  min-height: 18px;
  font-size: var(--fs-small);
  color: var(--icon-muted);
  cursor: default;
}
.qn-yt-sync:empty { display: none; }
.qn-yt-sync.can { cursor: pointer; }
.qn-yt-sync.can:hover { color: var(--text-bright); }
.qn-yt-sync.err { color: var(--danger, #ef4444); }

.qn-yt-empty {
  margin: 4px 0 12px;
  font-size: var(--fs-small);
  color: var(--icon-muted);
}


.qn-yt-btn.ab {
  width: 30px;
  padding: 0;
}

.qn-yt-btn.ab.active-a {
  background: var(--accent-primary);
  border-color: transparent;
  color: #fff;
}

.qn-yt-btn.ab.active-b {
  background: #f59e0b;
  border-color: transparent;
  color: var(--fg-1a1204);
}

/* ---------- Backup/Import: 本体と同部品を流用(ベースはstyle-export.css)。#pcV2PanelBody.pcv2-panel-backupと同じ枠なし・線区切りに揃える ---------- */
.qn-yt-panel .export-section-label {
  display: block;
  font-family: var(--font-display, 'Instrument Sans'), sans-serif;
  font-size: var(--fs-heading);
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: none;
  color: var(--text-bright);
  margin: 0;
}

.qn-yt-panel .track-backup-tracklist-header {
  margin-bottom: 12px;
}

.qn-yt-panel .track-backup-mini-btn {
  background: none;
}

.qn-yt-panel .track-backup-tracklist {
  max-height: min(38vh, 340px);
  gap: 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.qn-yt-panel .track-backup-track-row,
.qn-yt-panel .track-backup-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  border-radius: 0;
  cursor: pointer;
}

.qn-yt-panel .track-backup-track-row:last-child,
.qn-yt-panel .track-backup-row:last-child {
  border-bottom: none;
}

.qn-yt-panel .track-backup-checklist {
  display: flex;
  flex-direction: column;
  margin-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.qn-yt-panel .track-backup-row-label {
  font-size: var(--fs-body);
  color: var(--fg-c8c8d0);
}

.qn-yt-panel .track-backup-options {
  margin-top: 16px;
}

.qn-yt-panel .track-backup-row input[type="checkbox"] {
  accent-color: var(--accent-primary);
  width: 16px;
  height: 16px;
}


.qn-yt-panel .track-import-dropzone {
  margin-bottom: 12px;
}

.qn-yt-panel .track-import-duplicate-list {
  margin-top: 16px;
}

.qn-yt-stage {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
}

/* プレイヤー(規約): 切り抜き・隠蔽・重ね・変形禁止。16:9。角丸/overflow:hiddenを付けない(切り抜きに当たる) */
.qn-yt-player-wrap {
  width: 100%;
  max-width: 1280px;
  aspect-ratio: var(--qn-yt-ar, 1.7778); /* 動画の縦横比(oEmbedの幅/高さ)。取得前・不明は16:9 */
  min-height: 200px; /* 規約: 最小200px */
  background: #000;
  flex-shrink: 0;
}

.qn-yt-player-wrap iframe,
#qnYtPlayer {
  width: 100%;
  height: 100%;
  display: block;
}

/* 自前UIはプレイヤーの外(下)(規約) */
.qn-yt-custom {
  margin-top: 24px;
  max-width: 1280px;
  width: 100%;
}

.qn-yt-fetched-title {
  margin: 0 0 10px;
  min-height: 24px;
  font-family: var(--font-display, 'Instrument Sans'), sans-serif;
  font-size: var(--fs-heading);
  font-weight: 600;
  color: var(--text-bright);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* 3分割シークバー: 本体のシークバーと同見た目(角丸なし・#111帯・再生済み=テーマ色・マーカー=縦線+上に番号/メモ)。波形は使わない(YouTubeの音声・映像データに触れない)。土台はstyle-core.cssの.vbar/.vfillを流用 */
.qn-yt-seek {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-top: 24px;
  padding-left: var(--qn-yt-tpad, 46px); /* 行左の開始時刻の置き場 */
  margin: 4px 0 16px;
}

.qn-yt-track.vbar {
  position: relative;
  flex: none;
  height: 20px;
  background: var(--bg-111111);
  border: none;
  border-radius: 0;
  overflow: visible;
  cursor: pointer;
  touch-action: none;
}

.qn-yt-track.vbar:hover { border-color: transparent; }

/* バーが細くなった分、押せる範囲を上下に少し広げる(見た目は変えない。行の間隔24pxの内側) */
.qn-yt-track.vbar::after { content: ""; position: absolute; left: 0; right: 0; top: -6px; bottom: -6px; }
.qn-yt-fill.vfill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  height: auto;
  width: 0;
  background: var(--accent-primary);
  opacity: 0.9;
  border-radius: 0;
  pointer-events: none;
}

.qn-yt-range {
  position: absolute;
  top: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 2;
}
.qn-yt-range-bg,
.qn-yt-range-on {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
}
.qn-yt-range-bg { width: 100%; opacity: 0.22; }
.qn-yt-range-on { width: 0; opacity: 0.95; }

.qn-yt-head {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  margin-left: -1px;
  background: var(--text-pure-white, var(--bg-ffffff));
  left: 0;
  pointer-events: none;
  z-index: 3;
}

.qn-yt-loop-range {
  position: absolute;
  top: 0;
  bottom: 0;
  background: color-mix(in srgb, var(--accent-primary) 26%, transparent);
  box-shadow: inset 0 3px 0 var(--accent-primary), inset 0 -3px 0 var(--accent-primary);
  border-radius: 0;
  pointer-events: none;
  z-index: 1;
}
.qn-yt-loop-range.is-on {
  background: color-mix(in srgb, var(--accent-primary) 42%, transparent);
}

.qn-yt-loop-range[hidden] {
  display: none;
}

/* 行の開始時刻(PLの#vbarRows .vbar-timeと同じ) */
.qn-yt-track-time {
  position: absolute; right: calc(100% + 8px); top: 50%; transform: translateY(-50%);
  font-size: var(--fs-micro, 10px); font-weight: 600; color: var(--icon-muted); font-variant-numeric: tabular-nums;
  white-space: nowrap; cursor: pointer; user-select: none; -webkit-touch-callout: none;
}
.qn-yt-track.is-current .qn-yt-track-time { color: var(--text-bright); }

.qn-yt-marker-layer {
  position: absolute;
  inset: 0;
  left: var(--qn-yt-tpad, 46px);
  pointer-events: none;
}

.qn-yt-marker {
  position: absolute;
  top: 0;
  width: 6px;
  transform: translateX(-50%);
  background: transparent;
  cursor: ew-resize;
  pointer-events: auto;
  touch-action: none;
  z-index: 2;
}

.qn-yt-marker::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  background: var(--marker-color, var(--accent-primary));
}

.qn-yt-marker::after {
  content: "";
  position: absolute;
  top: -4px;
  bottom: -4px;
  left: -9px;
  right: -9px;
}

.qn-yt-marker:hover::before { background-color: var(--accent-hover-1); }

.qn-yt-marker-label {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 3px;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

.qn-yt-marker-label .n {
  display: block;
  font-family: var(--font-display, 'Instrument Sans'), sans-serif;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  color: var(--marker-color, var(--accent-primary));
}

.qn-yt-marker-label .memo {
  position: absolute;
  left: 100%;
  top: 4px;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-b0b0b8);
}

.qn-yt-marker.flip .qn-yt-marker-label .memo {
  left: auto;
  right: 100%;
  margin-left: 0;
  margin-right: 6px;
}

.qn-yt-marker.dragging::before { background-color: var(--accent-hover-1); }


.qn-yt-hint {
  margin: 4px 0 0;
  font-size: var(--fs-small);
  color: var(--icon-muted);
}


/* 将来の広告枠: プレイヤーから離れた位置(今は高さ0・広告コードなし) */
.qn-yt-ad-slot {
  min-height: 0;
}

/* ---------- SP幅: 縦積み ---------- */
@media screen and (max-width: 900px) {
  .qn-yt {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
  }

  /* SP: プレイヤーは左右・上いっぱい(ヘッダー線の直下)。自前UIだけ左右16px */
  .qn-yt-stage {
    order: 1;
    overflow: visible;
    padding: 0 0 8px;
    flex-shrink: 0;
    container-type: inline-size;
  }

  /* プレイヤー枠は高さを明示して滑らかに縮む(上端固定=上基準で縮小)。閉じ=幅÷縦横比、パネル開=max(200px,30dvh) */
  .qn-yt-player-wrap {
    aspect-ratio: auto;
    height: calc(100cqw / var(--qn-yt-ar, 1.7778));
    transition: height 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  .qn-yt-custom {
    margin-top: 16px;
    padding: 0 16px;
    box-sizing: border-box;
  }

  .qn-yt-stage-fab { margin-right: 16px; }


  /* SP幅: パネル開時もプレイヤーを上部に小さく残す(規約: 覆わない・隠さない・最低200x200px)。パネルはその下の残り領域 */
  .qn-yt-panel {
    order: 2;
    border-right: none;
    border-top: 1px solid var(--border-subtle);
    flex: 1;
    min-height: 0;
  }

  .qn-yt[data-panel="none"] .qn-yt-panel {
    display: none;
  }

  .qn-yt-panel-scroll {
    overflow-y: auto;
  }

  .qn-yt:not([data-panel="none"]) {
    overflow: hidden;
  }

  .qn-yt:not([data-panel="none"]) .qn-yt-stage {
    padding: 0;
    overflow: hidden;
  }

  .qn-yt:not([data-panel="none"]) .qn-yt-custom{
    display: none;
  }

  .qn-yt:not([data-panel="none"]):not(.qn-yt-closing) .qn-yt-player-wrap {
    height: max(200px, 30dvh);
    min-height: 200px;
  }

  /* シート: 開く=下からスライド、閉じる=下へスライド。開いている目印=上端アクセント線+角丸+影+つまみ */
  .qn-yt-panel {
    position: relative;
    border-top: 2px solid var(--accent-primary);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.55);
    animation: qn-sheet-up 280ms cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
    z-index: 1;
  }
  .qn-yt.qn-yt-closing .qn-yt-panel {
    animation: qn-sheet-down 230ms cubic-bezier(0.4, 0, 1, 1) both;
    pointer-events: none;
  }
  .qn-yt-panel .qn-yt-panel-header { position: relative; padding-top: 22px; padding-right: 64px; touch-action: none; }
  .qn-yt .qn-yt-bar { position: relative; z-index: 3; background: var(--bg-0a0a0c); }
  .qn-yt-panel .qn-yt-panel-header::before {
    content: "";
    position: absolute; top: 8px; left: 50%;
    width: 40px; height: 4px; margin-left: -20px;
    border-radius: 2px; background: var(--accent-primary); opacity: 0.7;
  }
  .qn-yt-panel .qn-sheet-close { display: flex; }

  .qn-yt-panel-header {
    font-size: var(--fs-heading);
    padding: 12px 16px;
  }

  .qn-yt-sec {
    padding-left: 16px;
  }


  .qn-yt-btn {
    height: 34px;
  }

  .qn-yt-btn.mini {
    height: 30px;
  }

  .qn-yt-btn.ab {
    width: 34px;
  }

  .qn-yt-track.vbar {
    height: 18px;
  }
}

/* ---------- Library/Markers: 行ベースはstyle-playlist.css(.playlistItem)/style-markers.css(.pinItem)を流用。本体の「#pcV2PanelBody …」限定ルールだけ.qn-yt用に再掲 ---------- */
.qn-yt-panel { position: relative; }

.qn-yt-sec-library,
.qn-yt-sec-markers { padding: 0; }
.qn-yt-sec-library .qn-yt-input-block { padding: 16px 16px 12px 20px; }
.qn-yt-sec-library .qn-yt-empty,
.qn-yt-sec-markers .qn-yt-empty { margin: 16px 20px; }
.qn-yt[data-panel="library"] .qn-yt-panel-scroll,
.qn-yt[data-panel="markers"] .qn-yt-panel-scroll { padding-bottom: 140px; }

.qn-yt-libbox, .qn-yt-pinbox { display: flex; flex-direction: column; }
.qn-yt-libbox .playlistItem.drop-before { box-shadow: inset 0 2px 0 var(--accent-primary); }
.qn-yt-libbox .playlistItem.drop-after { box-shadow: inset 0 -2px 0 var(--accent-primary); }

.qn-yt-libbox .playlistItem.playing .playlist-title { color: var(--accent-primary); }

.qn-yt-fab {
  position: absolute; right: 20px; bottom: 20px; z-index: 5;
  display: none; flex-direction: column; align-items: flex-end; gap: 10px;
  pointer-events: none;
}
.qn-yt[data-panel="library"] .qn-yt-fab,
.qn-yt[data-panel="markers"] .qn-yt-fab,
.qn-yt[data-panel="text"] .qn-yt-fab { display: flex; }
/* Text: FABはFullだけ(PLAYERのTextタブと同じ) */
.qn-yt-fab-text { display: none; }
.qn-yt[data-panel="text"] .qn-yt-fab-text { display: flex; }
.qn-yt[data-panel="text"] .qn-yt-fab > .panel-edit-btn { display: none; }
.qn-yt-sec-text { padding-bottom: 84px; }
.qn-yt-text-for { margin: 0 0 8px; font-size: var(--fs-small); color: var(--icon-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qn-yt-text-for:empty { display: none; }
.qn-yt-sec-text .note-textarea { min-height: 320px; }
.qn-yt-sec-text .note-textarea:disabled { opacity: 0.5; }
.qn-yt-fab-add { display: none; flex-direction: column; align-items: flex-end; gap: 10px; }
.qn-yt[data-panel="markers"]:not([data-edit]) .qn-yt-fab-add { display: flex; }
.qn-yt[data-edit] .panel-fab-cancel-btn { display: flex; }
/* FOLDER: Libraryパネルの通常時のみ。MOVE: Library EDIT時のみ(選択した動画をフォルダへ) */
.qn-yt-fab-folder { display: none; }
.qn-yt[data-panel="library"]:not([data-edit]) .qn-yt-fab-folder { display: flex; }
.qn-yt[data-edit="library"] .panel-fab-move-btn { display: flex; }
.qn-yt .playlistFolderHeader.drop-before { box-shadow: inset 0 2px 0 var(--accent-primary); }
.qn-yt .playlistFolderHeader.drop-after { box-shadow: inset 0 -2px 0 var(--accent-primary); }

.qn-yt-chapter { padding: 16px 16px 8px 20px; }
.qn-yt-chapter-box { margin-top: 10px; }
.qn-yt-chapter-box[hidden] { display: none; }
.qn-yt-chapter-text {
  display: block;
  width: 100%;
  height: auto;
  min-height: 110px;
  padding: 8px 10px;
  box-sizing: border-box;
  resize: vertical;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
.qn-yt-chapter-text::placeholder { color: rgba(var(--ov), 0.28); }
.qn-yt-chapter .qn-yt-hint { margin: 8px 0; }


.qn-yt .playlist-thumb.qn-yt-thumb {
  width: 64px;
  height: 36px;
  border-radius: 0;
}
.qn-yt .playlist-thumb.qn-yt-thumb img {
  display: block;
  width: 64px;
  height: 36px;
  object-fit: contain;
}
.qn-yt .playlist-thumb.qn-yt-thumb { position: relative; }
.qn-yt .playlist-thumb.qn-yt-thumb img { position: absolute; inset: 0; opacity: 0; }
.qn-yt .playlist-thumb.qn-yt-thumb.has-img img { opacity: 1; }
.qn-yt .playlist-thumb.qn-yt-thumb.has-img svg { display: none; }

.qn-yt-legal {
  margin: 28px 0 88px;
  padding-left: 16px;
  padding-right: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle, rgba(var(--ov), 0.08));
  font-size: 11px;
  line-height: 1.6;
  color: var(--icon-muted);
}
.qn-yt-legal p { margin: 0 0 6px; }
.qn-yt-legal a { color: var(--accent-primary); text-decoration: underline; }

.qn-yt-kbd .qn-menu-section { border-bottom: none; padding-bottom: 0; }
.qn-yt-kbd .qn-menu-section-label { display: none; }
.qn-yt-kbd .qn-shortcut-table { width: 100%; border-collapse: collapse; }
.qn-yt-kbd-note {
  margin: 12px 0 0;
  font-size: var(--fs-small);
  color: var(--text-dim, rgba(var(--ov), 0.45));
  line-height: 1.6;
}

/* コントロールバー: PLAYER下段バーと同デザイン。PC=ステージ下端に吸着(左パネル側へ伸ばさない)、SP=アイコンバー直上固定・横スクロール */
.qn-yt-bar {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 24px;
  background: var(--bg-base, var(--bg-0a0a0c));
  border-top: 1px solid var(--border-subtle);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.qn-yt-bar::-webkit-scrollbar { display: none; }

.qn-yt-bgroup { display: flex; align-items: center; gap: 0; flex-shrink: 0; }
.qn-yt-bdiv { width: 1px; height: 24px; background: var(--border-subtle); margin: 0 10px; flex-shrink: 0; }
.qn-yt-bspacer { flex: 1 1 0; min-width: 8px; }

.qn-yt-bbtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  flex: 0 0 auto;
  padding: 8px 7px;
  cursor: pointer;
  color: var(--icon-muted);
  background: none;
  border: none;
  font-family: var(--font-display, 'Instrument Sans'), sans-serif;
  position: relative;
  transition: transform var(--dur-press, 100ms) var(--ease-snap, ease);
}
.qn-yt-bbtn svg,
.qn-yt-bstep-mid svg {
  width: 20px;
  height: 20px;
  margin: 6px auto;
  display: block;
  fill: currentColor;
}
.qn-yt-bbtn.center { color: var(--accent-primary); }
.qn-yt-bbtn.center svg { width: 32px; height: 32px; margin: 0; }
.qn-yt-bbtn span,
.qn-yt-bstep-mid span {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.qn-yt-bbtn:active { transform: scale(0.94); }
.qn-yt-bbtn.is-active,
.qn-yt-bbtn.is-active:hover { color: var(--accent-primary); }
.qn-yt-bbtn:disabled { opacity: 0.35; pointer-events: none; }
@media (hover: hover) and (pointer: fine) {
  .qn-yt-bbtn:hover { color: var(--text-bright); }
  .qn-yt-bbtn.center:hover { color: var(--accent-primary); }
}


.qn-yt-bstep { display: flex; align-items: center; gap: 0; flex-shrink: 0; }
.qn-yt-bstep-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 2px;
  color: var(--accent-primary);
  font-family: var(--font-display, 'Instrument Sans'), sans-serif;
}
.qn-yt-bstep-mid b { font-weight: 700; }
.qn-yt-bstep-btn {
  width: 24px;
  height: 32px;
  padding: 0;
  background: none;
  border: none;
  color: var(--icon-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: transform var(--dur-press, 100ms) var(--ease-snap, ease);
}
.qn-yt-bstep-btn:active { transform: scale(0.88); }
@media (hover: hover) and (pointer: fine) {
  .qn-yt-bstep-btn:hover { color: var(--text-bright); }
}

@media screen and (max-width: 900px) {
  .qn-yt-bar {
    order: 4;
    grid-column: auto;
    grid-row: auto;
    position: sticky;
    bottom: 0;
    z-index: 2;
    margin-top: auto;
    flex-shrink: 0;
    padding: 0 25px;
    border-bottom: 1px solid var(--border-subtle);
  }
  .qn-yt-bbtn { padding: 10px 10px; }
  .qn-yt-bbtn svg, .qn-yt-bstep-mid svg { width: 26px; height: 26px; margin: 6px auto; }
  .qn-yt-bbtn.center svg { width: 38px; height: 38px; margin: 0; }
  .qn-yt-bbtn span, .qn-yt-bstep-mid span { font-size: 11px; }
  .qn-yt-bstep-btn { width: 30px; height: 44px; font-size: 22px; }
  .qn-yt-bspacer { flex: 0 0 12px; }
  .qn-yt:not([data-panel="none"]) .qn-yt-bar { display: none; }
}

/* ---------- シークバー1タップのポップアップ(A/B/+Marker): body直下fixed、押した位置の真上(収まらなければ真下) ---------- */
.qn-yt-seekpop {
  position: fixed;
  z-index: 330;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: 8px 8px 6px;
  background: var(--bg-101013);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-popup, 12px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.6);
  font-family: var(--font-display, 'Instrument Sans'), sans-serif;
}
.qn-yt-seekpop[hidden] { display: none; }
.qn-yt-seekpop-time {
  text-align: center;
  font-size: var(--fs-small);
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text-bright);
  font-variant-numeric: tabular-nums;
}
.qn-yt-seekpop-row { display: flex; gap: 2px; }
.qn-yt-seekpop-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  min-width: 52px;
  padding: 6px 8px;
  background: none;
  border: none;
  color: var(--icon-muted);
  cursor: pointer;
  font-family: inherit;
  transition: transform var(--dur-press, 100ms) var(--ease-snap, ease);
}
.qn-yt-seekpop-btn b { font-size: 20px; line-height: 26px; font-weight: 700; color: var(--accent-primary); }
.qn-yt-seekpop-btn span { font-size: 9px; font-weight: 600; letter-spacing: 0.3px; }
.qn-yt-seekpop-btn:active { transform: scale(0.94); }
@media (hover: hover) and (pointer: fine) {
  .qn-yt-seekpop-btn:hover { color: var(--text-bright); }
}
@media screen and (max-width: 900px) {
  .qn-yt-seekpop-btn { min-width: 54px; padding: 8px 6px; }
  .qn-yt-seekpop-btn b { font-size: 24px; line-height: 30px; }
  .qn-yt-seekpop-btn span { font-size: 11px; }
}

/* ---------- PC幅パネル格納: パネル(375px)が左へ縮む。プレイヤーは格納前幅(JSが--qn-yt-player-wに入れる)。SP幅では使わない ---------- */
.qn-yt { transition: grid-template-columns 220ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.qn-yt.qn-yt-collapsed { grid-template-columns: 0 1fr; }
.qn-yt-panel { overflow: hidden; }
.qn-yt-panel > .qn-yt-panel-header,
.qn-yt-panel > .qn-yt-panel-scroll { min-width: 374px; }
.qn-yt.qn-yt-collapsed .qn-yt-panel {
  border-right-color: transparent;
  visibility: hidden;
  transition: visibility 0s linear 220ms;
}
.qn-yt.qn-yt-collapsed .qn-yt-player-wrap {
  width: var(--qn-yt-player-w, 100%);
  max-width: var(--qn-yt-player-w, 1280px);
}
@media screen and (max-width: 900px) {
  .qn-yt { transition: none; }
}

/* PC幅: プレイヤーを縦いっぱいに/シークバー3本まで1画面。ステージ=プレイヤー領域(余り高さ)+タイトル+シークバー3本。container queriesで収まる最大の16:9を計算。最小は規約どおり200px(それ以下の窓はステージがスクロール)。SPは従来(幅いっぱい16:9・縦スクロール) */
@media screen and (min-width: 901px) {
  .qn-yt-stage { padding: 16px 24px 12px; }
  .qn-yt-player-wrap {
    flex: 1 1 0;
    width: 100%;
    max-width: none;
    aspect-ratio: auto;
    min-height: 200px;
    background: none;
    display: flex;
    align-items: center;
    justify-content: center;
    container-type: size;
  }
  .qn-yt-player-wrap iframe,
  #qnYtPlayer {
    width: min(100cqw, calc(100cqh * var(--qn-yt-ar, 1.7778)));
    height: min(100cqh, calc(100cqw / var(--qn-yt-ar, 1.7778)));
    background: #000;
  }
  .qn-yt-custom { margin-top: 12px; max-width: none; flex-shrink: 0; }
  .qn-yt-fetched-title { margin-bottom: 4px; }
  .qn-yt-seek { margin-bottom: 4px; }
}

.qn-yt-fetched-title:empty { display: none; }

/* ---------- A/B点の強調 ---------- */
/* A/Bはマーカーではない独立点(.qn-yt-abpt)。マーカーより太い線+旗 */
.qn-yt-abpt { z-index: 3; }
.qn-yt-abpt::before { width: 4px; background: var(--accent-primary); }
.qn-yt-marker-ab {
  position: absolute;
  top: 0;
  left: 50%;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  box-sizing: border-box;
  background: var(--accent-primary);
  color: var(--sidebar-on-accent, #fff);
  font-family: var(--font-display, 'Instrument Sans'), sans-serif;
  font-size: 11px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
  pointer-events: none;
  z-index: 2;
}
.qn-yt-abpt.is-a .qn-yt-marker-ab { transform: translateX(2px); }
.qn-yt-abpt.is-b .qn-yt-marker-ab { transform: translateX(calc(-100% - 2px)); }

.qn-yt-bbtn.has-point { color: var(--accent-primary); }

.qn-yt-seekpop-btn[hidden] { display: none; }
.qn-yt-seekpop-del b { color: var(--icon-muted); }
.qn-yt-seekpop-btn b svg { color: var(--icon-muted); width: 20px; height: 26px; fill: currentColor; display: block; }
.qn-yt-seekpop-btn b { display: flex; align-items: center; justify-content: center; height: 26px; }
@media screen and (max-width: 900px) {
  .qn-yt-seekpop-btn b { height: 30px; }
  .qn-yt-seekpop-btn b svg { height: 30px; }
}
.qn-yt-seekpop-dot { display: block; width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(var(--ov),0.35); }
.qn-yt-seekpop-del.is-armed, .qn-yt-seekpop-del.is-armed b { color: var(--danger, #ff5a5a); }

@media screen and (min-width: 901px) {
  .qn-yt-bar { padding: 10px 12px; }
  .qn-yt-bbtn { padding: 8px 4px; }
  .qn-yt-bdiv { margin: 0 6px; }
}

/* ---------- PLAYER側 A/B ---------- */
.vbar-ab-pt {
  position: absolute;
  top: 0; bottom: 0;
  width: 6px;
  margin-left: -3px;
  z-index: 6;
  cursor: ew-resize;
  touch-action: none;
}
.vbar-ab-pt::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: 1px;
  width: 4px;
  background: var(--accent-primary);
}
.vbar-ab-pt::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: -8px; right: -8px;
}
.vbar-ab-pt .vbar-ab-flag {
  position: absolute;
  bottom: 3px;
  left: 50%;
  z-index: 1;
  padding: 2px 4px;
  border-radius: 3px;
  background: var(--accent-primary);
  color: var(--fg-0b0b0d);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
  transform: translateX(3px);
}
.vbar-ab-pt.is-b .vbar-ab-flag { transform: translateX(calc(-100% - 3px)); }
#pcV2BottomBar .ab-set-btn.has-point { color: var(--accent-primary); }
.qn-yt-seekpop-btn.is-set { background: color-mix(in srgb, var(--accent-primary) 20%, transparent); border-radius: 0; }
/* ON表示: アイコンのSVG(Loop等)は上のルールで灰色固定なので、is-setの時はアクセント色にする(PLAYERのシークバーポップアップのLoop ON) */
.qn-yt-seekpop-btn.is-set b svg, .qn-yt-seekpop-btn.is-set span { color: var(--accent-primary); }

/* ---------- ポップアップColor: ラベル入力+プリセット+色(v3.9.0・PLAYER/YouTube共通) ---------- */
.qn-style-pop {
  z-index: 340;
  box-sizing: border-box;
  width: min(320px, calc(100vw - 16px));
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: var(--bg-101013);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-popup, 12px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.6);
}
.qn-style-input {
  box-sizing: border-box;
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: rgba(var(--ov), 0.06);
  color: inherit;
  font: inherit;
  font-size: 14px;
}
.qn-style-input:focus { outline: none; border-color: var(--accent-primary); }
.qn-style-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.qn-style-swatches { display: flex; flex-wrap: wrap; gap: 6px; }

.qn-yt-loop-pre {
  position: absolute;
  top: 0;
  bottom: 0;
  background: color-mix(in srgb, var(--accent-primary) 14%, transparent);
  border-top: 2px dashed color-mix(in srgb, var(--accent-primary) 60%, transparent);
  border-bottom: 2px dashed color-mix(in srgb, var(--accent-primary) 60%, transparent);
  pointer-events: none;
  z-index: 1;
}
.qn-yt-loop-pre[hidden] { display: none; }

.qn-yt.qn-yt-collapsed .qn-yt-player-wrap { margin-left: auto; margin-right: auto; }

.qn-yt-panel-scroll, .qn-yt-stage, .qn-yt .qn-yt-bar {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
.qn-yt-panel-scroll::-webkit-scrollbar, .qn-yt-stage::-webkit-scrollbar { width: 8px; }
.qn-yt-panel-scroll::-webkit-scrollbar-track, .qn-yt-stage::-webkit-scrollbar-track { background: transparent; }
.qn-yt-panel-scroll::-webkit-scrollbar-thumb, .qn-yt-stage::-webkit-scrollbar-thumb {
  background: rgba(var(--ov), 0.14);
  border-radius: 4px;
}
.qn-yt-panel-scroll::-webkit-scrollbar-thumb:hover, .qn-yt-stage::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--ov), 0.24);
}

/* PLAYER下部バー(#pcV2BottomBar)とYouTube下段バー(.qn-yt-bar)の寸法を1仕様に(Speed/Keyトグルのみ例外)。最後に読まれるので個別指定を上書き。PC: バーpadding 10px 12px/ボタン 8px 4px/アイコン20px(中央32px)/ラベル9px/区切り余白6px。SP: ボタンpadding 10px/アイコン26px(中央38px)/ラベル11px */
@media screen and (min-width: 901px) {
  #pcV2BottomBar, .qn-yt-bar { box-sizing: border-box; min-height: 80px; padding: 10px 12px; gap: 4px; }
  #pcV2BottomBar .tripleNavBtn-third,
  #pcV2BottomBar .loopbtn,
  .qn-yt-bbtn { padding: 8px 4px; min-height: 59px; box-sizing: border-box; }
  #pcV2BottomBar .tripleNavBtn-third:not(.tripleNavBtn-center) svg,
  #pcV2BottomBar .loopbtn svg { width: 20px; height: 20px; margin: 6px auto; }
  #pcV2BottomBar .tripleNavBtn-center svg { width: 32px; height: 32px; margin: 0; }
  #pcV2BottomBar .top-controls-btn-label { font-size: 10px; }
  #pcV2BottomBar .pcv2-ctrl-divider, .qn-yt-bdiv { margin: 0 6px; }
}
@media screen and (max-width: 900px) {
  #pcV2BottomBar .tripleNavBtn-third,
  #pcV2BottomBar .loopbtn,
  .qn-yt-bbtn { padding: 10px 10px; min-height: 0; }
  #pcV2BottomBar .tripleNavBtn-third:not(.tripleNavBtn-center) svg,
  #pcV2BottomBar .loopbtn svg { width: 26px; height: 26px; margin: 6px auto; }
  #pcV2BottomBar .tripleNavBtn-center svg { width: 38px; height: 38px; margin: 0; }
  #pcV2BottomBar .top-controls-btn-label { font-size: 11px; }
}


/* PLAYER下部バーのラベル・Speed/Keyステッパーもyoutube下段バーと同表示に(PLは大文字化+行高9pxで幅広・1px低かった) */
#pcV2BottomBar .top-controls-btn-label {
  text-transform: none;
  line-height: normal;
  white-space: nowrap;
}

#pcV2BottomBar #topControls.top-controls { gap: 4px; }

.track-backup-group-label {
  padding: 8px 4px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: none;
  color: var(--icon-muted);
}
.track-backup-group-label:not(:first-child) { margin-top: 6px; border-top: 1px solid var(--border-subtle); }

/* ステージ右下のMARKERボタン(PLの#pcV2WaveFabRowと同位置。プレイヤーの外・通常フローで重ねない) */
.qn-yt-stage-fab {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-top: 12px;
}
/* ステージ帯の1行: [設定帯] [URL欄+Save] [Marker]。入力欄は他と同じ角丸(--radius-field)、ボタンは同じ高さ(40px)・ピル型 */
.qn-yt-urlgrp { display: flex; align-items: center; gap: 8px; flex: 1 1 280px; min-width: 220px; max-width: 520px; margin-right: auto; }
.qn-yt-stage-url { flex: 1 1 auto; min-width: 0; width: auto; height: 40px; }
.qn-yt-stage-fab .panel-fab-btn { height: 40px; padding: 0 18px; }
.qn-yt-row > .qn-yt-btn, .qn-yt-urlgrp > .qn-yt-btn { height: 38px; }
/* シークバーの行数が窓(Rows)より多い時: 窓の高さはJS(layoutSeek)。縦スクロール・行頭にスナップ。タッチは縦スクロールを許可(横なぞりはシーク) */
.qn-yt-seek.is-scroll { box-sizing: border-box; margin-left: -14px; margin-right: -14px; padding-left: calc(var(--qn-yt-tpad, 46px) + 14px); padding-right: 14px; /* 端のマーカー番号が欠けないよう左右に余白 */ overflow-y: auto; overflow-x: hidden; scroll-snap-type: y proximity; overscroll-behavior: contain; scrollbar-width: thin; }
.qn-yt-seek.is-scroll .qn-yt-marker-layer { left: calc(var(--qn-yt-tpad, 46px) + 14px); right: 14px; } /* paddingぶん内側=バーと同じ幅(マーカー位置は幅の%) */
.qn-yt-seek.is-scroll .qn-yt-track.vbar { scroll-snap-align: start; scroll-margin-top: 28px; touch-action: pan-y; }
/* スマホ: 右側に縦スクロール専用の余白(バーより外。ここをなぞると必ずスクロール) */
@media screen and (max-width: 900px) { .qn-yt-seek.is-scroll { padding-right: 34px; margin-right: -20px; } .qn-yt-seek.is-scroll .qn-yt-marker-layer { right: 34px; } }
.qn-yt-noseek .qn-yt-seek { display: none; }
@media screen and (max-width: 900px) {
  .qn-yt:not([data-panel="none"]) .qn-yt-stage-fab { display: none; }
}

/* Playlists パネル: 取得した再生リストの一覧。行は.playlistItemを流用(つかみの代わりに選択チェック) */
.qn-yt-sec-playlists { padding: 0; }
.qn-yt-sec-playlists .qn-yt-input-block { padding: 16px 16px 12px 20px; }
.qn-yt-linkbtn {
  background: none; border: none; padding: 0; margin-top: 4px;
  color: var(--icon-muted); font-family: inherit; font-size: var(--fs-small); cursor: pointer;
}
.qn-yt-linkbtn:hover { color: var(--text-bright); }
.qn-yt-plkey[hidden] { display: none; }
.qn-yt-plhead {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px 8px 20px; border-top: 1px solid var(--border-subtle); border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-hover-subtle);
}
.qn-yt-plhead[hidden] { display: none; }
.qn-yt-pltitle { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--text-bright); }
.qn-yt-pllist .playlistItem.qn-yt-plrow { grid-template-columns: auto auto 1fr; cursor: pointer; }
.qn-yt-pllist .playlistItem.in-lib { opacity: 0.55; }
.qn-yt-pllist .playlistItem button.qn-yt-plcheck {
  width: 22px; height: 22px; min-width: 22px; border-radius: 50%; box-sizing: border-box; padding: 0;
  border: 1.5px solid var(--border-strong); background: none; color: var(--icon-muted);
  font-size: 13px; line-height: 1; cursor: pointer; flex-shrink: 0; margin-left: 4px;
}
.qn-yt-pllist .playlistItem button.qn-yt-plcheck:hover:not(:disabled):not(.on) { border-color: var(--accent-primary); background: none; }
.qn-yt-pllist .playlistItem button.qn-yt-plcheck.on { background: var(--accent-primary); border-color: var(--accent-primary); }
.qn-yt-pllist .playlistItem button.qn-yt-plcheck:disabled { cursor: default; border-color: transparent; color: var(--accent-primary); }
.qn-yt-plmine { margin: 0 0 4px; }
.qn-yt-pllist .playlistItem.qn-yt-pllistrow { grid-template-columns: auto 1fr auto; }
.qn-yt-plicon { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; color: var(--icon-muted); }
.qn-yt-plicon svg { width: 22px; height: 22px; fill: currentColor; }


/* Libraryが0件の間の案内: 手順1(URL貼り付け)→2(Save)。URL入力欄を脈動させ、入力済みなら手順2とSaveを強調 */
.qn-yt-hint { display: none; margin: 0 0 12px; padding: 0; list-style: none; flex-direction: column; gap: 8px; }
.qn-yt-sec-library.is-empty .qn-yt-hint { display: flex; }
.qn-yt-hint li { display: flex; align-items: center; gap: 10px; font-size: var(--fs-body); color: var(--icon-muted); }
.qn-yt-hint li b {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg-1c1c24); border: 1px solid var(--border-subtle);
  font-size: var(--fs-small); font-weight: 700; color: var(--text-bright);
}
.qn-yt-sec-library.is-empty .qn-yt-hint-1 { color: var(--text-bright); }
.qn-yt-sec-library.is-empty .qn-yt-hint-1 b { background: var(--accent-primary); border-color: var(--accent-primary); color: var(--text-pure-white); }
.qn-yt-sec-library.is-empty.has-url .qn-yt-hint-1 { color: var(--icon-muted); }
.qn-yt-sec-library.is-empty.has-url .qn-yt-hint-1 b { background: var(--bg-1c1c24); border-color: var(--border-subtle); color: var(--text-bright); }
.qn-yt-sec-library.is-empty.has-url .qn-yt-hint-2 { color: var(--text-bright); }
.qn-yt-sec-library.is-empty.has-url .qn-yt-hint-2 b { background: var(--accent-primary); border-color: var(--accent-primary); color: var(--text-pure-white); }
@keyframes qn-yt-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-primary) 0%, transparent); }
  50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-primary) 35%, transparent); }
}
.qn-yt-sec-library.is-empty:not(.has-url) .qn-yt-input[data-yt="urlInput"]:not(:focus) { border-color: var(--accent-primary); animation: qn-yt-pulse 1.8s ease-in-out infinite; }
.qn-yt-sec-library.is-empty.has-url .qn-yt-btn.primary[data-yt="saveBtn"] { animation: qn-yt-pulse 1.8s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  .qn-yt-sec-library.is-empty .qn-yt-input[data-yt="urlInput"], .qn-yt-sec-library.is-empty .qn-yt-btn.primary[data-yt="saveBtn"] { animation: none !important; }
}

.qn-yt-marker.is-skip { opacity: 0.75; }

/* ---------- SPメインドック: PLAYERの#pcV2SpDockと同寸法。ボタンは共通の.pcv2-dock-btn。PC幅は非表示。Moreで下段バーを開閉(.qn-yt-more-open)。バーとドックは.qn-yt-controlsに入れて1つのstickyにする(PC幅はdisplay:contentsでgridにそのまま参加) ---------- */
.qn-yt-controls { display: contents; }
.qn-yt-dock { display: none; }
@media screen and (max-width: 900px) {
  .qn-yt-controls {
    display: flex;
    flex-direction: column;
    order: 4;
    position: sticky;
    bottom: 0;
    z-index: 3;
    margin-top: auto;
    flex-shrink: 0;
  }
  .qn-yt-controls .qn-yt-bar { position: static; margin-top: 0; order: 0; }
  .qn-yt-controls .qn-yt-dock { order: 1; }
  .qn-yt-dock {
    display: grid;
    grid-template-columns: 1fr 1.2fr 1.7fr 1.2fr 1fr 0.9fr;
    align-items: center;
    background: var(--bg-0a0a0c);
    border-top: 1px solid var(--border-subtle);
    padding: 6px 6px 4px;
    gap: 2px;
  }
  .qn-yt:not(.qn-yt-more-open) .qn-yt-bar { display: none; }
  .qn-yt:not(.qn-yt-more-open) .qn-yt-stage-fab { display: none; } /* URL欄+設定帯もMoreの中(閉じるとシークバーが広く使える) */
  .qn-yt:not([data-panel="none"]) .qn-yt-dock { display: none; }
  .qn-yt-dock .pcv2-dock-btn { position: relative; }
  .qn-yt-dock [data-dock]::after {
    content: ""; position: absolute; right: 3px; bottom: 3px; width: 0; height: 0;
    border-style: solid; border-width: 0 0 6px 6px; border-color: transparent transparent var(--icon-muted) transparent;
    opacity: 0.7; pointer-events: none;
  }
  .qn-yt-dock .pcv2-dock-play::after, .qn-yt-dock .pcv2-dock-more::after { display: none; }
  .qn-yt[data-panel="none"] .qn-yt-stage { flex: 1 0 auto; } /* 余った高さはステージに回し、帯(margin-top:auto)を下段バーの直上へ。パネルを開いている間は対象外(パネルが動画の下辺まで上がる) */
  /* ステージ帯(SP): 設定帯 / URL欄+Save / Marker を同じ左右端で縦に並べる(右寄せの単独ボタンを作らない) */
  .qn-yt-stage-fab { display: grid; grid-template-columns: 1fr; gap: 8px; margin: 0; padding: 8px 16px 8px; background: var(--bg-base, var(--bg-0a0a0c)); order: -1; } /* controls(sticky)の先頭=下段バー/ドックの直上に固定 */ /* margin-top:auto = 余白は帯の上(シークバー側)に回し、帯は下段バーの直上に固定 */
  .qn-yt-urlgrp { max-width: none; min-width: 0; margin-right: 0; }
  .qn-yt-stage-fab .panel-fab-btn { padding: 0 16px; font-size: 13px; }
  .qn-yt-stage-fab > [data-yt="stageAddMarker"] { display: none; } /* SPはドックにMarkerがあるので重複させない */
}

/* ---------- PC幅: 下段バーをPLAYER(v3.59.0 #pcV2BottomBar)に寄せてゆったり(クリック領域を拡大、中央寄せ、グループ間を広げる)。寸法はウィンドウ幅に応じて縮み、広い窓でPLAYERと同じ(ボタン最小幅68/左右16/区切り余白28)になる ---------- */
@media screen and (min-width: 901px) {
  .qn-yt .qn-yt-bar { padding: 12px 24px; }
  /* auto marginなら、幅が足りない時は左端から横スクロール(左が切れない) */
  .qn-yt .qn-yt-bar > :first-child { margin-left: auto; }
  .qn-yt .qn-yt-bar > :last-child { margin-right: auto; }
  .qn-yt .qn-yt-bbtn { padding: 10px clamp(3px, 0.4vw, 16px); min-width: clamp(40px, 3.2vw, 68px); min-height: 64px; border-radius: 10px; }
  .qn-yt .qn-yt-bbtn.center { min-width: clamp(50px, 4vw, 76px); }
  .qn-yt .qn-yt-bbtn:not(.center) svg { width: 22px; height: 22px; }
  .qn-yt .qn-yt-bbtn:hover { background: rgba(var(--ov), 0.05); }
  .qn-yt .qn-yt-bdiv { margin: 0 clamp(8px, 1.2vw, 28px); height: 32px; }
  .qn-yt .qn-yt-bspacer { flex: 0 0 1px; height: 32px; margin: 0 clamp(8px, 1.2vw, 28px); background: var(--border-subtle); min-width: 0; }
  .qn-yt .qn-yt-bstep-btn { width: clamp(30px, 2.6vw, 40px); height: 56px; font-size: 22px; border-radius: 10px; }
  .qn-yt .qn-yt-bstep-mid { padding: 10px 6px; }
}
/* 広い窓(1500px〜)はPLAYERと同じ寸法 */
@media screen and (min-width: 1500px) {
  .qn-yt .qn-yt-bbtn { padding: 10px 16px; min-width: 68px; }
  .qn-yt .qn-yt-bbtn.center { min-width: 76px; }
  .qn-yt .qn-yt-bdiv, .qn-yt .qn-yt-bspacer { margin: 0 28px; }
  .qn-yt .qn-yt-bstep-btn { width: 40px; }
}

/* ---------- MOREの中身をPLAYERと同じ配置に ----------
   PC幅: 見た目は従来どおり(タイトル行/ミックスカードは display:contents、A/B・ヘッドボタン・Speedスライダーは非表示)。Auto Nextを廃止しRepeat(Off/One/Folder/All)に置換
   SP幅: 下段バーは出さない(中継元としてDOMにだけ残す。-10s/+10sは廃止)。Track前/次・Repeatはタイトル行の右、A/Bはシークバー直下、Moreは Bar length/Rows帯 + URL+Save/Speedのカード */
.qn-yt-bbtn .repeat-one-badge {
  position: absolute; top: 8px; right: 50%; left: auto; transform: translateX(14px);
  width: 13px; height: 13px; padding: 0; margin: 0; font-size: 9px; font-weight: 700; letter-spacing: 0; line-height: 1;
  color: var(--accent-primary); background: var(--bg-0d0d0f);
}
.qn-yt-bbtn .repeat-folder-badge { font-size: 8px; }
.qn-yt-titlerow { display: contents; }
.qn-yt-headbtns, .qn-yt-abrow, .qn-yt-mix-speed { display: none; }
.qn-yt-mixcard { display: contents; }

@media screen and (max-width: 900px) {
  .qn-yt .qn-yt-controls .qn-yt-bar { display: none; }

  .qn-yt-custom { margin-top: 6px; }
  .qn-yt-titlerow { display: flex; align-items: center; gap: 4px; margin: 0 0 2px; }
  .qn-yt-titlerow .qn-yt-fetched-title { flex: 1 1 auto; min-width: 0; margin: 0; font-size: var(--fs-body); font-weight: 700; color: var(--accent-primary); } /* LibraryのPLAYING行と同じ曲名の見た目 */
  .qn-yt-headbtns { display: flex; align-items: center; gap: 2px; margin-left: auto; flex: 0 0 auto; }
  .qn-yt-headbtns .pcv2-head-btn { position: relative; }

  .qn-yt-abrow { display: flex; gap: 8px; margin-top: 6px; }
  .qn-yt-ab {
    display: flex; align-items: center; justify-content: center; flex: 1 1 0; min-width: 0; height: 36px; padding: 0 8px;
    font-family: var(--font-display, 'Instrument Sans'), sans-serif; font-size: 13px; font-weight: 600; white-space: nowrap;
    background: none; border: 1px solid var(--border-strong, rgba(var(--ov),0.2)); border-radius: var(--radius-popup, 10px);
    color: var(--icon-muted); cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .qn-yt-ab:active { transform: scale(0.97); }
  .qn-yt-ab.has-point { color: var(--accent-primary); border-color: var(--accent-primary); }

  .qn-yt-mixcard {
    display: grid; grid-template-columns: 1fr; gap: 6px; padding: 8px 16px 8px;
    background: var(--bg-0e0e13); border: 1px solid var(--border-subtle); border-radius: var(--radius-popup, 10px);
  }
  .qn-yt-mix-speed { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
  .qn-yt-mix-val { flex: 0 0 auto; min-width: 34px; text-align: right; font-size: 13px; color: var(--text-bright, var(--fg-ffffff)); font-variant-numeric: tabular-nums; cursor: pointer; }
  .qn-yt-mix-row { display: flex; align-items: center; gap: 8px; }
  .qn-yt-mix-reset { flex: 0 0 auto; width: 32px; height: 32px; padding: 0; display: flex; align-items: center; justify-content: center; border: none; border-radius: 8px; background: none; color: var(--icon-muted); -webkit-tap-highlight-color: transparent; cursor: pointer; }
  .qn-yt-mix-reset svg { width: 22px; height: 22px; fill: currentColor; }
  .qn-yt-mix-reset:active { background: rgba(var(--ov), 0.08); color: var(--accent-primary, #3b82f6); }
  .qn-yt-mix-range { flex: 1 1 auto; min-width: 0; width: 100%; height: 28px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; accent-color: var(--accent-primary, #3b82f6); }
  .qn-yt-mix-range:focus, .qn-yt-mix-range:focus-visible { outline: none; }
  .qn-yt-mix-range::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--accent-primary) var(--p, 0%), var(--bg-2a2a34) var(--p, 0%)); border: none; }
  .qn-yt-mix-range::-moz-range-track { height: 4px; border-radius: 2px; background: var(--bg-2a2a34); border: none; }
  .qn-yt-mix-range::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent-primary); }
  .qn-yt-mix-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: var(--text-bright, var(--bg-ffffff)); border: none; box-shadow: none; }
  .qn-yt-mix-range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--text-bright, var(--bg-ffffff)); border: none; }
}

/* Marker lock: lock glyph on the marker label, locked state on the popup nudge row */
.vbar-label-lock { display: inline-flex; vertical-align: middle; margin-left: 3px; color: var(--icon-muted); }
.vbar-label-lock svg { width: 11px; height: 11px; fill: currentColor; }
/* PC: カギは数字の左に絶対配置(数字は線の真上のまま・ラベルの高さを増やさない=上段のシークバーと重ならない) */
#pcV2WaveArea .vbar-label-lock { position: absolute; right: 100%; top: 50%; transform: translateY(-50%); margin: 0 3px 0 0; line-height: 0; }
#pcV2WaveArea .vbar-label-lock svg { width: 11px; height: 11px; margin: 0; }
#pcV2WaveArea .vbar-label-lock ~ .vbar-label-memo { margin-left: 20px; }
#pcV2WaveArea .vbar-label.pcv2-label-flip .vbar-label-lock ~ .vbar-label-memo { margin-left: 0; margin-right: 20px; }
.vbar-line.is-locked { cursor: default; }
.qn-pp-timerow.is-locked .qn-pp-nudge { opacity: 0.35; }
.qn-yt-seekpop-btn[data-pop="LK"] svg { width: 18px; height: 18px; fill: currentColor; }

/* マーカーのポップアップはボタンが多いので2段(5列グリッド)。幅は画面内に収める */
.qn-pl-seekpop { max-width: calc(100vw - 16px); }
.qn-pl-seekpop .qn-yt-seekpop-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; }
.qn-pl-seekpop .qn-yt-seekpop-btn { min-width: 0; }
