/* ───────── Aフレーム（時計/動画）───────── */
  .a-frame{display:grid;grid-template-rows:28px 1fr;height:100%;background:#fff;overflow:hidden;box-sizing:border-box}
  .a-tabs{display:flex;align-items:center;gap:4px;height:28px;padding:2px 4px;box-sizing:border-box;border-bottom:1px solid #e5e5e5;overflow:hidden;min-width:0}
  .a-tab{width:24px;height:22px;display:flex;align-items:center;justify-content:center;border:1px solid #d0d0d0;border-radius:6px;background:#f6f6f6;cursor:pointer;font-size:12px;line-height:1}
  .a-tab.active{background:#2b6cb0;color:#fff;border-color:#2b6cb0}
  .a-spacer{flex:1 1 auto;min-width:0}

  .player-ctrls{display:none;gap:4px;align-items:center;flex:0 0 auto}
  .ctrl-btn{width:22px;height:22px;padding:0;display:flex;align-items:center;justify-content:center;border:1px solid #d0d0d0;border-radius:6px;background:#f6f6f6;color:#333;cursor:pointer;flex:0 0 auto}
  .ctrl-btn:hover{background:#eee}
  .ctrl-btn.is-active{background:#2b6cb0;color:#fff;border-color:#2b6cb0}

  .a-vid-form{display:none;gap:4px;align-items:center;flex:1 1 42%;min-width:0;max-width:150px}
  .a-vid-form.show{display:flex}
  .a-vid-form input{flex:1 1 0;min-width:0;width:auto;height:22px;padding:0 6px;font-size:12px;border:1px solid #ccc;border-radius:6px;outline:none}
  .a-vid-form button{height:22px;padding:0 8px;font-size:12px;border:0;border-radius:6px;background:#2b6cb0;color:#fff;cursor:pointer;flex:0 0 auto}

  .a-panels{height:100%;overflow:hidden}
  .a-panel{width:100%;height:100%;overflow:hidden}
  .a-panel-inner{height:100%;display:flex;align-items:center;justify-content:center;padding:0;box-sizing:border-box}

  .clock{height:100%;aspect-ratio:1/1;max-width:100%}
  .clock-svg{width:100%;height:100%;display:block}
  #minute-ticks rect{y:-46;height:8.5}

  .video-wrap{height:100%;padding:0;box-sizing:border-box;display:grid;place-items:center;overflow:hidden}
  .video-box{width:100%;height:100%;max-width:100%;max-height:100%}
  .video-box iframe{width:100%;height:100%;border:0;display:block;background:#000}

/* ───────── Bフレーム（動画ブックマーク / タイムスケジュール）───────── */

  :root { --tl-hour: 44; --tl-tail: 120; }

  #BFrame{
    display: grid;
    grid-template-rows: auto 1fr;
    position: relative;
    min-height: 0;
    background: #f8fafc; 
  }

  #BFrame > .b-tabs{
    position: sticky; top: 0; z-index: 3000;
    display: flex; gap: 4px; padding: 6px;
    background: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
  }
  #BFrame > .b-tabs .b-tab{
    flex: 1; height: 28px; padding: 0 10px;
    border: none; border-radius: 6px;
    background: transparent; color: #64748b; font-weight: 600;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.2s ease;
  }
  #BFrame > .b-tabs .b-tab:hover{ color: #334155; }
  #BFrame > .b-tabs .b-tab.active{
    background: #ffffff; color: #3b82f6;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  }

  .b-panel{ width:100%; height:100%; display:none; overflow:hidden; }
  .b-panel.show{ display:block; }

  #bPanelVideos{ overflow: visible; background: #fff; }
  /* === 動画ブックマーク リスト (Bフレーム) === */
  #bPanelVideos .vb-list {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px; /* アイテム間の隙間を一定に */
  }

  #bPanelVideos .vb-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 12px; /* 角を少し丸く */
    background: #ffffff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    position: relative;
    overflow: hidden;
  }

  /* ホバー時：青いアクセントを強調 */
  #bPanelVideos .vb-item:hover {
    border-color: var(--accent);
    background: #f8faff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.08);
  }

  /* 再生中のインジケーター（もしJSで .active を付与する場合） */
  #bPanelVideos .vb-item.active {
    border-color: var(--accent);
    background: #eff6ff;
    color: var(--accent);
  }

  #bPanelVideos .vb-item.active::before {
    content: "▶";
    position: absolute;
    left: 4px;
    font-size: 10px;
    color: var(--accent);
  }

.vb-item > span:first-child {
    font-size: 16px;
    flex-shrink: 0;
  }
.vb-title {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .vb-title-inner{ display:inline-block; will-change:transform; transform:translateX(0); }
  .vb-gap{ display:inline-block; width:16px; }
  .vb-host{ display:none !important; }

  /* 管理ボタン（上部のヘッダー内） */
  .vb-head .manage-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    font-weight: 700;
    transition: 0.2s;
  }
  
.vb-head .manage-btn:hover {
    background: #2563eb;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
  }

  .manage-btn{
    flex-shrink:0; margin-left:auto; height:28px; padding:0 10px;
    border:0; border-radius:6px; background:#64748b; color:#fff; cursor:pointer; font-size:12px; transition: 0.2s;
  }
  .manage-btn:hover{ background: #475569; }
  .vb-head{
    display: flex; align-items: center; gap: 6px; padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9; background: #fff;
  }

  /* === タイムライン（スケジュール） === */

  #bPanelSchedule{
    display: grid; grid-template-rows: auto 1fr;
    height: 100%; position: relative; overflow: visible; min-height: 0;
  }
  #bPanelSchedule .timeline-wrap{
    display: grid; grid-template-rows: auto 1fr;
    height: 100%; background: #ffffff; overflow: hidden; min-height: 0;
  }

  /* ヘッダー全体の最適化（横スクロール防止） */
  #bPanelSchedule .timeline-head {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 2px !important;
    padding: 6px 4px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    position: sticky; 
    top: 40px; 
    z-index: 2000;
    background: rgba(255, 255, 255, 0.85); 
    backdrop-filter: blur(8px);
    border-bottom: 1px solid #f1f5f9;
    overflow: hidden !important;
  }

  #bPanelSchedule .timeline-head .nav-day {
    flex: 0 0 24px !important;
    height: 24px !important;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    border-radius: 4px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #64748b;
    cursor: pointer;
    transition: 0.2s ease;
  }
  #bPanelSchedule .timeline-head .nav-day:hover{ background: #f1f5f9; color: #3b82f6; border-color: #cbd5e1; }

  /* 日付入力を伸縮自在に */
  #bPanelSchedule .timeline-head input[type="date"]{
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: 120px !important;
    height: 26px;
    padding: 0 2px !important;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    background: #fff;
    text-align: center;
    transition: 0.2s;
  }
  #bPanelSchedule .timeline-head input[type="date"]:focus{
    border-color: #3b82f6; outline: none; box-shadow: 0 0 0 2px rgba(59,130,246,0.1);
  }

  #bPanelSchedule .timeline-head .head-spacer{ display: none !important; }

  /* 予定追加ボタンの幅を死守 */
  #bPanelSchedule .open-schedule{
    flex: 0 0 28px !important;
    height: 26px !important;
    padding: 0 !important;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid #cbd5e1; border-radius: 4px;
    background: #f1f5f9; color: #475569; cursor: pointer;
    transition: all 0.2s ease;
  }
  #bPanelSchedule .open-schedule:hover{ background: #e2e8f0; }

  /* タイムライン土台（横スクロール絶対禁止） */
  #bPanelSchedule .timeline-body {
    position: relative;
    overflow-x: hidden !important;
    overflow-y: auto;
    background: #fff;
    min-height: 0;
    z-index: 1;
    width: 100%;
  }

  #bPanelSchedule .timeline-grid {
    position: relative;
    padding-left: 0 !important; 
    width: 100%;
    box-sizing: border-box;
    --tl-top-pad: 20px;
    padding-top: var(--tl-top-pad);
  }

  /* ★ 時間メモリのレイアウト修正（数字と線を揃える） */
  .t-hour {
    position: relative;
    height: calc(var(--tl-hour) * 1px);
    padding-left: 55px; /* 数字用のスペース */
    box-sizing: border-box;
  }
  
  .t-hour .label {
    position: absolute;
    left: 0;
    top: 0;
    width: 50px;
    text-align: right;
    padding-right: 5px;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 600;
    transform: translateY(-50%);
    z-index: 5;
    pointer-events: none;
  }

  .t-hour::after {
    content: "";
    position: absolute;
    left: 55px; /* 数字の横から線を引く */
    right: 0;
    top: 0;
    border-top: 1px solid #f1f5f9;
    pointer-events: none;
  }

  /* 予定カード */
  .t-event{
    box-sizing: border-box !important;
    position: absolute !important;
    border-radius: 6px;
    padding: 4px 6px !important;
    color: #fff;
    font-size: 11px !important;
    line-height: 1.25;
    border: 1px solid #ffffff !important;
    opacity: 1 !important;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    overflow: hidden;
    transition: transform 0.1s, box-shadow 0.1s, z-index 0.1s;
  }
  .t-event:hover{
    z-index: 500 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.25);
  }
  .t-event .ev-title{ font-weight: 700; font-size: 11.5px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0.3px; }
  .t-event .ev-time{ opacity: 0.9; font-size: 10px; font-weight: 500; font-family: ui-monospace, monospace; letter-spacing: -0.2px; }

  .t-event.is-dcal{ opacity: 0.75 !important; }
  .t-event.is-dcal:hover{ opacity: 1 !important; }
  .t-event .ev-ico{ display: inline-block; margin-right: 4px; font-size: 13px; transform: translateY(1px); }

  /* 現在時刻ライン */
  .now-line{
    position: absolute; left: 55px !important; right: 0; height: 2px; background: #ef4444;
    box-shadow: 0 0 4px rgba(239,68,68,0.4);
    pointer-events: none; z-index: 110;
  }
  .now-dot{
    position: absolute; left: 49px !important; width: 8px; height: 8px; margin-top: -3px;
    background: #ef4444; border-radius: 50%;
    box-shadow: 0 0 0 2px #fff, 0 0 4px rgba(239,68,68,0.4);
    z-index: 110;
  }

  /* 通知・操作バー */
  #bPanelSchedule .timeline-footer{
    position: sticky; bottom: 0; z-index: 1500;
    background: rgba(255,255,255,0.9); backdrop-filter: blur(8px);
    border-top: 1px solid #f1f5f9; padding: 6px 12px;
    display: flex; gap: 8px; align-items: center; justify-content: center;
    font-size: 12px; color: #64748b; font-weight: 500;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.02);
  }
  #bPanelSchedule .timeline-footer .bell,
  #bPanelSchedule .timeline-footer .unit{ color: #64748b; line-height: 1; }
  #bPanelSchedule .timeline-footer input[type="number"]{
    width: 48px; height: 24px; padding: 0 4px; text-align: center;
    border: 1px solid #e2e8f0; border-radius: 6px; font-size: 12px; font-weight: 600; color: #334155;
    transition: 0.2s;
  }
  #bPanelSchedule .timeline-footer input[type="number"]:focus{ border-color: #3b82f6; outline: none; }
  
  #bPanelSchedule .timeline-footer button{
    height: 24px; padding: 0 10px; border: 1px solid #e2e8f0; border-radius: 6px;
    background: #fff; color: #475569; font-weight: 600; font-size: 11px;
    cursor: pointer; transition: 0.2s;
  }
  #bPanelSchedule .timeline-footer button:hover{ background: #f8fafc; border-color: #cbd5e1; }
  #bPanelSchedule .timeline-footer button.primary{
    background: #3b82f6; color: #fff; border-color: #3b82f6;
  }
  #bPanelSchedule .timeline-footer button.primary:hover{ background: #2563eb; border-color: #2563eb; }
  #bPanelSchedule .timeline-footer .muted{ opacity: 0.5; }

