:root {
  --bg: #1b1d22;
  --panel: #242830;
  --panel-2: #2c313c;
  --line: #3a4150;
  --text: #e8ecf4;
  --muted: #9aa3b5;
  --accent: #6ea8ff;
  --danger: #ff5d73;
  --ok: #3dd68c;
  --clip: #3d5a99;
  --clip-on: #4f7ad4;
  --w-clips: 152px;
  --w-preview: 240px;
  --h-timeline: 156px;
  --tl-ruler-h: 18px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 13px/1.35 "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
}

button, input, label { font: inherit; color: inherit; }
button {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
}
button:hover, .file-btn:hover { border-color: var(--accent); }
button.active { background: #35548f; border-color: var(--accent); }
input[type="number"], input[type="text"] {
  background: #15171c;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 4px 6px;
  width: 72px;
}
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
@keyframes field-applied-flash {
  0% { border-color: #fff; box-shadow: 0 0 0 1px #fff; }
  100% { border-color: var(--line); box-shadow: none; }
}
input.field-applied {
  animation: field-applied-flash 0.35s ease-out;
}
.num-stepper {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.num-stepper input[type="number"] { width: 56px; text-align: center; }
.num-stepper.compact input[type="number"] { width: 52px; }
.step-btn {
  padding: 2px 7px;
  min-width: 26px;
  line-height: 1.2;
  font-weight: 600;
}
input[type="text"] { width: 140px; }
input[type="color"] {
  width: 34px; height: 28px; padding: 0; border: 1px solid var(--line);
  background: none; cursor: pointer;
}

.app { display: flex; flex-direction: column; height: 100%; }
.topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px 14px;
  align-items: center;
  padding: 6px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.topbar-panel {
  min-width: 0;
}
.topbar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
  row-gap: 6px;
}
.topbar-sub {
  display: none;
}
.topbar-grow {
  flex: 1 1 8px;
  min-width: 0;
}
.toolbar-sep {
  width: 1px;
  height: 22px;
  background: rgba(58, 65, 80, 0.85);
  flex-shrink: 0;
  margin: 0 2px;
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
  padding-right: 2px;
}
.logo {
  width: 34px; height: 34px; border-radius: 8px;
  display: grid; place-items: center; font-weight: 700;
  background: linear-gradient(135deg, #ff3b6b, #6ea8ff);
}
.logo-img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  flex-shrink: 0;
  image-rendering: auto;
}
.brand small { display: block; color: var(--muted); }
.toolbar-cluster {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.toolbar-files > button,
.toolbar-settings > button {
  padding: 4px 8px;
  font-size: 12px;
}
.toolbar-media .file-btn {
  padding: 4px 8px;
  font-size: 12px;
  white-space: nowrap;
}
.send-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 5px 3px 6px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  background: rgba(110, 168, 255, 0.08);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.send-group #uploadTransport {
  width: 54px;
  flex-shrink: 0;
}
.editor-mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  margin-left: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #171a20;
  flex-shrink: 0;
}
.editor-mode-switch button {
  min-height: 27px;
  padding: 3px 9px;
  border-color: transparent;
  background: transparent;
  white-space: nowrap;
}
.editor-mode-switch button.active {
  background: #35548f;
  border-color: var(--accent);
}
.send-group .device-picker {
  position: relative;
  flex-shrink: 0;
}
.send-group .device-picker-btn {
  position: relative;
  min-width: 148px;
  max-width: 196px;
  height: 24px;
  padding: 2px 18px 2px 8px;
  font-size: 11px;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
}
.send-group .device-picker-btn::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 10px 10px 0;
  border-color: transparent;
  pointer-events: none;
  opacity: 0;
}
.send-group .device-picker-btn.conn-ok::after {
  opacity: 1;
  border-top-color: #45e08a;
  border-right-color: #1fa85a;
}
.send-group .device-picker-btn.conn-bad::after {
  opacity: 1;
  border-top-color: #ff8a8a;
  border-right-color: #e53935;
}
.send-group .device-picker-btn.conn-air::after {
  opacity: 1;
  border-top-color: #6eb6ff;
  border-right-color: #3d8fd9;
}
.device-picker-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 120;
  min-width: 260px;
  max-width: 340px;
  max-height: 280px;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  padding: 4px 0;
}
.device-picker-panel.hidden { display: none; }
.device-picker-panel ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.device-picker-row {
  display: grid;
  grid-template-columns: 22px 1fr auto auto auto;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}
