/* ===== CampCut — Premiere Pro 風 NLE テーマ ===== */
:root {
  --bg: #0e0f12;          /* アプリ背景（最暗） */
  --panel: #1b1d22;       /* パネル本体 */
  --panel-2: #232630;     /* 一段明るい面 */
  --head: #15171b;        /* パネルヘッダー */
  --inp: #0f1115;         /* 入力欄背景 */
  --border: #34373f;      /* 境界線 */
  --border-soft: #2a2d34;
  --text: #d7dae0;
  --muted: #8b9099;
  --accent: #7c7cff;      /* Premiere 風バイオレット（選択） */
  --accent-2: #3b82f6;    /* アクション用ブルー */
  --accent-d: #2f64c9;
  --danger: #e06a6a;
  /* タイムライン各レーン高さ */
  --h-ruler: 22px; --h-video: 80px; --h-sub: 38px; --h-audio: 46px; --h-music: 44px; --h-image: 44px; --h-pip: 44px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; margin: 0; }
body {
  font-family: "Segoe UI", "Yu Gothic UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

.app { height: 100vh; display: flex; flex-direction: column; }

/* ===== トップツールバー ===== */
.topbar {
  height: 46px; flex-shrink: 0; display: flex; align-items: center; gap: 16px;
  padding: 0 14px; background: linear-gradient(180deg, #20232a, #16181c);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 15px; letter-spacing: .3px; display: flex; align-items: center; gap: 8px; }
.brand .logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 5px; font-size: 11px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
}
.brand-sub { color: var(--muted); font-weight: 500; font-size: 12px; }
/* トップバーの再生時間表示 */
.topbar-tc {
  display: flex; align-items: baseline; gap: 7px; margin-left: 22px;
  font-family: ui-monospace, Consolas, monospace; font-variant-numeric: tabular-nums;
}
.topbar-tc #tcCur { font-size: 18px; font-weight: 700; color: #fff; letter-spacing: .5px; }
.topbar-tc .tc-sep { color: var(--muted); }
.topbar-tc #tcTotal { font-size: 14px; }
.topbar-tc .narr-badge { font-size: 13px; }
.topbar-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.topbar-div { width: 1px; height: 22px; background: var(--border); margin: 0 2px; }

.tbtn {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  padding: 7px 14px; border-radius: 6px; cursor: pointer; font-size: 12.5px; font-weight: 600;
  transition: filter .15s, background .15s;
}
.tbtn:hover { filter: brightness(1.18); }
.tbtn-sm { padding: 4px 9px; font-size: 11.5px; font-weight: 500; }
.tbtn-accent { background: linear-gradient(180deg, var(--accent-2), var(--accent-d)); border-color: var(--accent-d); color: #fff; }
.tbtn:disabled { opacity: .5; cursor: not-allowed; }

/* ===== 上段3パネル ===== */
.main { flex: 1; display: flex; min-height: 0; gap: 6px; padding: 6px; }

.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: 7px;
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.panel-head {
  flex-shrink: 0; height: 30px; display: flex; align-items: center; gap: 10px;
  padding: 0 12px; background: var(--head); border-bottom: 1px solid var(--border);
  font-size: 11.5px; font-weight: 700; letter-spacing: .4px; color: #aab0ba; text-transform: uppercase;
}
.panel-body { flex: 1; overflow: auto; min-height: 0; }

.panel-project { width: var(--w-project, 232px); flex-shrink: 0; }
.panel-monitor { flex: 1; min-width: 0; }
.panel-inspector { width: var(--w-inspector, 312px); flex-shrink: 0; }

/* パネル幅調整用スプリッター（ドラッグで幅を変更） */
.splitter {
  flex-shrink: 0; width: 7px; align-self: stretch; cursor: col-resize;
  border-radius: 4px; background: transparent; position: relative;
  touch-action: none; transition: background .12s;
}
.splitter::before {
  content: ""; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 3px; height: 38px; border-radius: 3px; background: var(--border);
}
.splitter:hover, .splitter.dragging { background: rgba(120, 160, 220, .18); }
.splitter:hover::before, .splitter.dragging::before { background: var(--accent, #5aa0e0); }

/* ----- プロジェクト/メディア ----- */
.import-box { padding: 12px; border-bottom: 1px solid var(--border-soft); }
.lbl { display: block; font-size: 11px; color: var(--muted); margin-bottom: 5px; }
.inp {
  width: 100%; background: var(--inp); color: var(--text); border: 1px solid var(--border);
  border-radius: 5px; padding: 7px 9px; font-size: 12px; font-family: ui-monospace, Consolas, monospace;
}
.inp:focus { outline: none; border-color: var(--accent-2); }
.import-row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.chk, .chk2 { font-size: 11.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.chk2 { color: var(--text); font-size: 12.5px; margin-bottom: 8px; }

.upload-alt { margin-top: 10px; }
.upload-alt summary { cursor: pointer; color: var(--muted); font-size: 11.5px; }
.dropzone {
  border: 1px dashed var(--border); border-radius: 6px; padding: 14px; text-align: center;
  margin-top: 8px; font-size: 11.5px; color: var(--muted); transition: border-color .2s, background .2s;
}
.dropzone.drag { border-color: var(--accent-2); background: var(--panel-2); }
.dropzone p { margin: 0 0 8px; }

.relink-banner { margin-top: 8px; padding: 8px; border: 1px solid #7a5a2a; background: #2a2415; border-radius: 6px; font-size: 11.5px; color: #e8d9a8; }
.relink-banner .inp { margin-top: 6px; }

.bin-head {
  padding: 8px 12px; font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .3px; display: flex; justify-content: space-between; align-items: center;
}
.bin-list { padding: 0 8px 10px; }
.empty-hint { color: var(--muted); font-size: 11.5px; padding: 8px; text-align: center; line-height: 1.6; }
.bin-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 5px;
  cursor: pointer; font-size: 12px; border: 1px solid transparent;
}
.bin-item:hover { background: var(--panel-2); }
.bin-item.selected { background: rgba(124,124,255,.16); border-color: var(--accent); }
.bin-idx {
  width: 18px; height: 18px; flex-shrink: 0; border-radius: 4px; background: var(--accent-2);
  color: #fff; font-size: 10.5px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.bin-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bin-dur { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.bin-noaudio { color: var(--muted); }

/* ----- モニター ----- */
.monitor-body {
  position: relative;
  background: #050608; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 8px; overflow: hidden;
}
.monitor-stage {
  position: relative; flex: 1; width: 100%; min-height: 0; display: flex;
  align-items: center; justify-content: center; overflow: hidden;
}
.monitor-stage video {
  max-width: 100%; max-height: 100%; background: #000; border-radius: 4px;
  box-shadow: 0 4px 22px rgba(0,0,0,.5); transition: transform .12s ease;
}
/* フェード（黒）オーバーレイ — プレビューで先頭/末尾の暗転を再現 */
.fade-overlay {
  position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none;
  border-radius: 4px;
}
/* タイトルカードのプレビュー（中央テキスト） */
.title-overlay {
  position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 8%; color: #fff; font-weight: 800; line-height: 1.3;
  font-size: clamp(22px, 6vw, 56px); white-space: pre-wrap; pointer-events: none;
  text-shadow: 0 2px 8px rgba(0,0,0,.6);
}
/* プレビュー字幕オーバーレイ（本番の焼き込みイメージ） */
.sub-overlay {
  position: absolute; left: 50%; bottom: 7%; transform: translateX(-50%);
  max-width: 86%; text-align: center; color: #fff; font-weight: 700; line-height: 1.35;
  font-size: clamp(13px, 2.4vw, 22px); white-space: pre-wrap; pointer-events: none;
  text-shadow: -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000,
    0 2px 4px rgba(0,0,0,.6);
}
.narr-badge { margin-left: auto; font-size: 11px; color: #6fd39a; font-weight: 600; }
/* ラベルは映像に重ねて表示し、映像の高さを最大化 */
.monitor-label {
  position: absolute; left: 8px; bottom: 6px; font-size: 11px;
  background: rgba(0,0,0,.45); padding: 2px 8px; border-radius: 4px; pointer-events: none; z-index: 4;
}
/* タイムライン: プレイヘッドに現在時刻ラベル */
.playhead-time {
  position: absolute; top: -1px; left: 6px; background: #ff5c57; color: #fff;
  font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 3px; white-space: nowrap;
  font-family: ui-monospace, Consolas, monospace; font-variant-numeric: tabular-nums; pointer-events: none;
}

/* ----- インスペクタ ----- */
.insp-body { padding: 0; }
.insp-sec { padding: 12px 14px; border-bottom: 1px solid var(--border-soft); }
.insp-title {
  font-size: 11px; font-weight: 700; color: var(--accent); text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: 10px;
}
.ctl { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.ctl:last-child { margin-bottom: 0; }
.ctl-l { font-size: 11.5px; color: var(--muted); width: 96px; flex-shrink: 0; }
.ctl-l i { color: var(--text); font-style: normal; }
.ctl select, .ctl input[type=range] { flex: 1; min-width: 0; }
select {
  background: var(--inp); color: var(--text); border: 1px solid var(--border);
  border-radius: 5px; padding: 6px 8px; font-size: 12px;
}
select:focus { outline: none; border-color: var(--accent-2); }
input[type=range] { accent-color: var(--accent-2); }

/* 選択クリップ プロパティ */
#propsPanel h3 { margin: 0 0 6px; font-size: 13px; word-break: break-all; }
#propsPanel .pmeta { color: var(--muted); font-size: 11px; margin-bottom: 10px; }
#propsPanel .row { display: flex; gap: 8px; margin-bottom: 8px; }
#propsPanel .row > div { flex: 1; }
#propsPanel label { font-size: 11px; color: var(--muted); display: block; margin-bottom: 3px; }
#propsPanel input[type=number] {
  width: 100%; background: var(--inp); color: var(--text); border: 1px solid var(--border);
  border-radius: 5px; padding: 6px; font-size: 12px;
}
#propsPanel textarea {
  width: 100%; background: var(--inp); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px; resize: vertical; min-height: 74px; font-family: inherit; font-size: 12.5px;
}
#propsPanel input:focus, #propsPanel textarea:focus { outline: none; border-color: var(--accent-2); }
.prop-actions { display: flex; gap: 6px; margin-top: 8px; }
.prop-actions .btn { flex: 1; }

.btn {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  padding: 7px 12px; border-radius: 5px; cursor: pointer; font-size: 12px; transition: filter .15s;
}
.btn:hover { filter: brightness(1.18); }
.btn-sm { padding: 5px 10px; font-size: 11.5px; }
.btn-accent { background: linear-gradient(180deg, var(--accent-2), var(--accent-d)); border-color: var(--accent-d); color: #fff; font-weight: 600; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.remove-btn { color: var(--danger); border-color: #5a3636; }
.field.disabled, .ctl.disabled { opacity: .4; pointer-events: none; }

.hint { font-size: 11px; color: var(--muted); line-height: 1.6; margin: 0 0 10px; }

/* 進捗・結果 */
.progress-wrap { margin-top: 8px; }
.progress-bar { background: var(--inp); border-radius: 999px; height: 10px; overflow: hidden; border: 1px solid var(--border); }
.progress-fill { background: linear-gradient(90deg, var(--accent-d), var(--accent-2)); height: 100%; width: 0%; transition: width .4s; }
#progressMsg { font-size: 11px; margin: 6px 0 0; }
.result { margin-top: 10px; }
.result video { width: 100%; border-radius: 5px; background: #000; }
.result-actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }

/* ===== タイムラインパネル ===== */
.panel-timeline { height: 430px; flex-shrink: 0; margin: 0 6px 6px; }
.panel-timeline .panel-head { justify-content: flex-start; }
.tl-tools { margin-left: 14px; display: flex; align-items: center; gap: 16px; text-transform: none; }
.zoom-ctl { display: flex; align-items: center; gap: 7px; }
.zoom-ctl input[type=range] { width: 120px; }
.hint-inline { font-size: 11px; font-weight: 400; letter-spacing: 0; }

.timeline { flex: 1; display: flex; overflow: hidden; background: #101216; user-select: none; }

.tl-gutter { flex-shrink: 0; width: 92px; border-right: 1px solid var(--border); background: var(--head); }
.tl-gutter .g-row {
  display: flex; align-items: center; gap: 6px; padding: 0 10px; font-size: 11px; font-weight: 600;
  color: #aab0ba; border-bottom: 1px solid var(--border-soft); box-sizing: border-box;
}
.tl-gutter .g-row span { color: var(--muted); font-weight: 400; }
.g-ruler { height: var(--h-ruler); } .g-video { height: var(--h-video); }
.g-sub { height: var(--h-sub); } .g-audio { height: var(--h-audio); }
.g-music { height: var(--h-music); }
.g-image { height: var(--h-image); }
.g-pip { height: var(--h-pip); border-bottom: none; }

.tl-scroll { flex: 1; overflow-x: auto; overflow-y: hidden; touch-action: pan-x; }
.tl-inner { position: relative; min-width: 100%; }

.ruler { position: relative; height: var(--h-ruler); border-bottom: 1px solid var(--border); background: #0a0c0f; cursor: pointer; }
.ruler.scrubbing { cursor: ew-resize; }
.ruler .tick { position: absolute; top: 0; height: 100%; border-left: 1px solid #3a3e47; padding-left: 4px;
  font-size: 10px; color: var(--muted); line-height: var(--h-ruler); white-space: nowrap; font-variant-numeric: tabular-nums;
  pointer-events: none; }

.lane {
  position: relative; border-bottom: 1px solid var(--border-soft); box-sizing: border-box;
  background: repeating-linear-gradient(90deg, transparent, transparent 49px, rgba(255,255,255,.025) 49px, rgba(255,255,255,.025) 50px);
}
.lane-video { height: var(--h-video); } .lane-sub { height: var(--h-sub); }
.lane-audio { height: var(--h-audio); }
.lane-music { height: var(--h-music); }
.lane-image { height: var(--h-image); }
.lane-pip { height: var(--h-pip); border-bottom: none; }

/* 動画クリップ（Premiere の青系） */
.tl-clip {
  position: absolute; top: 5px; height: calc(var(--h-video) - 10px); box-sizing: border-box;
  background: linear-gradient(180deg, #36659e, #29507e); border: 1px solid #4f86c4; border-radius: 5px;
  overflow: hidden; cursor: grab; user-select: none; color: #eaf2fb;
}
.tl-clip::before { /* クリップ上部の濃いヘッダー帯 */
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 16px; background: rgba(0,0,0,.22);
}
.tl-clip.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); z-index: 3; }
.tl-clip.no-audio { background: linear-gradient(180deg, #8a7a32, #6b5e23); border-color: #b3a04a; }
.tl-clip.dragging { opacity: .85; cursor: grabbing; z-index: 5; }
.tl-clip.longpress, .tl-music-block.longpress, .tl-image-block.longpress, .tl-pip-block.longpress { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--accent); }
.tl-clip .tl-name { position: relative; font-size: 11px; padding: 3px 8px; pointer-events: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.tl-clip .tl-sub { font-size: 10.5px; padding: 0 8px; color: #cfe0f2; pointer-events: none; }
.tl-handle { position: absolute; top: 0; bottom: 0; width: 9px; cursor: ew-resize; z-index: 4; display: flex; align-items: center; justify-content: center; }
.tl-handle.left { left: 0; } .tl-handle.right { right: 0; }
.tl-handle::before { content: ""; width: 3px; height: 38%; background: rgba(255,255,255,.65); border-radius: 2px; }
.tl-handle:hover::before { background: #fff; height: 62%; }
/* クリップのフェード表示（黒のグラデ三角） */
.clip-fade { position: absolute; top: 0; bottom: 0; pointer-events: none; z-index: 2; }
.clip-fade.in { left: 0; background: linear-gradient(to right, rgba(0,0,0,.8), transparent); }
.clip-fade.out { right: 0; background: linear-gradient(to left, rgba(0,0,0,.8), transparent); }
/* クロスフェード（前クリップと重なる領域） */
.clip-xfade { position: absolute; top: 0; bottom: 0; left: 0; z-index: 2; pointer-events: none;
  background: repeating-linear-gradient(45deg, rgba(124,124,255,.5), rgba(124,124,255,.5) 5px, rgba(124,124,255,.2) 5px, rgba(124,124,255,.2) 10px);
  border-right: 1px solid var(--accent); }

/* 空白（ギャップ）クリップ */
.tl-gap {
  background: repeating-linear-gradient(45deg, #2a2d34, #2a2d34 8px, #21242a 8px, #21242a 16px) !important;
  border: 1px dashed #565b66 !important; color: #aab0ba !important;
}
.tl-gap::before { display: none; }
.tl-gap.selected { border-color: var(--accent) !important; box-shadow: 0 0 0 2px var(--accent); }
/* タイトルカード（クリップ） */
.tl-title { background: linear-gradient(180deg, #3a4a8a, #2a3666) !important; border: 1px solid #5566bb !important; color: #eef !important; }
.tl-title::before { display: none; }
.tl-title.selected { border-color: var(--accent) !important; box-shadow: 0 0 0 2px var(--accent); }

/* 字幕ブロック（アンバー）— ドラッグ移動・端トリム */
.tl-sub-block {
  position: absolute; top: 4px; height: calc(var(--h-sub) - 8px); box-sizing: border-box;
  background: linear-gradient(180deg, #9a7b2e, #7c6224); border: 1px solid #c39a3c; border-radius: 4px;
  overflow: hidden; font-size: 10.5px; color: #fff6e0; line-height: calc(var(--h-sub) - 10px);
  white-space: nowrap; cursor: grab;
}
.tl-sub-block .cap-text { display: block; padding: 0 9px; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.tl-sub-block.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); z-index: 3; }
.tl-narr-block span, .tl-music-block span { display: block; padding: 0 9px; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
/* 音声（ナレーション）ブロック（グリーン） + BGM 帯 */
.tl-narr-block {
  position: absolute; top: 4px; height: calc(var(--h-audio) - 8px); box-sizing: border-box;
  background: linear-gradient(180deg, #2f7d4f, #245f3d); border: 1px solid #3da06a; border-radius: 4px;
  overflow: hidden; font-size: 10.5px; color: #e6fff0; line-height: calc(var(--h-audio) - 10px);
  white-space: nowrap; cursor: grab; user-select: none;
}
.tl-bgm-bar {
  position: absolute; left: 0; bottom: 3px; height: 9px; border-radius: 3px;
  background: repeating-linear-gradient(90deg, #2f7d4f, #2f7d4f 7px, #256340 7px, #256340 14px); pointer-events: none;
}
.lane-empty-hint { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 10.5px; color: var(--muted); }

/* 音楽ブロック（紫系・ドラッグで位置調整） */
.tl-music-block {
  position: absolute; top: 4px; height: calc(var(--h-music) - 8px); box-sizing: border-box;
  background: linear-gradient(180deg, #6d4bbf, #553a96); border: 1px solid #8b6fd6; border-radius: 4px;
  overflow: hidden; font-size: 10.5px; color: #f1ebff; line-height: calc(var(--h-music) - 10px);
  white-space: nowrap; cursor: grab; user-select: none;
}
.tl-music-block:hover { filter: brightness(1.12); }
.tl-music-block.dragging { opacity: .85; cursor: grabbing; z-index: 5; }
.tl-music-block.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); z-index: 3; }
.tl-music-block canvas.wave { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.tl-music-block span { position: relative; z-index: 1; }

/* 画像クリップ（シアン系） */
.tl-image-block {
  position: absolute; top: 4px; height: calc(var(--h-image) - 8px); box-sizing: border-box;
  background: linear-gradient(180deg, #1f7a86, #155b66); border: 1px solid #36a6b4; border-radius: 4px;
  overflow: hidden; font-size: 10.5px; color: #e3fbff; line-height: calc(var(--h-image) - 10px);
  white-space: nowrap; cursor: grab; user-select: none;
}
.tl-image-block span { display: block; padding: 0 9px; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.tl-image-block:hover { filter: brightness(1.12); }
.tl-image-block.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); z-index: 3; }

/* モニター上の画像/動画オーバーレイ */
.image-overlays { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.image-overlays img, .image-overlays video { position: absolute; }

/* 動画PiPブロック（オレンジ系） */
.tl-pip-block {
  position: absolute; top: 4px; height: calc(var(--h-pip) - 8px); box-sizing: border-box;
  background: linear-gradient(180deg, #b5701f, #8a5215); border: 1px solid #d8923a; border-radius: 4px;
  overflow: hidden; font-size: 10.5px; color: #fff3e0; line-height: calc(var(--h-pip) - 10px);
  white-space: nowrap; cursor: grab; user-select: none;
}
.tl-pip-block span { display: block; padding: 0 9px; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.tl-pip-block:hover { filter: brightness(1.12); }
.tl-pip-block.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); z-index: 3; }

/* インスペクタの音楽リスト */
.music-list { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.music-item { background: var(--inp); border: 1px solid var(--border); border-radius: 6px; padding: 7px 8px; }
.music-item .mi-top { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.music-item .mi-name { flex: 1; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-item .mi-del { padding: 2px 8px; }
.music-item .mi-ctl { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.music-item .mi-ctl input[type=number] { width: 56px; background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 4px; padding: 3px 5px; font-size: 11px; }
.music-item .mi-ctl input[type=range] { flex: 1; min-width: 50px; }
.music-item .mi-volv { color: var(--text); font-style: normal; min-width: 34px; text-align: right; }

/* プレイヘッド */
.playhead { position: absolute; top: 0; bottom: 0; width: 2px; background: #ff5c57; z-index: 8; pointer-events: none; display: none; }
.playhead-head { position: absolute; top: 0; left: -5px; width: 12px; height: 11px; background: #ff5c57; border-radius: 2px 2px 4px 4px; }
.drop-marker { position: absolute; top: var(--h-ruler); bottom: 0; width: 2px; background: var(--accent); z-index: 6; pointer-events: none; }

/* ===== ステータスバー ===== */
.statusbar {
  height: 24px; flex-shrink: 0; display: flex; align-items: center; padding: 0 14px;
  background: var(--head); border-top: 1px solid var(--border); font-size: 11.5px;
}

/* スクロールバー（ダーク） */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #3a3e47; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #4a4f59; }

.muted { color: var(--muted); }
/* モバイル: パネル切替タブ */
.mtabs { display: none; }
/* 大きな再生/一時停止ボタン（タッチ） */
.big-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 64px; height: 64px; border-radius: 50%; border: none; z-index: 6;
  background: rgba(0,0,0,.5); color: #fff; font-size: 26px; cursor: pointer;
  display: none; align-items: center; justify-content: center;
}
.big-play:active { background: rgba(0,0,0,.7); }
/* 選択クリップの操作バー */
.action-bar { display: none; gap: 6px; padding: 6px 8px; margin: 0 6px; overflow-x: auto;
  background: var(--head); border: 1px solid var(--border); border-radius: 7px; align-items: center; }
.action-bar button { flex: 0 0 auto; min-width: 44px; min-height: 40px; font-size: 16px;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.action-bar button:active { filter: brightness(1.3); }
.action-bar .ab-del { color: var(--danger); border-color: #5a3636; }
.action-bar .ab-label { flex: 0 0 auto; font-size: 11px; color: var(--muted); padding: 0 4px; }
/* トースト通知 */
.toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  background: rgba(20,22,28,.95); color: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 16px; font-size: 13px; z-index: 200; max-width: 86vw; text-align: center;
  box-shadow: 0 6px 24px rgba(0,0,0,.5); transition: opacity .3s; }

.net-dot { margin-right: 8px; font-size: 10px; }
.net-on { color: #6fd39a; }
.net-off { color: #e06a6a; }

/* 結果モーダル */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; width: min(680px, 92vw); max-height: 86vh; display: flex; flex-direction: column; box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); font-weight: 700; }
.modal-head > div { display: flex; gap: 8px; }
.br-path { padding: 6px 14px; font-size: 11px; color: var(--muted); word-break: break-all; border-bottom: 1px solid var(--border-soft); }
.browse-list { flex: 1; overflow: auto; padding: 6px; min-height: 300px; max-height: 60vh; }
.br-item { padding: 11px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; border: 1px solid transparent; }
.br-item:hover { background: var(--panel-2); }
.br-item.br-dir { color: #cdd3dd; }
.br-item.br-file { color: #9fd3ff; }

.modal textarea { flex: 1; margin: 12px; background: var(--inp); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 12px; font-size: 13px; line-height: 1.7; resize: none; min-height: 360px; font-family: inherit; }

/* 狭い画面 */
@media (max-width: 1000px) {
  .panel-project { width: var(--w-project, 220px); } .panel-inspector { width: var(--w-inspector, 290px); }
  .hint-inline { display: none; }
}

/* タッチでドラッグできるよう、操作対象はブラウザのスクロール/ズームを無効化 */
.tl-clip, .tl-handle, .tl-sub-block, .tl-narr-block, .tl-music-block,
.tl-image-block, .tl-pip-block, .ruler, .playhead, input[type=range] { touch-action: none; }

/* タッチ端末（指）向け: タップ対象を大きく */
@media (pointer: coarse) {
  .tl-handle { width: 16px; }
  .tbtn, .btn { min-height: 34px; }
  .br-item { padding: 14px 12px; }
  select, .ctl input[type=range] { min-height: 32px; }
  .big-play { display: flex; }
  .action-bar.show { display: flex; }
}

/* スマホ/小型タブレット: パネルをタブで1枚ずつ表示して編集領域を最大化 */
@media (max-width: 820px), (max-height: 520px) {
  .mtabs { display: flex; gap: 4px; padding: 4px; background: var(--head); border-bottom: 1px solid var(--border); flex-shrink: 0; }
  .mtabs button { flex: 1; padding: 9px 4px; background: var(--panel-2); color: var(--text);
    border: 1px solid var(--border); border-radius: 6px; font-size: 12px; }
  .mtabs button.active { background: var(--accent-2); color: #fff; border-color: var(--accent-d); }
  .main > .panel { display: none; }
  .main > .splitter { display: none; }
  .main.show-project .panel-project,
  .main.show-monitor .panel-monitor,
  .main.show-inspector .panel-inspector { display: flex; flex: 1 1 auto; width: auto; min-width: 0; }
  .action-bar.show { display: flex; }
}

/* iPhone 横画面など 縦が低い画面に最適化 */
@media (max-height: 520px) {
  body { font-size: 12px; }
  .topbar { height: 40px; padding: 0 8px; gap: 8px; }
  .brand { font-size: 13px; }
  .brand-sub, .topbar-tc #tcTotal { display: none; }
  .topbar-tc { margin-left: 8px; }
  .topbar-tc #tcCur { font-size: 15px; }
  .main { gap: 4px; padding: 4px; }
  .panel-project { width: 200px; } .panel-inspector { width: 256px; }
  .panel-head { height: 26px; font-size: 10.5px; }
  .panel-timeline { height: clamp(150px, 40vh, 300px); margin: 0 4px 4px; }
  .insp-sec { padding: 9px 10px; }
  .hint, .hint-inline { display: none; }
  .tl-tools { gap: 8px; margin-left: 8px; }
  .monitor-body { padding: 4px; }
}