/* ======================================================== */
/* ★ 予定編集ポップアップ（モーダル）の復元スタイル ★     */
/* ======================================================== */

/* Dフレームを開く全画面モーダルの場合 */
#tlEditorModal{
  position: fixed; inset: 0; display: none; align-items: center; justify-content: center;
  background: rgba(0,0,0,.35); z-index: 4000;
}
#tlEditorModal .modal-card{ width: min(1000px, 94vw); height: min(820px, 92vh); background: #fff; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.25); display: grid; grid-template-rows: 46px 1fr; overflow: hidden; }
#tlEditorModal .modal-head{ display:flex; align-items:center; justify-content:space-between; gap: 8px; padding: 0 12px; border-bottom: 1px solid #e5e5e5; font-weight: 700; color: #1e293b; }
#tlEditorModal .modal-body{ position: relative; min-height: 0; }
#tlEditorFrame{ position:absolute; inset:0; width:100%; height:100%; display:block; border:0; }
#tlEditorModal .btn-close{ height:28px; padding:0 10px; border:1px solid #ccc; border-radius:6px; background:#f6f6f6; cursor:pointer; font-weight: bold; color: #333; transition:0.2s; }
#tlEditorModal .btn-close:hover{ background: #e2e8f0; }

/* Bフレーム内の簡易編集モーダル（今回崩れていたもの） */
#tlEditOverlay{ position:fixed; inset:0; background:rgba(0,0,0,.4); z-index: 5000; display: none; }
#tlEditModal{ position:fixed; inset:auto; left:50%; top:50%; transform:translate(-50%,-50%); width:min(680px, 92vw); max-height:80vh; overflow:auto; background:#fff; border:1px solid #ddd; border-radius:12px; box-shadow:0 10px 30px rgba(0,0,0,.25); z-index: 5001; display:none; padding: 20px; box-sizing: border-box; }
#tlEditModal form { display: flex; flex-direction: column; gap: 12px; }
#tlEditModal .m-head{display:flex;align-items:center;gap:8px;padding:10px 12px;border-bottom:1px solid #eee}
#tlEditModal .m-head strong{font-size:14px; font-weight: bold; color: #1e293b;}
#tlEditModal .m-head #mCancel{margin-left:auto;border:0;background:#f3f3f3;border-radius:6px;width:28px;height:28px;cursor:pointer; display: flex; align-items: center; justify-content: center; transition:0.2s;}
#tlEditModal .m-head #mCancel:hover { background: #e2e8f0; }
#tlEditModal .m-body{padding:12px; display:grid; gap:10px}
#tlEditModal .m-row{display:grid; grid-template-columns:120px 1fr; align-items:center; gap:8px}
#tlEditModal input[type="text"], #tlEditModal input[type="time"], #tlEditModal input[type="color"], #tlEditModal select{ height:34px; padding:0 10px; border:1px solid #ccc; border-radius:8px; width:100%; font-size: 14px; box-sizing: border-box; transition:0.2s;}
#tlEditModal input:focus, #tlEditModal select:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,0.1); }
#tlEditModal .m-actions{display:flex; gap:8px; align-items:center; padding:10px 12px; border-top:1px solid #eee}
#tlEditModal .primary{background:#3b82f6; color:#fff; border:0; padding:0 12px; height:34px; border-radius:8px; cursor:pointer; font-weight: bold;}
#tlEditModal .primary:hover { background: #2563eb; }
#tlEditModal .danger{background:#fff; color:#ef4444; border:1px solid #ef4444; padding:0 12px; height:34px; border-radius:8px; cursor:pointer; font-weight: bold;}
#tlEditModal .danger:hover { background: #fef2f2; }
#tlEditModal button { transition: 0.2s; }

/* 予定編集モーダル：色パレット */
#tlEditModal .color-choices{ display:grid; grid-template-columns: repeat(10, 1fr); gap:8px; align-items: center; }
#tlEditModal .color-choices .swatch{ display:inline-flex; align-items:center; justify-content:center; }
#tlEditModal .color-choices .swatch button{ width:28px; height:28px; border:1px solid #e2e8f0; border-radius:6px; background:#fff; cursor:pointer; padding:0; box-shadow: inset 0 0 0 14px transparent; position: relative; }
#tlEditModal .color-choices .swatch button::after{ content:""; position:absolute; inset:4px; border-radius:4px; background: var(--swatch-color, #2b6cb0); }
#tlEditModal .color-choices .swatch button.is-selected{ outline: 2px solid #3b82f6; outline-offset: 2px; border-color: transparent; }
#tlEditModal .color-input-wrap{ display: grid; grid-template-columns: 120px 1fr; align-items: center; gap:8px; }
#tlEditModal .color-controls{ display:grid; gap:8px; }
#tlEditModal .color-inline{ display:flex; gap:8px; align-items:center; }
#tlEditModal .color-preview{ width:24px; height:24px; border-radius:6px; border:1px solid #e2e8f0; }