.device-picker-row .dev-pixels {
  display: block;
  font-size: 10px;
  color: var(--muted);
}
.device-picker-row:hover { background: rgba(255, 255, 255, 0.05); }
.device-picker-row.active { background: rgba(61, 214, 140, 0.1); }
.device-picker-row .dev-check {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.device-picker-row .dev-check input {
  width: 14px;
  height: 14px;
  margin: 0;
  cursor: pointer;
  appearance: none;
  border-radius: 50%;
  border: 2px solid var(--muted);
  background: transparent;
}
.device-picker-row .dev-check input:checked {
  border-color: #3dd68c;
  background: radial-gradient(circle at center, #3dd68c 0 45%, transparent 50%);
}
.device-picker-row .dev-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.device-picker-row .dev-sub {
  display: block;
  font-size: 10px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
}
.device-picker-row .dev-upload {
  width: 16px;
  text-align: center;
  font-weight: 700;
  font-size: 13px;
}
.device-picker-row .dev-upload.ok { color: #3dd68c; }
.device-picker-row .dev-upload.fail { color: #ff8a8a; }
.device-picker-row .dev-upload.pending { color: var(--muted); }
.device-picker-row .dev-corner {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 9px 9px 0;
  border-color: transparent;
  flex-shrink: 0;
}
.device-picker-row .dev-corner.ok {
  border-top-color: #45e08a;
  border-right-color: #1fa85a;
}
.device-picker-row .dev-corner.bad {
  border-top-color: #ff8a8a;
  border-right-color: #e53935;
}
.device-picker-row .dev-corner.air {
  border-top-color: #6eb6ff;
  border-right-color: #3d8fd9;
}
.device-picker-row .dev-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}
.device-picker-row .dev-actions button {
  width: 22px;
  height: 22px;
  padding: 0;
  font-size: 12px;
  line-height: 1;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
}
.device-picker-row .dev-actions button:hover {
  border-color: var(--accent);
  color: var(--text);
}
.device-picker-row .dev-act-del:hover { color: var(--danger); border-color: var(--danger); }
.device-picker-empty {
  padding: 10px 12px;
  font-size: 11px;
  color: var(--muted);
}
.send-group .wifi-ssid { width: 102px; flex-shrink: 0; }
.send-group .prop-name-input,
.send-group .prop-led-input,
.send-group .prop-strip-input {
  height: 24px;
  flex-shrink: 0;
  padding: 2px 6px;
  font-size: 11px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.send-group .prop-name-input { width: 88px; }
.send-group .prop-led-input { width: 48px; }
.send-group .prop-strip-input { width: 86px; }
.send-group .btn-prop-save {
  width: 24px;
  height: 24px;
  min-width: 24px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}
.send-group .wifi-host:not(.wifi-ssid) { width: 88px; flex-shrink: 0; }
.send-group .wifi-only.hidden,
.send-group .serial-only.hidden,
.send-group .wifi-host.hidden,
.send-group .dev-pick.hidden {
  display: none !important;
}
.send-group .send-remote-check {
  flex-shrink: 0;
  margin: 0;
  padding: 0 4px;
  font-size: 11px;
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
}
.send-group .send-remote-check input {
  margin: 0 4px 0 0;
  cursor: pointer;
}
.send-group #btnSend.send-btn {
  position: relative;
  margin: 0;
  overflow: hidden;
  padding-right: 14px;
}
.send-group #btnSend.send-btn::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 16px 16px 0;
  border-color: transparent;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s ease, filter 0.22s ease;
}
.send-group #btnSend.send-btn.conn-ok::after {
  opacity: 1;
  border-top-color: #45e08a;
  border-right-color: #1fa85a;
  filter: drop-shadow(-1px 2px 3px rgba(31, 168, 90, 0.55));
}
.send-group #btnSend.send-btn.conn-bad::after {
  opacity: 1;
  border-top-color: #ff8a8a;
  border-right-color: #e53935;
  filter: drop-shadow(-1px 2px 3px rgba(229, 57, 53, 0.5));
}
.send-group #btnSend.send-btn.conn-air::after {
  opacity: 1;
  border-top-color: #6eb6ff;
  border-right-color: #3d8fd9;
  filter: drop-shadow(-1px 2px 3px rgba(61, 143, 217, 0.5));
}
.send-group #btnWifiSaveDev,
.send-group #btnDeviceRefresh {
  width: 24px;
  height: 24px;
  min-width: 24px;
  padding: 0;
  font-size: 15px;
  line-height: 1;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}
