:root {
  --bg: #121316;
  --panel: #1a1b1f;
  --panel-2: #1f2126;
  --line: #26282e;
  --line-2: #33363d;
  --text: #ececec;
  --muted: #a3a7af;
  --dim: #8b9098;
  --keep: #3d8bfd;
  --keep-ink: #0b1a33;
  --keep-row: #1d2635;
  --accent: #ff9f43;
  --accent-ink: #1a1205;
  --accent-soft: #ffb877;
  --hatch: repeating-linear-gradient(135deg, #3a3d44 0 6px, #24262b 6px 12px);
  --mono: "Cascadia Mono", "JetBrains Mono", Consolas, ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 14px/1.45 "Segoe UI", Inter, system-ui, -apple-system, sans-serif; min-height: 100vh; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.accent { color: #8fc1ff; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
kbd { font: 12px var(--mono); padding: 1px 6px; border-radius: 4px; border: 1px solid #5a4630; color: #e2a467; }

/* ---------- top bar ---------- */
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 24px; border-bottom: 1px solid var(--line); background: #17181c; position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.file-meta { font-size: 14px; color: var(--muted); padding-left: 12px; border-left: 1px solid #2c2f35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw; }
.file-meta:empty { display: none; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.save-state { font-size: 13px; color: var(--dim); }

.btn { height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); font-weight: 500; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.btn:hover:not(:disabled) { background: #272a30; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: #ffb067; }
.btn-light { background: var(--text); border-color: var(--text); color: var(--bg); font-weight: 600; }
.btn-light:hover:not(:disabled) { background: #ffffff; }
.btn-ghost { background: transparent; }
.btn-marker { background: transparent; border-color: var(--accent); color: var(--accent-soft); font-weight: 600; }
.btn-marker:hover { background: #2a2118 !important; }
.btn[aria-pressed="true"] { background: var(--keep-row); border-color: var(--keep); color: #cfe3ff; }
.btn.big { height: 50px; padding: 0 28px; font-size: 15px; }
.icon-btn { width: 44px; height: 44px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-2); display: inline-flex; align-items: center; justify-content: center; }
.icon-btn.play { border-radius: 50%; background: var(--text); color: var(--bg); border: none; }

.banner { margin: 16px 24px 0; padding: 12px 16px; border-radius: 10px; background: #3a1f22; color: #ffc9c9; border: 1px solid #5a2d31; }

/* ---------- library ---------- */
.library { max-width: 1040px; margin: 0 auto; padding: 36px 24px 60px; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 56px 24px; border: 2px dashed #3a3d44; border-radius: 16px; background: var(--panel); color: var(--muted); cursor: pointer; text-align: center; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: #1e1c1a; color: var(--accent-soft); }
.dz-title { font-size: 18px; font-weight: 600; color: var(--text); }
.dz-sub { font-size: 13px; }
.upload-progress { margin-top: 16px; padding: 18px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.up-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 10px; }
.up-foot .btn { height: 38px; }
.up-label { margin-bottom: 8px; color: var(--muted); }
.lan-hint { margin: 16px 0 0; color: var(--muted); font-size: 14px; }
.lan-hint a { color: #8fc1ff; font-weight: 500; }
.section-title { font-size: 16px; font-weight: 600; margin: 36px 0 14px; }
.video-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.vcard { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.vcard-open { all: unset; cursor: pointer; display: block; }
.vcard-open:focus-visible { outline: 2px solid var(--accent); }
.vcard-thumb { aspect-ratio: 16 / 9; background: #0a0b0d center / cover no-repeat; }
.vcard-body { padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.vcard-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vcard-sub { font-size: 12px; color: var(--muted); }
.vcard-del { width: 36px; height: 36px; flex: none; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--dim); }
.vcard-del:hover { border-color: #5a2d31; color: #ffb3b3; }
.empty { color: var(--muted); }

/* ---------- editor ---------- */
.editor { display: flex; flex-wrap: wrap; gap: 22px; padding: 22px 24px 40px; align-items: flex-start; }
.ed-main { flex: 999 1 640px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.ed-side { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }

.player { position: relative; width: 100%; height: min(56.25vw, 52vh); min-height: 220px; background: #0a0b0d; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.player video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.player-badge { position: absolute; left: 14px; top: 14px; padding: 5px 10px; border-radius: 6px; background: rgba(0,0,0,.65); font-size: 13px; pointer-events: none; }
.player-badge.on { background: rgba(29,38,53,.92); color: #cfe3ff; }
.player-wait { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: rgba(10,11,13,.92); color: var(--muted); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #33363d; border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.spacer { flex: 1 1 auto; }
.timecode { font: 15px var(--mono); padding: 0 6px; }

.bar { height: 8px; border-radius: 4px; background: #2a2c31; overflow: hidden; }
.bar.small { width: 220px; }
.bar-fill { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* timeline */
.timeline-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px 16px; }
.tl-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.tl-title { font-weight: 600; }
.zoom { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; flex-wrap: wrap; justify-content: flex-end; }
.zoom input { width: 200px; accent-color: var(--accent); }
.icon-btn.small { width: 36px; height: 36px; font-size: 18px; color: var(--text); }
.small-btn { height: 36px; padding: 0 12px; font-size: 13px; }
.zoom-label { min-width: 104px; font: 12px var(--mono); color: var(--muted); }
.tl-thumbs-wrap { position: relative; }
.tl-thumbs-hd { position: absolute; inset: 0; pointer-events: none; overflow: hidden; border-radius: 6px; background: #1d1f24; }
.tl-thumbs-hd img { position: absolute; top: 0; height: 100%; object-fit: cover; border-right: 1px solid #121316; background: #2a2d33; }
.tl-scroll, .tl-inner, .timeline-card { touch-action: pan-x; }
.nudge { margin-top: 14px; padding: 12px; border-radius: 10px; background: #221d17; border: 1px solid #3d2c1a; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.nudge b { color: var(--accent-soft); font-weight: 500; }
.nudge-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.nudge-btns .btn { height: 38px; padding: 0 12px; font-size: 13px; }
.nudge-btns #nudgeBack, .nudge-btns #nudgeFwd { flex: 1 1 0; justify-content: center; }
.nudge-btns #nudgeHere { flex: 1 1 100%; justify-content: center; }
.tl-scroll { overflow-x: auto; overflow-y: hidden; padding-bottom: 6px; }
.tl-inner { position: relative; width: 100%; min-width: 100%; padding-top: 24px; user-select: none; }
.tl-inner::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 20px; border-radius: 4px; background: #202227; }
.tl-ruler { position: relative; height: 24px; border-bottom: 1px solid #2c2f35; }
.tick { position: absolute; bottom: 0; height: 6px; border-left: 1px solid #4a4e56; }
.tick.major { height: 10px; border-color: #6b7078; }
.tick span { position: absolute; bottom: 10px; left: 3px; font: 11px var(--mono); color: var(--dim); white-space: nowrap; }
.tl-thumbs-wrap { margin-top: 8px; }
.tl-thumbs { display: flex; height: 58px; border-radius: 6px; overflow: hidden; background: #2a2d33; cursor: ew-resize; }
.tl-thumbs img { flex: 1 1 0; min-width: 0; height: 100%; object-fit: cover; pointer-events: none; opacity: .9; }
.tl-parts { position: relative; height: 40px; margin-top: 8px; border-radius: 6px; overflow: hidden; }
.part { position: absolute; top: 0; bottom: 0; border: none; border-right: 2px solid var(--panel); padding: 0 6px; font: 600 12px inherit; font-family: inherit; overflow: hidden; white-space: nowrap; text-overflow: clip; }
.part.keep { background: var(--keep); color: var(--keep-ink); }
.part.cut { background: var(--hatch); color: var(--muted); }
.part:hover { filter: brightness(1.15); }
.part.current { box-shadow: inset 0 0 0 2px #ffffff; }
.tl-markers { position: absolute; inset: 0; pointer-events: none; }
.marker { position: absolute; top: 2px; bottom: 0; width: 2px; margin-left: -1px; background: var(--accent); }
.marker-handle { touch-action: none; position: absolute; top: 0; left: -9px; width: 20px; height: 22px; pointer-events: auto; cursor: grab; border: none; background: transparent; padding: 0; }
.marker-handle::before { content: ""; position: absolute; left: 3px; top: 2px; width: 14px; height: 14px; background: var(--accent); border-radius: 3px 3px 7px 7px; }
.marker.sel { background: #ffffff; }
.marker.sel .marker-handle::before { background: #ffffff; }
.marker-handle:active { cursor: grabbing; }
.tl-playhead { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #ffffff; pointer-events: none; z-index: 2; }
.tl-playhead span { position: absolute; top: 0; left: -5px; width: 12px; height: 8px; background: #ffffff; clip-path: polygon(0 0, 100% 0, 50% 100%); }

.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; padding-top: 14px; font-size: 13px; color: var(--muted); align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.sw { display: inline-block; width: 14px; height: 14px; border-radius: 3px; }
.sw-keep { background: var(--keep); }
.sw-cut { background: repeating-linear-gradient(135deg, #3a3d44 0 3px, #24262b 3px 6px); }
.sw-marker { width: 3px; background: var(--accent); border-radius: 0; }

/* side cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.card h2 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.hint { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.row { display: flex; gap: 8px; }
.input { flex: 1 1 0; min-width: 0; height: 44px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg); color: var(--text); font-size: 15px; }
.input::placeholder { color: #7d828a; font-family: "Segoe UI", Inter, system-ui, sans-serif; }
.error { margin: 10px 0 0; font-size: 13px; color: #ff9d9d; min-height: 0; }
.error:empty { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip { display: inline-flex; align-items: center; gap: 2px; height: 32px; padding: 0 2px 0 10px; border-radius: 16px; background: #2a2118; color: var(--accent-soft); font: 500 13px var(--mono); }
.chip.sel { background: #3d2c1a; box-shadow: inset 0 0 0 1px var(--accent); }
.chip-time { all: unset; cursor: pointer; }
.chip-x { width: 28px; height: 28px; border: none; border-radius: 14px; background: transparent; color: var(--accent-soft); font-size: 16px; line-height: 1; }
.chip-x:hover { background: #3d2c1a; }

.parts-list { display: flex; flex-direction: column; gap: 6px; max-height: 46vh; overflow-y: auto; }
.prow { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 10px; border-radius: 8px; }
.prow.keep { background: var(--keep-row); }
.prow.current { box-shadow: inset 0 0 0 1px #4b5563; }
.prow-n { width: 20px; flex: none; font-size: 13px; color: var(--dim); }
.prow-range { all: unset; flex: 1 1 auto; min-width: 0; cursor: pointer; font: 500 13px var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow.cut .prow-range { color: var(--dim); text-decoration: line-through; text-decoration-color: #555a62; }
.prow-len { font: 12px var(--mono); color: var(--dim); flex: none; }
.prow-toggle { flex: none; width: 62px; height: 36px; border-radius: 6px; font-weight: 600; font-size: 13px; }
.prow.keep .prow-toggle { background: var(--keep); border: 1px solid var(--keep); color: var(--keep-ink); }
.prow.cut .prow-toggle { background: transparent; border: 1px solid #44474f; color: #c4c7cd; }
.total { display: flex; justify-content: space-between; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; }

/* ---------- export dialog ---------- */
dialog.export { width: min(980px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto; padding: 28px; border-radius: 16px; border: 1px solid var(--line-2); background: #17181c; color: var(--text); }
dialog.export::backdrop { background: rgba(0,0,0,.6); }
dialog.export h2 { margin: 0 0 4px; font-size: 22px; }
dialog.export h3 { margin: 22px 0 10px; font-size: 14px; font-weight: 600; color: #d6d8dc; }
.dlg-close-form { position: absolute; right: 18px; top: 18px; margin: 0; }
.close { color: var(--muted); }
.platforms { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; margin-top: 18px; }
.pcard { text-align: left; padding: 14px; border-radius: 12px; border: 2px solid var(--line-2); background: var(--panel); display: flex; flex-direction: column; gap: 10px; }
.pcard[aria-pressed="true"] { border-color: var(--keep); background: var(--keep-row); }
.pcard-shape { height: 64px; display: flex; align-items: center; justify-content: center; }
.pcard-shape i { display: block; height: 100%; border: 2px solid #5b5f67; border-radius: 3px; background: #23262c; }
.pcard[aria-pressed="true"] .pcard-shape i { border-color: #8fc1ff; }
.pcard-name { font-weight: 600; font-size: 14px; }
.pcard-spec { font: 12px var(--mono); color: var(--muted); }
.ex-row { display: flex; flex-wrap: wrap; gap: 0 28px; }
.ex-block { flex: 1 1 360px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { height: 40px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-2); background: transparent; color: #c4c7cd; font-weight: 600; font-size: 13px; }
.seg button[aria-pressed="true"] { border-color: var(--accent); background: #2a2118; color: var(--accent-soft); }
#mode button[aria-pressed="true"], #quality button[aria-pressed="true"] { border-color: var(--keep); background: var(--keep-row); color: #cfe3ff; }
.previews { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; min-height: 40px; }
.pv { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.pv-frame { position: relative; height: 150px; border-radius: 6px; overflow: hidden; background: #000; border: 1px solid var(--line-2); }
.pv-frame img { position: absolute; inset: 0; width: 100%; height: 100%; }
.pv-frame img.bg { object-fit: cover; filter: blur(10px) brightness(.85); transform: scale(1.15); }
.pv-frame img.fg { object-fit: contain; }
.pv-label { font-size: 12px; color: var(--muted); }
.ex-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.ex-summary { color: var(--muted); font-size: 14px; }
.ex-summary b { color: var(--text); }
.ex-progress { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.ex-progress .btn { align-self: flex-start; height: 38px; }
.ex-prog-row { display: flex; justify-content: space-between; font-size: 14px; }
.ex-files { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.ex-files:empty { display: none; }
.ex-file { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; background: var(--panel); }
.ex-file .name { font: 13px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-file a { color: #8fc1ff; font-weight: 600; white-space: nowrap; }
.ex-files h3 { margin: 10px 0 4px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 10px 16px; border-radius: 10px; background: #2b2e35; border: 1px solid #3a3d44; color: var(--text); z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,.4); }

@media (max-width: 700px) {
  .topbar { padding: 10px 14px; }
  .editor { padding: 14px; }
  .file-meta { display: none; }
  .legend .muted { display: none; }
}

/* ---------- login ---------- */
.auth { min-height: calc(100vh - 70px); display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: min(400px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 30px; display: flex; flex-direction: column; gap: 8px; }
.auth-card h1 { margin: 0; font-size: 22px; }
.auth-card .hint { margin-bottom: 8px; }
.auth-card label, .stack label, .add-user label { font-size: 13px; color: #c4c7cd; margin-top: 6px; display: block; margin-bottom: 6px; }
.auth-card .input { flex: none; width: 100%; }
.auth-card .btn.big { margin-top: 12px; justify-content: center; }
.auth-card .btn-ghost { justify-content: center; }
.user-btn { padding: 0 12px; }
.no-upload { padding: 18px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); margin: 0; }

/* ---------- account + users ---------- */
dialog.small-dlg { width: min(460px, calc(100vw - 32px)); }
.stack { display: flex; flex-direction: column; }
.stack .input { flex: none; width: 100%; }
.stack .btn { align-self: flex-start; margin-top: 12px; }
#accNameForm { padding-bottom: 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.users-wrap { overflow-x: auto; margin-top: 10px; }
table.users { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 760px; }
table.users th { text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 6px; vertical-align: bottom; }
table.users th:first-child, table.users td:first-child { text-align: left; }
table.users td { border-top: 1px solid var(--line); padding: 10px 6px; text-align: center; }
table.users td.uname { font-weight: 600; }
table.users td.uname small { display: block; font-weight: 400; color: var(--dim); font-size: 12px; }
table.users input[type=checkbox], .au-rights input { width: 20px; height: 20px; accent-color: var(--keep); cursor: pointer; }
table.users input:disabled { cursor: not-allowed; opacity: .5; }
.u-actions { display: flex; gap: 6px; justify-content: flex-end; }
.u-actions .btn { height: 36px; padding: 0 10px; font-size: 13px; }
.btn-danger:hover:not(:disabled) { border-color: #5a2d31; color: #ffb3b3; background: #2a1a1c; }
.reset-row td { background: #1d1f24; text-align: left !important; }
.reset-row .row { max-width: 560px; align-items: center; }
.add-user { margin-top: 24px; padding-top: 6px; border-top: 1px solid var(--line); }
.add-grid { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
.add-grid .input { width: 100%; }
.au-rights { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 16px 0 6px; }
.au-rights label { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; color: var(--text); cursor: pointer; }
@media (max-width: 640px) { .add-grid { grid-template-columns: 1fr; } }

/* ---------- tool switch ---------- */
.tool-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.tool-switch button { height: 46px; border: none; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.tool-switch button:hover { color: var(--text); }
.tool-switch button[aria-selected="true"] { background: #2b2e35; color: #ffffff; box-shadow: inset 0 0 0 1px #3a3d44; }
.brick-ico { position: relative; width: 18px; height: 11px; background: #e3342f; border-radius: 2px; margin-top: 3px; }
.brick-ico::before, .brick-ico::after { content: ""; position: absolute; top: -3px; width: 5px; height: 3px; background: #e3342f; border-radius: 1px 1px 0 0; }
.brick-ico::before { left: 3px; } .brick-ico::after { right: 3px; }

/* ---------- BrickCut panel ---------- */
.bc h2 { display: flex; align-items: center; gap: 8px; }
.bc-styles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.bc-style { text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: transparent; color: var(--text); display: flex; flex-direction: column; gap: 2px; }
.bc-style b { font-size: 14px; }
.bc-style span { font-size: 12px; color: var(--muted); }
.bc-style[aria-pressed="true"] { border-color: #f6c343; background: #2a2614; }
.bc-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.bc-actions .btn { flex: 1 1 auto; justify-content: center; }
#bcApply:not(:disabled) { border-color: var(--keep); background: var(--keep-row); color: #cfe3ff; }
.bc-bar { margin-top: 12px; }
.bc-msg { margin: 10px 0 0; font-size: 13px; color: var(--muted); min-height: 1.4em; }
.bc-msg.ok { color: #9be3b5; } .bc-msg.err { color: #ff9d9d; }
.bc-inspect { margin-top: 12px; padding: 12px; border-radius: 10px; background: #1d1f24; border: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.bc-sel { font: 13px var(--mono); color: #d6d8dc; }
.bc-sel .yes { color: #9be3b5; } .bc-sel .no { color: #ff9d9d; }
.bc-inspect-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.bc-inspect-btns .btn { height: 38px; padding: 0 12px; font-size: 13px; }
#bcMark { flex: 1 1 auto; justify-content: center; }
.bc-sec { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.bc-sec summary { cursor: pointer; font-weight: 600; font-size: 14px; padding: 4px 0; list-style-position: inside; }
.bc-sec[open] summary { margin-bottom: 6px; }
.bc-slider { display: block; margin: 12px 0 0; font-size: 13px; color: #c4c7cd; }
.bc-slider .row-l { display: flex; justify-content: space-between; }
.bc-slider .row-l { align-items: center; gap: 8px; }
.bc-num-wrap { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.bc-slider .bc-num { width: 72px; height: 32px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--bg); color: #f6c343; font: 13px var(--mono); text-align: right; }
.bc-num:focus { border-color: #f6c343; outline: none; }
.bc-unit { min-width: 22px; font: 12px var(--mono); color: var(--muted); }
.bc-slider input[type=range] { width: 100%; accent-color: #f6c343; margin: 6px 0 2px; }
.bc-slider .hint { display: block; margin: 0; font-size: 12px; }
.bc-check { display: flex; gap: 8px; align-items: center; font-size: 13px; color: #c4c7cd; margin-top: 6px; }
.bc-check input { width: 18px; height: 18px; accent-color: #f6c343; }
.bc-noise { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: #c4c7cd; }
.bc-noise b { color: #f6c343; font: 12px var(--mono); }
.bc-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 28px; }
.bc-chip { display: inline-flex; align-items: center; height: 30px; padding: 0 2px 0 10px; border-radius: 15px; background: #4da3ff22; border: 1px solid #4da3ff66; color: #9ccbff; font: 12px var(--mono); }
.bc-chip button { width: 26px; height: 26px; border: none; background: transparent; color: inherit; border-radius: 13px; font-size: 15px; }

/* clicks row on the timeline */
.tl-clicks { position: relative; height: 24px; margin-top: 6px; border-radius: 6px; background: #121316; cursor: pointer; }
.clk { position: absolute; top: 4px; bottom: 4px; width: 2px; margin-left: -1px; background: #f6c343; pointer-events: none; }
.clk.rej { background: #5a5f69; top: 8px; bottom: 8px; }
.clk.ex { background: #4da3ff; top: 1px; bottom: 1px; width: 3px; }
.clk.sel { box-shadow: 0 0 0 2px #ffffff; }
.sw-click { width: 3px; background: #f6c343; border-radius: 0; }
.sw-click-rej { width: 3px; background: #5a5f69; border-radius: 0; margin-left: 10px; }
.sw-click-ex { width: 3px; background: #4da3ff; border-radius: 0; margin-left: 10px; }
#legendClicks { display: inline-flex; gap: 6px; }
.chips-summary { font-size: 13px; color: var(--muted); }

.part.thin { border-right: none; min-width: 2px; }
.part.keep.thin { background: #6aa8ff; }
.tl-markers.dense .marker { width: 1px; margin-left: 0; background: rgba(255,159,67,.55); }
.tl-markers.dense .marker-handle { display: none; }
.bc-saved { margin: -2px 0 12px; font-size: 12px; }
.link-btn { border: none; background: none; padding: 0; color: #8fc1ff; font-size: 12px; text-decoration: underline; cursor: pointer; }
.link-btn:hover { color: #bcd9ff; }

/* typing a part's times */
.prow.editing { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px; background: #1d1f24; box-shadow: inset 0 0 0 1px #4b5563; }
.pe-top { display: flex; align-items: flex-end; gap: 8px; }
.pe-field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 0; min-width: 0; font-size: 12px; color: var(--muted); }
.pe-field .input { height: 38px; font-size: 14px; width: 100%; }
.pe-field .input:disabled { opacity: .5; }
.pe-arrow { padding-bottom: 9px; color: var(--muted); }
.pe-hint { margin: 0; font-size: 12px; }
.pe-err { margin: 0; }
.pe-btns { display: flex; gap: 6px; }
.pe-btns .btn { height: 36px; flex: 1 1 0; justify-content: center; font-size: 13px; }
.prow-range:hover { text-decoration: underline; text-decoration-color: #6b7078; }

.brand-home { display: inline-flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; border-radius: 8px; padding: 4px 6px; margin: -4px -6px; }
.brand-home:hover { background: #22242a; }
.brand-home:hover .brand-name { color: #ffffff; }

/* effects between parts */
.fx-field { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: 13px; color: #c4c7cd; }
.fx-field select.input { flex: 0 1 200px; height: 38px; font-size: 14px; padding: 0 8px; }
.fx-field[hidden] { display: none; }
.fx-field .fx-num { width: 64px; height: 34px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--bg); color: var(--text); font: 13px var(--mono); text-align: right; }
.fx-field .fx-num:focus { border-color: var(--accent); outline: none; }
.fx-clear { margin-top: 12px; }
.pjoin { display: flex; align-items: center; gap: 6px; padding: 2px 6px 2px 14px; font-size: 12px; color: var(--muted); }
.pjoin-ico { color: #6b7078; }
.pjoin-sel { flex: 1 1 auto; min-width: 0; height: 30px; border-radius: 6px; border: 1px dashed #3a3d44; background: transparent; color: #c4c7cd; font-size: 12px; padding: 0 4px; }
.pjoin.own .pjoin-sel { border-style: solid; border-color: #8a63d2; color: #e2d6ff; }
.pjoin-sec { width: 44px; height: 30px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--bg); color: var(--text); font: 12px var(--mono); text-align: right; padding: 0 6px; }
.pjoin-unit { font: 12px var(--mono); }
.pjoin-prev { width: 34px; height: 30px; padding: 0; border-radius: 6px; border: 1px solid var(--line-2); background: transparent; color: #c4c7cd; font-size: 12px; white-space: nowrap; }
.pjoin-prev:hover:not(:disabled) { border-color: #8fc1ff; color: #cfe3ff; }
.fx-dlg video { width: 100%; border-radius: 8px; background: #000; margin-top: 12px; }

/* groups, plans, limits */
.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); margin: 12px 0 4px; }
.tabs button { height: 38px; padding: 0 16px; border: none; border-radius: 7px; background: transparent; color: var(--muted); font-weight: 600; }
.tabs button[aria-selected="true"] { background: #2b2e35; color: #fff; }
table.users { min-width: 980px; }
table.users td.u-usage { white-space: nowrap; font: 12px var(--mono); color: #c4c7cd; }
table.users td.u-usage .link-btn { margin-left: 8px; font-family: inherit; }
table.users td.via-group input { opacity: .55; }
.u-group { height: 32px; max-width: 140px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--bg); color: var(--text); font-size: 13px; padding: 0 4px; }
.add-grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin-top: 8px; }
.add-grid select.input { width: 100%; height: 44px; }
.groups-list { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.group-card { border: 1px solid var(--line-2); border-radius: 12px; padding: 14px; background: var(--panel); }
.group-card.new { border-style: dashed; margin-top: 16px; }
.g-head { display: flex; align-items: center; gap: 12px; }
.g-head .g-name { flex: 0 1 260px; height: 40px; font-weight: 600; }
.g-rights { margin: 12px 0 6px; }
.g-limits { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-top: 10px; }
.g-limit { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.g-limit .input { height: 38px; font-size: 14px; width: 100%; }
.g-btns { display: flex; gap: 8px; margin-top: 12px; }
.g-btns .btn { height: 38px; }
.quota { margin: 0 0 14px; padding: 12px 16px; border-radius: 10px; background: #1d2635; border: 1px solid #2c3d5a; color: #cfe3ff; font-size: 14px; }
.quota.empty { background: #2a2118; border-color: #5a4630; color: var(--accent-soft); }
.acc-plan { margin: 0 0 8px; padding: 10px 12px; border-radius: 8px; background: #1d2635; color: #cfe3ff; font-size: 13px; }
.fx-locked { margin: 4px 0 0; font-size: 13px; color: var(--accent-soft); }
#fxCard.locked > :not(h2):not(.fx-locked) { opacity: .45; pointer-events: none; }
.tool-switch button:disabled { opacity: .4; cursor: not-allowed; }
.demo-hint { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.demo-hint .btn { height: 38px; }

#usersDlg { width: min(1260px, calc(100vw - 32px)); }
.g-limit .input, .pe-field .input, .stack .input, .auth-card .input { flex: none; }
table.users { min-width: 1060px; }
table.users td:last-child { white-space: nowrap; }

/* a tool that isn't in the user's plan: visible, but locked */
.tool-switch button { position: relative; white-space: nowrap; }
/* locked tool: a lock takes the place of the tool's icon */
.tool-switch button.locked > svg, .tool-switch button.locked > .brick-ico { display: none; }
.tool-switch button.locked::before { content: "🔒"; font-size: 13px; filter: grayscale(1); opacity: .8; }
#btnMarker:disabled { opacity: .4; cursor: not-allowed; }
.tool-switch button.locked:not([aria-selected="true"]) { opacity: .7; }
.tool-locked { margin: 0 0 14px; padding: 10px 12px; border-radius: 9px; background: rgba(255, 180, 80, .08); border: 1px solid rgba(255, 180, 80, .28); color: #f3c98b; font-size: 13px; line-height: 1.45; }
#handCard.locked > :not(.tool-locked), #bcCard.locked > :not(.tool-locked):not(h2) { opacity: .45; pointer-events: none; }

/* ---------- registering, forgot password, reset link ---------- */
.auth-card.wide { width: min(560px, 100%); }
.auth-links { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; color: var(--muted); }
.auth-links .link-btn { font-size: 13px; }
.plans { border: none; margin: 4px 0 6px; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.plan { position: relative; display: flex !important; flex-direction: column; gap: 4px; margin: 0 !important; padding: 14px 14px 12px; border-radius: 12px; border: 2px solid var(--line-2); background: var(--panel-2); cursor: pointer; color: var(--text) !important; }
.plan:has(input:checked) { border-color: var(--accent); background: #2a2118; }
.plan input { position: absolute; top: 12px; right: 12px; accent-color: var(--accent); }
.plan b { font-size: 15px; padding-right: 22px; }
.plan-price { font-size: 17px; font-weight: 700; color: var(--accent-soft); }
.plan ul { margin: 6px 0 0; padding-left: 16px; font-size: 12px; color: var(--muted); line-height: 1.5; }
#msgCard .hint { font-size: 14px; line-height: 1.55; color: #c4c7cd; }

/* ---------- admin: approvals, password requests ---------- */
#btnUsers .badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #1a1208; font-size: 12px; font-weight: 700; }
.todo-box { margin: 12px 0 16px; padding: 14px 16px; border-radius: 12px; border: 1px solid rgba(255, 159, 67, .4); background: rgba(255, 159, 67, .06); }
.todo-box h3 { margin: 0 0 8px; font-size: 15px; }
.todo-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.todo-row:first-child { border-top: none; }
.todo-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.todo-who small { color: var(--muted); font-size: 12px; }
.todo-btns { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.todo-btns select.input { height: 44px; flex: none; width: auto; min-width: 140px; }
.link-box { display: flex; flex-direction: column; gap: 4px; flex: 1 1 360px; }
.link-box .input { width: 100%; height: 40px; font-size: 12px; }
tr.reset-row td > .row { margin-bottom: 8px; }
tr.reset-row td > .row .input[type=email] { flex: 0 1 300px; }

/* ---------- groups: price ---------- */
.g-price { display: grid; grid-template-columns: 160px 140px 1fr; gap: 10px; align-items: end; margin-top: 12px; }
.g-price .input { height: 44px; width: 100%; }
.g-price .g-limit { justify-content: flex-end; }
.g-price .g-open { align-self: center; margin-top: 18px; }
.g-price .input.missing { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
@media (max-width: 640px) { .g-price { grid-template-columns: 1fr 1fr; } .g-price .g-open { grid-column: 1 / -1; margin-top: 0; } }

/* ---------- settings ---------- */
.settings-form h3 { margin: 18px 0 8px; font-size: 15px; }
.settings-form h3:first-child { margin-top: 6px; }
.settings-form label { font-size: 13px; color: #c4c7cd; display: block; margin-bottom: 6px; }
.settings-form .bc-check { color: var(--text); font-size: 14px; }
.add-grid.st-grid { grid-template-columns: minmax(0, 2fr) minmax(0, .8fr) minmax(0, 1.4fr); margin-top: 8px; }
.add-grid.st-grid select.input { width: 100%; }
.st-mail-state { margin: 0 0 8px; padding: 10px 12px; border-radius: 9px; font-size: 13px; }
.st-mail-state.ok { background: rgba(80, 200, 120, .1); border: 1px solid rgba(80, 200, 120, .35); color: #9be3b4; }
.st-mail-state.off { background: rgba(255, 180, 80, .08); border: 1px solid rgba(255, 180, 80, .28); color: #f3c98b; }
.settings-form > .btn { margin-top: 14px; }
.st-test { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.st-test .input { flex: 0 1 320px; }
@media (max-width: 640px) { .add-grid.st-grid { grid-template-columns: 1fr; } }
.add-grid.st-site { grid-template-columns: 110px minmax(0, 1fr); }
.todo-box h3 { margin-top: 0 !important; }
#accEmailForm { padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }

/* ---------- mirror ---------- */
.mirror-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mir-btn { height: 46px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.mir-btn:hover { border-color: #4a4e57; }
.mir-btn[aria-pressed="true"] { border-color: var(--accent); background: #2a2118; color: var(--accent-soft); }
#editor .player video, #editor .tl-thumbs img, #editor .tl-thumbs-hd img { transform: scale(var(--mx, 1), var(--my, 1)); }
#editor.mir-h { --mx: -1; }
#editor.mir-v { --my: -1; }