.send-group #btnDeviceRefresh svg {
  display: block;
}
.send-group #btnDeviceRefresh.spinning svg {
  animation: device-refresh-spin 0.7s linear infinite;
}
@keyframes device-refresh-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.toolbar-settings > button {
  padding: 4px 7px;
  font-size: 12px;
  color: var(--muted);
}
.toolbar-settings > button:hover {
  color: var(--text);
}
.settings .check {
  font-size: 11px;
  gap: 4px;
}
.settings label, .clip-params label, .check {
  display: flex; gap: 6px; align-items: center; color: var(--muted);
}
.file-btn {
  display: inline-block; padding: 4px 8px; border-radius: 6px; font-size: 12px;
  background: #35548f; border: 1px solid var(--accent); cursor: pointer;
}
.file-btn.secondary { background: #2d4a3a; border-color: var(--ok); }
.file-btn.video-btn { background: #253a58; border-color: #6ea8ff; }
.audio-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.video-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #9ec5ff; }

.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: var(--w-clips) 4px var(--w-preview) 4px 1fr;
  min-height: 0;
  overflow: hidden;
}
.workspace > * { min-height: 0; min-width: 0; }
.splitter-v {
  width: 4px;
  cursor: col-resize;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
  flex-shrink: 0;
  z-index: 3;
}
.splitter-v:hover { background: var(--accent); }
body.splitting { cursor: col-resize; user-select: none; }
body.splitting * { cursor: col-resize !important; }

.dock.clips, .dock.preview-pane {
  background: var(--panel);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  height: 100%;
}
.dock.clips { border-right: 1px solid var(--line); }
.dock.preview-pane {
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 4px 6px;
  overflow: hidden;
}
.panel-head { flex-shrink: 0; }
.panel-head-compact { padding: 4px 6px !important; gap: 4px; }
.panel-head-compact h2 { font-size: 10px; }
.row-btns-mini button {
  padding: 1px 5px;
  min-width: 20px;
  font-size: 11px;
  line-height: 1.2;
}
.panel-win-btns { display: flex; gap: 2px; margin-left: auto; flex-shrink: 0; }
.panel-btn {
  padding: 1px 5px;
  min-width: 20px;
  font-size: 10px;
  line-height: 1.2;
  opacity: 0.85;
}
.panel-btn:hover { opacity: 1; border-color: var(--accent); }

.workspace.detached-clips .dock.clips,
.workspace.detached-clips #splitClips { display: none !important; }
.workspace.detached-preview .dock.preview-pane,
.workspace.detached-preview #splitPreview { display: none !important; }
.workspace.detached-editor .dock.editor { display: none !important; }
.workspace.detached-preview {
  grid-template-columns: var(--w-clips) 4px 1fr;
}
.workspace.detached-clips {
  grid-template-columns: var(--w-preview) 4px 1fr;
}
.workspace.detached-clips.detached-preview {
  grid-template-columns: 1fr;
}

.timeline.detached-timeline { display: none !important; }

.preview-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.preview-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 4px 8px 6px;
  font-size: 11px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.preview-opts label.check {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.preview-zoom-label {
  display: flex;
  align-items: center;
  gap: 4px;
}
.preview-zoom-label.hidden { display: none; }
.preview-zoom-label input[type="range"] {
  width: 72px;
  vertical-align: middle;
}
.preview-zoom-label input[type="number"] { width: 44px; }
.preview-strip-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: stretch;
  overflow: hidden;
}
.preview-body.spin-on .preview-strip-wrap { display: none; }
.preview-spin-wrap {
  flex: 1;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 4px;
  background: #070b14;
}
.preview-spin-wrap.hidden { display: none; }
#btnSaveClip.dirty { box-shadow: 0 0 0 1px var(--accent); }
#radialCanvas {
  display: block;
  border-radius: 50%;
  background: #070b14;
  flex-shrink: 0;
  transform-origin: center center;
}
#stripCanvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  background: #0c0d10;
  border-radius: 6px;
  image-rendering: pixelated;
}
.panel-head, .preview-pane h2 {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; margin: 0;
}
h2 { font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.row-btns { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.clip-list-foot {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px 3px;
  border-top: 1px solid var(--line);
  background: #1e2128;
  flex-shrink: 0;
}
.clip-foot-btn {
  padding: 0 3px;
  min-width: 16px;
  font-size: 10px;
  line-height: 16px;
}
.clip-list-zoom-range {
  flex: 1 1 auto;
  width: 0;
  min-width: 28px;
  height: 12px;
  margin: 0 1px;
  accent-color: var(--accent);
  cursor: pointer;
}
.list-zoom-label {
  font-size: 9px;
  color: var(--muted);
  min-width: 26px;
  text-align: center;
  flex-shrink: 0;
}
.clip-list-scroll {
  flex: 1 1 0;
  height: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  outline: none;
  overscroll-behavior: contain;
}
.clip-list-scroll:focus { box-shadow: inset 0 0 0 1px var(--accent); }
#clipList {
  list-style: none; margin: 0; padding: 2px;
  --list-zoom: 1;
  --clip-thumb-w: calc(40px * var(--list-zoom));
  --clip-thumb-h: calc(28px * var(--list-zoom));
}
#clipList li.clip-list-empty {
  grid-template-columns: minmax(0, 1fr) auto;
  color: var(--muted);
  cursor: default;
}
#clipList li.clip-off { background: #4a2028; border-color: #8b3a4a; }
#clipList li.clip-off.selected { background: #5a2835; border-color: #c44d5f; }
#clipList li.clip-off .idx { color: #e8a0a8; font-size: 0.85em; line-height: 1.15; white-space: nowrap; }
#clipList li.selected { border-color: var(--accent); background: #2a3a5c; }
#clipList li.dragging { opacity: 0.45; pointer-events: none; }
body.clip-list-drag-active {
  user-select: none;
  cursor: grabbing;
}
body.clip-list-drag-active #clipList { cursor: grabbing; }
#clipList li.drop-target.drop-image { outline: 2px dashed #6ea8ff; }
#clipList li.drop-target.drop-both { outline: 2px dashed #b388ff; }
#clipList li.drop-target.drop-settings { outline: 2px dashed #e6a23c; }
#clipList li.drop-target.drop-copy { outline: 2px dashed #6ea8ff; }
#clipList li.drop-target.drop-move { outline: 2px dashed var(--ok); }
#clipList li.clip-insert-before { box-shadow: inset 0 3px 0 var(--accent); }
#clipList li.clip-insert-after { box-shadow: inset 0 -3px 0 var(--accent); }
#clipList li.clip-insert-marker {
  height: 3px;
  padding: 0;
  margin: 1px 2px;
  background: var(--accent);
  border: none;
  border-radius: 2px;
  grid-column: 1 / -1;
  pointer-events: none;
}
.clip-list-scroll.drop-insert { box-shadow: inset 0 0 0 2px var(--accent); }
.canvas-wrap.drop-replace { box-shadow: inset 0 0 0 2px #6ea8ff; }
.tl-track.tl-reorder-active { background: rgba(110, 168, 255, 0.04); }
.tl-insert-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 5px;
  margin-left: -2px;
  background: #6ea8ff;
  border-radius: 2px;
  box-shadow: 0 0 0 1px #4a8cff, 0 0 14px rgba(110, 168, 255, 0.85);
  pointer-events: none;
  z-index: 8;
  opacity: 0;
  transition: opacity 0.06s ease;
}
.tl-insert-marker.active {
  opacity: 1;
}
.tl-insert-hint {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #cfe0ff;
  background: rgba(26, 40, 68, 0.96);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid #6ea8ff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  z-index: 1;
}
.tl-clip.tl-dragging {
  opacity: 0.85;
  z-index: 6;
  box-shadow: 0 0 0 2px var(--accent);
}
#clipList canvas {
  width: var(--clip-thumb-w); height: var(--clip-thumb-h);
  background: #111; border-radius: 4px; image-rendering: pixelated;
}
#clipList .idx { color: var(--muted); text-align: center; word-break: break-word; }
.tl-body {
  display: flex;
  flex: 1;
  min-height: 0;
}
.tl-body > .tl-scroll {
  flex: 1;
  min-width: 0;
}
.tl-rail {
  flex-shrink: 0;
  width: 38px;
  background: #12141a;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.tl-rail-spacer {
  height: var(--tl-ruler-h);
  flex-shrink: 0;
  border-bottom: 1px solid var(--line);
  background: #15171c;
}
.tl-group-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 72px;
  padding: 4px 0;
}
.tl-group-bar.hidden { display: none; }
.tl-group-arrow {
  font-size: 9px;
  line-height: 1;
  padding: 2px 5px;
  min-width: 24px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}
.tl-group-arrow:hover { border-color: var(--accent); color: var(--accent); }
.tl-group-num {
  font-size: 15px;
  font-weight: 700;
  color: #6eb6ff;
  min-width: 20px;
  text-align: center;
  line-height: 1.1;
  user-select: none;
}
.clip-grp-gutter {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-width: 28px;
  flex-shrink: 0;
  padding: 2px 0;
}
.clip-grp-gutter.hidden { display: none; }
.clip-grp-arrow {
  font-size: 9px;
  line-height: 1;
  padding: 1px 4px;
  min-width: 22px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}
.clip-grp-arrow:hover { border-color: var(--accent); color: var(--accent); }
.clip-grp-num {
  font-size: 13px;
  font-weight: 700;
  color: #6eb6ff;
  min-width: 18px;
  text-align: center;
  line-height: 1.1;
}
.view-group-bar {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-right: 4px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-2);
}
.view-group-bar.hidden { display: none; }
.view-group-label {
  font-size: 11px;
  font-weight: 600;
  color: #6eb6ff;
  min-width: 14px;
  text-align: center;
}
.tl-group-view { margin-right: 8px; }
.ctx-menu hr.ctx-sep { border: none; border-top: 1px solid var(--line); margin: 4px 0; }
.ctx-menu .ctx-group-only.hidden { display: none; }
#clipList small { color: var(--muted); display: block; }

.clip-slot-btns {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 2px;
  max-width: 56px;
  justify-content: flex-end;
}
.clip-btn {
  padding: 0 4px;
  min-width: 18px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
}
.tl-clip .body {
  pointer-events: none;
  position: relative;
  z-index: 3;
  height: 100%;
  padding: 3px 8px 4px;
  padding-right: 50px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-sizing: border-box;
}
.tl-slot-btns {
  position: absolute;
  top: 2px;
  right: 2px;
  flex-direction: row;
  pointer-events: auto;
  z-index: 5;
  max-width: none;
  gap: 1px;
}
.tl-clip .clip-btn {
  padding: 0 3px;
  font-size: 9px;
  min-width: 15px;
  line-height: 16px;
  background: rgba(0, 0, 0, 0.35);
}

.editor { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; overflow: hidden; }
.editor-chrome {
  flex-shrink: 0;
  position: relative;
  z-index: 4;
  background: var(--panel);
}
.editor-chrome .editor-head { border-bottom: 1px solid transparent; }
.editor-head {
  justify-content: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}
.editor-head h2 {
  flex-shrink: 0;
  margin-right: 4px;
}
.editor-head .editor-send {
  flex: 0 1 auto;
  min-width: 0;
}
.editor-head .panel-win-btns {
  margin-left: auto;
  flex-shrink: 0;
}
.editor-chrome:hover .editor-head { border-bottom-color: var(--line); }
.editor-toolbar {
  display: none;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  padding: 8px 10px;
  background: var(--panel);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}
.editor-chrome:hover .editor-toolbar { display: flex; }
.editor-chrome.toolbar-pinned .editor-head { border-bottom-color: var(--line); }
.editor-chrome.toolbar-pinned .editor-toolbar { display: flex !important; }
.tools, .colors, .clip-params, .editor-clip-params { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.editor-clip-params {
  padding: 5px 10px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  gap: 8px;
  background: var(--panel);
}
.editor-clip-params input[type="text"] { width: 72px; }
.editor-clip-params input[type="number"] { width: 44px; }
.editor-clip-params label { font-size: 11px; white-space: nowrap; color: var(--muted); }
.clip-black-bottom-wrap.is-disabled { opacity: 0.42; pointer-events: none; }
.muted-note { font-size: 11px; color: var(--muted); margin-top: 0; }
.tool-sep {
  width: 1px;
  align-self: stretch;
  margin: 2px 4px;
  background: var(--line);
}
.tool-gamma {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.tool-gamma input[type="number"] { width: 44px; }
#btnPinToolbar.tool-pin {
  font-size: 13px;
  line-height: 1;
}
#btnPinToolbar.tool-pin.active {
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.meta { color: var(--muted); }
.canvas-wrap {
  flex: 1; min-height: 0; overflow: auto; position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  background-image:
    linear-gradient(45deg, #14161b 25%, transparent 25%),
    linear-gradient(-45deg, #14161b 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #14161b 75%),
    linear-gradient(-45deg, transparent 75%, #14161b 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  background-color: #101218;
}
.effect-gallery {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(250px, 1fr) minmax(260px, 0.85fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #15181e;
}
.effect-gallery.hidden { display: none; }
.effect-browser, .effect-detail { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.effect-browser { border-right: 1px solid var(--line); }
.effect-browser-head, .effect-detail-head { display: flex; align-items: center; gap: 8px; padding: 10px; border-bottom: 1px solid var(--line); }
.effect-browser-head input[type="search"] { width: auto; min-width: 70px; flex: 1; }
.effect-browser-head select { max-width: 140px; }
.effect-catalog { flex: 1 1 0; min-height: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); align-content: start; gap: 7px; padding: 9px; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; }
.effect-card { position: relative; display: grid; grid-template-rows: 66px auto; gap: 4px; min-width: 0; padding: 5px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); text-align: left; }
.effect-card.selected { border-color: var(--accent); background: #26364d; }
.effect-card canvas { width: 100%; height: 66px; image-rendering: pixelated; background: #0c0e12; border-radius: 3px; }
.effect-card span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.effect-empty { grid-column: 1 / -1; padding: 18px; color: var(--muted); text-align: center; }
.effect-detail-head { min-height: 49px; justify-content: space-between; }
.effect-detail-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.effect-detail-preview { display: block; width: min(100% - 28px, 620px); height: min(44%, 260px); min-height: 100px; margin: 16px auto 10px; image-rendering: pixelated; background: #090b0e; border: 1px solid var(--line); }
.effect-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; padding: 0 14px 12px; }
.effect-controls label { display: grid; grid-template-columns: auto 1fr 46px; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.effect-controls input[type="range"] { min-width: 50px; width: 100%; accent-color: var(--accent); }
.effect-controls input[type="number"] { min-width: 0; width: 100%; }
.effect-controls output { color: var(--text); text-align: right; }
.effect-colors { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 3px 14px 12px; }
.effect-colors label { display: flex; align-items: center; gap: 5px; color: var(--muted); }
.effect-add { align-self: center; margin: 0 0 14px; padding: 7px 18px; }
.effect-add:disabled { opacity: .5; cursor: default; }
.canvas-wrap.effect-mode #pixelCanvas, .canvas-wrap.effect-mode #emptyHint, .canvas-wrap.effect-mode #videoEl { visibility: hidden; }
.canvas-wrap.effect-mode #btnSwitchScreen { display: none; }
.canvas-wrap.effect-mode { overflow: hidden; }
#pixelCanvas { display: block; image-rendering: pixelated; cursor: crosshair; }
.screen-switch-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(26, 40, 68, 0.92);
  border: 1px solid #6ea8ff;
  color: #cfe0ff;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}
.screen-switch-btn:hover { background: rgba(38, 58, 96, 0.96); }
.canvas-wrap.show-video {
  align-items: center;
  justify-content: center;
  background: #000;
  background-image: none;
}
.canvas-wrap.show-video .editor-video {
  display: block;
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  max-height: none;
  min-height: 120px;
}
.canvas-wrap.show-video #pixelCanvas,
.canvas-wrap.show-video #emptyHint { display: none !important; }
.editor-video {
  display: none;
  width: 100%;
  max-height: 100%;
  margin: 0 auto;
  background: #000;
  object-fit: contain;
}
.hint {
  position: absolute; inset: 0; display: grid; place-items: center;
  text-align: center; color: var(--muted); pointer-events: none; padding: 24px;
}
.hint.hidden { display: none; }
.note { color: var(--muted); text-align: center; }

.timeline {
  height: var(--h-timeline);
  min-height: 108px;
  max-height: 520px;
  flex-shrink: 0;
  background: var(--panel);
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.splitter-h {
  height: 4px;
  cursor: row-resize;
  background: linear-gradient(180deg, transparent, var(--line), transparent);
  flex-shrink: 0;
}
.splitter-h:hover { background: var(--accent); }
body.splitting-v { cursor: row-resize; user-select: none; }
body.splitting-v * { cursor: row-resize !important; }
.app.drag-over { outline: 2px dashed var(--accent); outline-offset: -4px; }
.tl-controls {
  display: flex;
  gap: 0;
  align-items: center;
  padding: 4px 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
  font-size: 11px;
  border-bottom: 1px solid rgba(58, 65, 80, 0.45);
}
.tl-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 10px;
}
.tl-group:first-child { padding-left: 0; }
.tl-group + .tl-group {
  border-left: 1px solid rgba(58, 65, 80, 0.65);
}
.tl-group-play { flex-shrink: 0; }
.tl-group-names {
  min-width: 0;
  max-width: 220px;
}
.tl-group-markers { flex: 1 1 auto; min-width: 0; }
.tl-group-zoom {
  margin-left: auto;
  flex-shrink: 0;
  padding-right: 0;
}
.tl-clock {
  font-variant-numeric: tabular-nums;
  min-width: 58px;
  color: var(--text);
}
.tl-controls button { padding: 3px 7px; font-size: 11px; }
.tl-controls label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  margin: 0;
}
.tl-scroll {
  position: relative; flex: 1; min-height: 0; overflow: auto;
  background: #15171c;
}
.tl-inner {
  position: relative; min-width: 100%; min-height: 100%; height: auto;
  display: flex; flex-direction: column;
}
.tl-ruler {
  height: var(--tl-ruler-h); flex-shrink: 0;
  color: var(--muted); font-size: 10px;
  border-bottom: 1px solid var(--line); position: relative;
}
.tl-ruler span { position: absolute; top: 2px; transform: translateX(-50%); }
.tl-video-row {
  display: none;
  flex: 1 1 36%;
  min-height: 26px;
  position: relative;
  border-bottom: 1px solid var(--line);
  background: #0c1018;
  min-width: 100%;
}
.tl-inner.has-video .tl-video-row { display: block; }
.tl-inner.has-video .tl-audio-row { flex: 0 0 28px; }
.tl-inner.has-video .tl-tracks { flex: 1 1 auto; min-height: 0; }
#videoWaveCanvas { display: block; height: 100%; width: 100%; }
.tl-audio-row {
  flex: 0 0 28px;
  height: 28px;
  min-height: 28px;
  max-height: 32px;
  position: relative;
  border-bottom: 1px solid var(--line);
  background: #0e1014;
  min-width: 100%;
}
#waveCanvas { display: block; height: 100%; width: 100%; }
.tl-audio-row.empty::before {
  content: "Аудио — загрузите MP3";
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 11px; pointer-events: none;
}
.tl-marker-layer {
  position: absolute; left: 0; right: 0; top: var(--tl-ruler-h); bottom: 0;
  pointer-events: none; z-index: 2;
}
.tl-marker {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: #ffd166; pointer-events: auto; cursor: ew-resize; z-index: 4;
}
.tl-marker::after {
  content: attr(data-label);
  position: absolute; top: 2px; left: 4px; font-size: 10px;
  background: #ffd166; color: #1b1d22; padding: 1px 4px; border-radius: 3px;
  white-space: nowrap; pointer-events: none;
}
.tl-marker.selected { background: #fff; box-shadow: 0 0 0 1px #ffd166; }
.tl-marker.start { background: #6ea8ff; }
.tl-marker.start::after { background: #6ea8ff; color: #fff; }
.tl-tracks {
  flex: 1 1 auto;
  min-height: 48px;
  min-width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.tl-track {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  height: var(--lane-h, 72px);
  min-height: 40px;
  border-bottom: 1px solid var(--line);
}
.tl-track.active-lane { background: rgba(69, 224, 138, 0.04); }
.tl-lane-head {
  position: sticky;
  left: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 18px;
  max-width: 300px;
  padding: 0 4px;
  background: rgba(21, 23, 28, 0.94);
  border-right: 1px solid var(--line);
}
.tl-track-grip {
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: grab;
  font-size: 11px;
  line-height: 1;
}
.tl-track-grip:active { cursor: grabbing; }
.tl-track-label {
  position: static;
  left: auto;
  top: auto;
  z-index: auto;
  font-size: 11px;
  color: #d5dbe6;
  pointer-events: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tl-track-add {
  flex: 0 0 auto;
  padding: 1px 6px;
  border: 1px solid rgba(110, 168, 255, 0.65);
  border-radius: 4px;
  background: rgba(61, 143, 217, 0.18);
  color: #dbeaff;
  font-size: 10px;
  line-height: 14px;
  cursor: pointer;
}
.tl-track-add:hover {
  border-color: var(--accent);
  background: rgba(61, 143, 217, 0.34);
}
.tl-lane-body { flex: 1; position: relative; min-height: 22px; }
.tl-track-resize {
  height: 6px;
  cursor: ns-resize;
  flex-shrink: 0;
  background: transparent;
}
.tl-track-resize:hover { background: rgba(61, 143, 217, 0.35); }
.tl-track.extra { min-height: 40px; }
.tl-clip {
  position: absolute; top: 4px; bottom: 4px; border-radius: 6px;
  background: var(--clip); border: 1px solid #7ea6ff; overflow: hidden;
  color: white; padding: 0; cursor: grab; user-select: none;
  min-width: 28px; font-size: 11px;
}
.tl-clip-thumb-wrap {
  width: 100%;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0c0d10;
  flex-shrink: 0;
}
.tl-clip-thumb {
  display: block;
  height: 38px;
  width: auto;
  max-width: 100%;
  image-rendering: pixelated;
  flex-shrink: 0;
}
.tl-clip-meta {
  position: relative;
  z-index: 1;
  line-height: 1.25;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
}
.tl-clip-meta b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-clip-meta small { display: block; opacity: 0.92; }
.tl-clip.dragging { opacity: .75; cursor: grabbing; z-index: 5; }
.tl-clip.selected { background: var(--clip-on); outline: 2px solid #fff; }
.tl-clip.off { background: #5c2a35; border-color: #8b3a4a; color: #f0d0d4; }
.tl-clip.off.selected { background: #6a3340; outline-color: #e8a0a8; }
.tl-clip .handle {
  position: absolute; top: 0; width: 8px; height: 100%; cursor: ew-resize;
  background: rgba(255,255,255,.22); z-index: 2;
}
.tl-clip .handle:hover { background: rgba(255,255,255,.4); }
.tl-clip:has(.handle.left:hover),
.tl-clip:has(.handle.right:hover),
.tl-clip:has(.handle.fade-tl:hover),
.tl-clip:has(.handle.fade-tr:hover),
.tl-clip.tl-handle-active {
  outline: 2px solid #fff;
  outline-offset: -1px;
  box-shadow: 0 0 0 2px rgba(110, 168, 255, 0.45);
  z-index: 5;
}
.tl-clip:has(.handle.fade-tl:hover),
.tl-clip:has(.handle.fade-tr:hover),
.tl-clip.tl-handle-active:has(.handle.fade-tl),
.tl-clip.tl-handle-active:has(.handle.fade-tr) {
  outline-color: #b388ff;
  box-shadow: 0 0 0 2px rgba(179, 136, 255, 0.4);
}
.tl-clip .handle.right {
  right: 0;
  top: 22px;
  height: calc(100% - 22px);
}
.tl-clip .handle.left { left: 0; }
.tl-clip .handle.fade-tl,
.tl-clip .handle.fade-tr {
  top: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid #b388ff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  z-index: 6;
}
.tl-clip .handle.fade-tl {
  left: 0;
  cursor: nesw-resize;
}
.tl-clip .handle.fade-tr {
  right: 0;
  left: auto;
  cursor: nwse-resize;
}
.tl-clip .handle.fade-tl:hover,
.tl-clip .handle.fade-tr:hover {
  background: #fff;
  border-color: #d4b8ff;
}
.tl-fade-in,
.tl-fade-out {
  position: absolute;
  top: 0;
  height: 100%;
  pointer-events: none;
  z-index: 3;
  overflow: hidden;
}
.tl-fade-in {
  left: 0;
  flex-direction: row;
  align-items: stretch;
}
.tl-fade-out {
  right: 0;
  flex-direction: row;
  align-items: stretch;
  justify-content: flex-end;
}
.tl-fade-cut-in,
.tl-fade-cut-out {
  height: 100%;
  flex-shrink: 0;
  background: #0c0d10;
}
.tl-fade-round-in,
.tl-fade-round-out {
  height: 100%;
  flex-shrink: 0;
}
.tl-fade-round-in {
  background: linear-gradient(to right, #0c0d10 0%, rgba(12, 13, 16, 0.55) 55%, transparent 100%);
}
.tl-fade-round-out {
  background: linear-gradient(to left, #0c0d10 0%, rgba(12, 13, 16, 0.55) 55%, transparent 100%);
}
.tl-clip.has-fade-cut-in .tl-fade-cut-in,
.tl-clip.has-fade-cut-out .tl-fade-cut-out {
  box-shadow: inset -1px 0 0 rgba(179, 136, 255, 0.35);
}
.tl-clip.has-fade-cut-out .tl-fade-cut-out {
  box-shadow: inset 1px 0 0 rgba(179, 136, 255, 0.35);
}
.tl-overlap {
  position: absolute;
  top: 2px;
  bottom: 2px;
  background: rgba(179, 136, 255, 0.28);
  border: 1px solid rgba(179, 136, 255, 0.72);
  border-radius: 8px;
  pointer-events: none;
  z-index: 4;
  box-shadow: inset 0 0 12px rgba(179, 136, 255, 0.18);
}
.tl-clip.tl-overlap-mode {
  outline: 2px dashed #b388ff;
  outline-offset: -1px;
}
.tl-playhead {
  position: absolute; top: 0; bottom: 0; width: 2px; background: var(--danger);
  pointer-events: none; z-index: 6;
}
.tl-start-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #6ea8ff;
  pointer-events: none;
  z-index: 5;
  box-shadow: 0 0 0 1px rgba(110, 168, 255, 0.35);
}
.tl-snap-hint {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ffd166;
  pointer-events: none;
  z-index: 7;
  box-shadow: 0 0 0 1px rgba(255, 209, 102, 0.55), 0 0 10px rgba(255, 209, 102, 0.45);
}
.tl-snap-hint::after {
  content: "метка";
  position: absolute;
  top: 22px;
  left: 4px;
  font-size: 10px;
  color: #1b1d22;
  background: #ffd166;
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
}
.infinite { font-style: italic; opacity: .85; }

.hidden { display: none !important; }

.ctx-menu {
  position: fixed;
  z-index: 2000;
  min-width: 260px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}
.ctx-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  border-radius: 4px;
  font: inherit;
  font-size: 13px;
}
.ctx-menu button:hover:not(:disabled) { background: var(--panel-2); }
.ctx-menu button:disabled { opacity: 0.45; cursor: default; }

.statusbar {
  display: flex; gap: 16px; align-items: center;
  padding: 4px 12px; background: #15171c; border-top: 1px solid var(--line);
  font-size: 11px; color: var(--muted);
}
#statusConn { color: #ff8a8a; }
#uploadTransport { font-size: 12px; padding: 3px 4px; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 4px; width: 100%; min-width: 0; }
.wifi-host { width: 100%; min-width: 0; font-size: 12px; padding: 3px 5px; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 4px; box-sizing: border-box; }
.wifi-ssid { width: 100%; }
.wifi-dev { width: 100%; font-size: 12px; padding: 3px 3px; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 4px; box-sizing: border-box; }
#cursorPos { color: var(--text); min-width: 90px; }
.statusbar .meta { margin-left: auto; }

#clipList li.unsaved { border-color: #e6a23c; }
#clipList li.unsaved b::after { content: " *"; color: #e6a23c; }
button.save-slot.dirty { border-color: #e6a23c; background: #4a3a20; }

.frame-nav { display: inline-flex; gap: 4px; align-items: center; }
#frameNum { min-width: 28px; text-align: center; color: var(--text); }
.ray-opts { display: flex; flex-direction: column; gap: 4px; margin: 4px 0; }
.ray-opts input { width: 56px; }

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: grid; place-items: center; z-index: 100;
}
.modal-box {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px 18px; min-width: 320px; max-width: 420px;
  display: flex; flex-direction: column; gap: 10px;
}
.modal-box.modal-scroll {
  padding: 0;
  max-height: min(90vh, 720px);
  overflow: hidden;
  gap: 0;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
  flex-shrink: 0;
}
.modal-head h3 { margin: 0; }
.modal-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  flex: 1 1 auto;
}
.modal-box.modal-scroll .modal-actions {
  margin-top: 0;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
  background: var(--panel);
}
.modal-close {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.modal-close:hover { color: var(--text); border-color: var(--accent); }
.modal-box h3 { margin: 0 0 4px; font-size: 14px; color: var(--text); }
.modal-box label, .modal-box fieldset { display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
.modal-box fieldset { border: 1px solid var(--line); border-radius: 6px; padding: 8px; }
.modal-box select {
  background: #15171c; border: 1px solid var(--line); border-radius: 4px;
  padding: 4px 6px; color: inherit;
}
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.modal-error { width: min(560px, 94vw); max-width: 560px; }
#modalAppError { z-index: 120; }
.upload-modal-actions { justify-content: space-between; }
.upload-modal-actions .secondary-btn:first-child { margin-right: auto; }
.upload-debug-wrap {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #12141a;
  padding: 6px 8px;
}
.upload-debug-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}
.upload-debug-copy {
  font-size: 11px;
  padding: 2px 8px;
  margin-left: auto;
}
.upload-debug-step {
  color: var(--accent);
  font-weight: 600;
  text-align: right;
  word-break: break-word;
}
.upload-debug-log {
  margin: 0;
  max-height: 140px;
  overflow: auto;
  font: 11px/1.35 ui-monospace, Consolas, monospace;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.app-error-detail {
  margin: 0;
  max-height: min(52vh, 420px);
  overflow: auto;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #12141a;
  color: var(--text);
  font: 12px/1.4 ui-monospace, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}
.import-size-actions { flex-wrap: wrap; justify-content: stretch; }
.import-size-actions button { flex: 1 1 140px; }
.grp-rows label { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; }
.grp-rows input[type="text"] { width: 120px; }
.grp-rows input[type="number"] { width: 56px; }
.grp-rows-head {
  display: grid;
  grid-template-columns: 1.4em 120px 1fr 1fr;
  gap: 6px 8px;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 4px;
  padding: 0 2px;
}
.grp-rows-head.hidden { display: none; }
label.grp-row {
  display: grid !important;
  grid-template-columns: 1.4em 120px 1fr 1fr;
  gap: 6px 8px;
  align-items: center;
  flex-wrap: nowrap !important;
  margin-bottom: 4px;
}
label.grp-row.hidden { display: none !important; }
.grp-row .grp-num { font-weight: 600; color: #6eb6ff; text-align: center; }
.grp-row input[type="text"] { width: 100%; min-width: 0; }
.check-inline { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); }
.prop-strip-list { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 8px; }
.prop-strip-row {
  display: grid !important;
  grid-template-columns: 1fr 160px;
  gap: 8px;
  align-items: center;
}
.prop-strip-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}
.prop-strip-row select { width: 100%; }
.modal-note, .modal-hint { font-size: 11px; color: var(--muted); margin: 0; line-height: 1.4; }
.modal-hint { padding: 6px 8px; background: var(--panel-2); border-radius: 6px; border: 1px solid var(--line); }
.modal-wide { width: min(860px, 96vw); max-height: 90vh; overflow: auto; }
#modalCustomEffect .modal-box { width: min(760px, 96vw); max-width: 760px; max-height: 90vh; overflow: auto; }
#modalCustomEffect textarea { width: 100%; min-height: 280px; resize: vertical; box-sizing: border-box; font: 12px/1.45 Consolas, "Courier New", monospace; color: var(--text); background: #101218; border: 1px solid var(--line); border-radius: 5px; padding: 9px; }
#modalCustomEffect .modal-note:not(.hidden) { color: #ff8b8b; }
.custom-effect-actions { display: flex; gap: 8px; margin: 8px 0; }
.modal-remote { width: min(900px, 96vw); }
.remote-pair-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .remote-pair-grid { grid-template-columns: 1fr; } }
.remote-top-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 8px; }
.remote-top-label { flex: 1 1 140px; font-size: 12px; }
.remote-top-label select, .remote-top-label input { width: 100%; margin-top: 2px; }
.remote-top-btns { flex: 0 0 auto; }
.remote-bind-list { display: flex; flex-direction: column; gap: 0; }
.remote-bind-unit {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 0;
}
.remote-bind-unit + .remote-bind-unit {
  border-top: 1px solid var(--line);
  margin-top: 4px;
}
.remote-bind-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 640px) {
  .remote-bind-cols { grid-template-columns: 1fr; }
}
.remote-col-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.remote-col-head .pm-btn {
  width: 22px;
  height: 22px;
  padding: 0;
  line-height: 1;
  font-size: 14px;
}
.remote-staff-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.remote-staff-rows select,
.remote-col-ctrl select {
  width: 100%;
}
.remote-net-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.remote-net-presets {
  flex: 1 1 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
}
.remote-net-preset-label {
  flex: 1 1 220px;
  font-size: 12px;
}
.remote-net-preset-label select {
  width: 100%;
}
.remote-net-presets .secondary-btn {
  flex: 0 0 auto;
  align-self: flex-end;
}
.remote-net-hint {
  flex: 1 1 100%;
  margin: 0;
  font-size: 11px;
  color: var(--muted);
}
.remote-net-row label {
  flex: 1 1 160px;
  font-size: 12px;
}
.remote-board-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  overflow: auto;
}
.remote-board-item {
  display: grid;
  grid-template-columns: 18px 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 5px 6px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
}
.remote-board-item:hover { background: rgba(255, 255, 255, 0.04); border-color: var(--line); }
.remote-board-item.is-controller {
  border-color: rgba(110, 168, 255, 0.45);
  background: rgba(110, 168, 255, 0.08);
}
.remote-board-item.is-target { border-color: rgba(61, 214, 140, 0.35); }
.remote-board-item input[type="checkbox"] { margin: 0; cursor: pointer; }
.remote-board-item .remote-board-name {
  font-size: 12px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.remote-board-item .remote-board-sub {
  display: block;
  font-size: 10px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.remote-board-item .remote-sync-ip {
  width: 108px;
  font-size: 11px;
  padding: 3px 5px;
}
.remote-board-item .dev-corner {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 9px 9px 0;
  border-color: transparent;
}
.remote-board-item .dev-corner.ok {
  border-top-color: #45e08a;
  border-right-color: #1fa85a;
}
.remote-board-item .dev-corner.bad {
  border-top-color: #ff8a8a;
  border-right-color: #e53935;
  opacity: 0.55;
}
.remote-board-item .dev-corner.air {
  border-top-color: #6eb6ff;
  border-right-color: #3d8fd9;
}
.remote-board-empty {
  font-size: 11px;
  color: var(--muted);
  padding: 8px;
  border: 1px dashed var(--line);
  border-radius: 6px;
}
.remote-online-hint { margin: 0 0 6px; }
.remote-online-hint .online-num { color: #6eb6ff; font-weight: 600; }
.remote-pair-summary { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; font-size: 11px; }
.remote-pair-summary-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.remote-pair-summary-row .remote-num { min-width: 52px; color: var(--muted); }
.remote-pair-summary-row .remote-arrow { color: var(--muted); }
.remote-pair-summary-row .staff-nums { color: #6eb6ff; }
.remote-bind-rows { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.remote-bind-row { display: flex; align-items: center; gap: 8px; }
.remote-bind-row-label { min-width: 62px; font-size: 12px; color: var(--muted); }
.remote-bind-row select { flex: 1; min-width: 0; }
.remote-bind-row .remote-sync-ip { width: 118px; font-size: 12px; }
.remote-sync-block { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
.remote-sync-block legend { font-size: 12px; padding: 0 4px; }
.remote-sync-row { display: flex; flex-wrap: wrap; gap: 8px; }
.remote-sync-label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; flex: 1; min-width: 140px; }
.remote-sync-label input { width: 100%; }
.remote-bind-row select option.online-opt { color: #6eb6ff; }
.remote-btn-rows { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.remote-btn-row { display: flex; align-items: center; gap: 10px; }
.remote-btn-num { min-width: 72px; font-size: 12px; color: var(--muted); }
.remote-btn-row select { flex: 1; }
.secondary-btn {
  font-size: 11px; padding: 4px 8px; border-radius: 4px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer;
}
.secondary-btn.danger { color: var(--danger); }
.secondary-btn:hover { border-color: var(--accent); }

body.popout-window { overflow: hidden; }
body.popout-window .app { height: 100vh; }

body.view-clips .topbar,
body.view-clips .statusbar,
body.view-clips .timeline,
body.view-clips .workspace > :not(.clips) { display: none !important; }
body.view-clips .workspace { display: flex; flex: 1; }
body.view-clips .dock.clips { flex: 1; width: 100%; border: none; }

body.view-preview .topbar,
body.view-preview .statusbar,
body.view-preview .timeline,
body.view-preview .workspace > :not(.preview-pane) { display: none !important; }
body.view-preview .workspace { display: flex; flex: 1; }
body.view-preview .dock.preview-pane { flex: 1; width: 100%; border: none; display: flex; flex-direction: column; }
body.view-preview .preview-body { flex: 1; min-height: 0; }

body.view-editor .topbar,
body.view-editor .statusbar,
body.view-editor .timeline,
body.view-editor .workspace > :not(.editor) { display: none !important; }
body.view-editor .workspace { display: flex; flex: 1; }
body.view-editor .dock.editor { flex: 1; width: 100%; min-height: 0; }

body.view-timeline .topbar,
body.view-timeline .statusbar,
body.view-timeline .workspace,
body.view-timeline #splitTimeline { display: none !important; }
body.view-timeline .app { height: 100vh; display: flex; flex-direction: column; }
body.view-timeline .timeline { flex: 1; height: auto !important; border: none; }

.upload-progress-wrap { display: flex; flex-direction: column; gap: 4px; }
.upload-progress-label {
  display: flex; justify-content: space-between; font-size: 12px; color: var(--muted);
}
.upload-progress {
  height: 10px; background: #1a1d24; border-radius: 5px; overflow: hidden;
  border: 1px solid var(--line);
}
.upload-progress-mem .upload-progress-bar { background: linear-gradient(90deg, #3a7bd5, #6ec0ff); }
.upload-progress-bar {
  height: 100%; width: 0%; background: linear-gradient(90deg, #2d8a5e, #3dd68c);
  transition: width 0.12s ease-out;
}
.upload-times {
  display: flex; gap: 24px; font-size: 12px; color: var(--muted);
}
.upload-times b { color: var(--text); font-weight: 600; }

.upload-board-results {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  max-height: 160px;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.45;
}
.upload-board-results li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
}
.upload-board-results li:last-child { border-bottom: none; }
.upload-board-results .ico {
  flex-shrink: 0;
  width: 1.1em;
  font-weight: 700;
  text-align: center;
}
.upload-board-results li.ok .ico { color: #3dd68c; }
.upload-board-results li.fail .ico { color: #ff8a8a; }
.upload-board-results li.pending .ico { color: var(--muted); }
.upload-board-results .err { color: #ff8a8a; font-size: 11px; }
