:root {
  color-scheme: dark;
  --bg: #0c1015;
  --panel: #151b22;
  --panel-2: #1d2530;
  --panel-3: #202a35;
  --line: #2d3744;
  --line-soft: #222b36;
  --text: #f1f6fb;
  --muted: #9aa6b4;
  --accent: #35c284;
  --accent-hover: #43d494;
  --video-matte: #dde0e4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei UI", "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.file-button {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: var(--panel-3);
  color: var(--text);
  cursor: pointer;
  line-height: 1;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

button:hover,
.file-button:hover {
  border-color: #445162;
  background: #273343;
}

button:disabled,
.file-button:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.46;
}

.primary {
  border-color: #2dad78;
  background: var(--accent);
  color: #06150e;
  font-weight: 700;
}

.primary:hover {
  border-color: #41d694;
  background: var(--accent-hover);
}

.danger-button {
  border-color: #70404a;
  background: #25191d;
  color: #ffb3be;
}

.danger-button:hover {
  border-color: #a05260;
  background: #332027;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 8, 12, 0.76);
}

.modal-backdrop[hidden] {
  display: none;
}

.export-warning-dialog {
  width: min(560px, calc(100vw - 32px));
  border: 1px solid #a95a32;
  border-radius: 8px;
  background: #141b23;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.46);
  overflow: hidden;
}

.warning-head {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255, 177, 92, 0.22);
  background: #241a16;
}

.warning-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid #ffb15c;
  border-radius: 999px;
  background: #ffb15c;
  color: #1a0d05;
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
}

.warning-head h2 {
  margin: 0;
  font-size: 20px;
  color: #ffe4c6;
}

.warning-head p {
  margin: 7px 0 0;
  color: #ffca98;
  line-height: 1.5;
}

.warning-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  margin: 0;
  padding: 16px 20px 0;
  overflow: auto;
  list-style: none;
}

.warning-list li {
  display: grid;
  gap: 5px;
  padding: 11px 12px;
  border: 1px solid #4a3426;
  border-left: 4px solid #ffb15c;
  border-radius: 7px;
  background: #1c252f;
}

.warning-list strong {
  color: var(--text);
  font-size: 15px;
}

.warning-list span {
  color: #ffcf9d;
  word-break: break-all;
}

.warning-note {
  margin: 14px 20px 0;
  padding: 10px 12px;
  border: 1px solid #43352a;
  border-radius: 7px;
  background: #1d2024;
  color: #ffd4a8;
  line-height: 1.5;
}

.warning-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px 18px;
}

.app-dialog {
  width: min(500px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #141b23;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.46);
  overflow: hidden;
}

.dialog-head {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line-soft);
  background: #18212b;
}

.dialog-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: #06150e;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
}

.app-dialog.is-success {
  border-color: #2dad78;
}

.app-dialog.is-success .dialog-head {
  border-bottom-color: rgba(78, 224, 161, 0.22);
  background: #14231c;
}

.app-dialog.is-danger {
  border-color: #9f4a58;
}

.app-dialog.is-danger .dialog-head {
  border-bottom-color: rgba(255, 130, 148, 0.22);
  background: #24181d;
}

.app-dialog.is-danger .dialog-mark {
  border-color: #ff8294;
  background: #ff8294;
  color: #20070c;
}

.app-dialog.is-warning {
  border-color: #a95a32;
}

.app-dialog.is-warning .dialog-head {
  border-bottom-color: rgba(255, 177, 92, 0.22);
  background: #241a16;
}

.app-dialog.is-warning .dialog-mark {
  border-color: #ffb15c;
  background: #ffb15c;
  color: #1a0d05;
}

.dialog-head h2 {
  margin: 0;
  font-size: 20px;
  color: var(--text);
}

.dialog-head p {
  margin: 7px 0 0;
  color: #c6d1dd;
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.dialog-input-wrap {
  padding: 16px 20px 0;
}

.dialog-input-wrap[hidden] {
  display: none;
}

.dialog-input-wrap input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 11px;
  background: #0f151c;
  color: var(--text);
}

.dialog-input-wrap input:focus {
  outline: 2px solid rgba(53, 194, 132, 0.35);
  outline-offset: 1px;
  border-color: var(--accent);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px 18px;
}

.batch-import-dialog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1180px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #141b23;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.batch-import-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line-soft);
  background: #18212b;
}

.batch-import-heading {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.batch-import-heading h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.batch-import-heading p {
  margin: 6px 0 0;
  color: #c6d1dd;
  line-height: 1.5;
}

.dialog-close-button {
  width: 36px;
  min-width: 36px;
  padding: 0;
  font-size: 24px;
}

.batch-import-body {
  display: grid;
  gap: 16px;
  min-height: 0;
  padding: 16px 20px;
  overflow: auto;
}

.batch-source-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.batch-source-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #111820;
  overflow: hidden;
}

.batch-source-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft);
}

.batch-source-head > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.batch-source-head strong {
  font-size: 15px;
}

.batch-source-head span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.batch-source-head button {
  height: 32px;
  white-space: nowrap;
}

.batch-file-list {
  display: grid;
  align-content: start;
  max-height: 176px;
  overflow: auto;
}

.batch-file-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 36px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line-soft);
}

.batch-file-item:last-child {
  border-bottom: 0;
}

.batch-file-name {
  overflow-wrap: anywhere;
  color: #dce7f1;
  font-size: 12px;
}

.batch-file-state {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.batch-file-state.is-assigned {
  color: #74d8aa;
}

.batch-file-state.is-unassigned,
.batch-row-status.is-problem,
.batch-import-notice.is-problem {
  color: #ffbd76;
}

.batch-file-empty,
.batch-pair-empty {
  display: grid;
  place-items: center;
  min-height: 88px;
  padding: 16px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.batch-pair-empty[hidden] {
  display: none;
}

.batch-pair-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.batch-pair-toolbar > div:first-child {
  display: grid;
  gap: 4px;
}

.batch-pair-toolbar span,
.batch-import-notice {
  color: var(--muted);
  font-size: 13px;
}

.batch-pair-actions,
.batch-import-footer-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.batch-pair-actions button {
  height: 32px;
}

.batch-pair-table-wrap {
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0f151c;
  overflow: auto;
}

.batch-pair-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  table-layout: fixed;
}

.batch-pair-table th,
.batch-pair-table td {
  padding: 8px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: middle;
}

.batch-pair-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #18212b;
  color: #aebbc8;
  font-size: 12px;
  font-weight: 700;
}

.batch-pair-table th:first-child,
.batch-pair-table td:first-child {
  width: 58px;
  text-align: center;
}

.batch-pair-table th:nth-child(2) {
  width: 142px;
}

.batch-pair-table th:nth-child(5) {
  width: 94px;
}

.batch-pair-table th:last-child {
  width: 48px;
}

.batch-pair-table input,
.batch-pair-table select {
  width: 100%;
  min-width: 0;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
  background: var(--panel-2);
  color: var(--text);
}

.batch-pair-table input:focus,
.batch-pair-table select:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(53, 194, 132, 0.24);
  outline-offset: 1px;
}

.batch-row-status {
  color: #74d8aa;
  font-size: 13px;
  white-space: nowrap;
}

.batch-remove-row {
  width: 32px;
  height: 32px;
  padding: 0;
  color: #ffb3be;
}

.batch-import-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  min-height: 66px;
  padding: 13px 20px;
  border-top: 1px solid var(--line-soft);
  background: #141b23;
}

.batch-import-notice {
  min-width: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.export-scope-dialog {
  width: min(620px, calc(100vw - 32px));
}

.export-scope-body {
  display: grid;
  gap: 12px;
  padding: 16px 20px 0;
}

.export-scope-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.export-scope-tools button {
  height: 32px;
}

.export-scope-summary {
  min-height: 22px;
  color: #bfd0df;
  font-size: 14px;
}

.export-scope-list {
  display: grid;
  gap: 8px;
  max-height: min(46vh, 360px);
  overflow: auto;
}

.export-scope-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 62px;
  padding: 10px 12px;
  border: 1px solid #2f3945;
  border-radius: 7px;
  background: #111820;
}

.export-scope-item.is-selected {
  border-color: #2dad78;
  background: #14241d;
}

.export-scope-item.is-disabled {
  opacity: 0.58;
}

.export-scope-item input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.export-scope-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.export-scope-title {
  overflow: hidden;
  color: var(--text);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.export-scope-title em {
  display: inline-block;
  margin-left: 8px;
  border: 1px solid #2dad78;
  border-radius: 999px;
  padding: 2px 7px;
  color: #8be7bc;
  font-size: 12px;
  font-style: normal;
  font-weight: 400;
}

.export-scope-file {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.export-scope-count {
  color: #b6c7d8;
  white-space: nowrap;
}

.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, var(--review-width, 410px));
  grid-template-rows: 58px minmax(0, 1fr) var(--transport-height, 74px);
  gap: 12px;
  height: 100vh;
  padding: 14px;
  overflow: hidden;
}

.topbar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(260px, auto) minmax(420px, 620px);
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

.topbar p,
.section-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.project-field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.project-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.project-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.project-actions button {
  height: 36px;
  white-space: nowrap;
}

.project-field input {
  height: 36px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: var(--panel-2);
  color: var(--text);
}

.switches {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.switches label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
}

.switches input {
  accent-color: var(--accent);
}

.sync-state {
  display: none;
}

.videos {
  grid-column: 1;
  grid-row: 2;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 58px minmax(240px, 1fr) minmax(160px, var(--episode-width, 220px));
  grid-template-rows: minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
}

.sync-bridge {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  place-items: center;
  min-width: 0;
}

.pane[data-side="left"] {
  grid-column: 1;
  grid-row: 1;
}

.pane[data-side="right"] {
  grid-column: 3;
  grid-row: 1;
}

.sync-link-toggle {
  display: grid;
  place-items: center;
  gap: 6px;
  width: 54px;
  min-height: 74px;
  height: auto;
  padding: 9px 6px;
  border-radius: 8px;
  border-color: #2b9c6d;
  background: transparent;
  color: #c7f5df;
  text-align: center;
}

.sync-link-toggle:hover {
  background: rgba(47, 181, 124, 0.08);
}

.sync-link-toggle .chain-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid #42c78b;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
}

.sync-link-toggle strong {
  font-size: 12px;
  line-height: 1.1;
}

.sync-link-toggle:not(.is-linked) {
  border-color: var(--line);
  background: transparent;
  color: var(--muted);
}

.sync-link-toggle:not(.is-linked) .chain-icon {
  border-color: #677280;
}

.pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}

.pane-head {
  display: grid;
  grid-template-columns: minmax(145px, 1fr) auto;
  align-items: center;
  gap: 12px;
  height: 68px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  background: #141b23;
}

.pane-title {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.pane-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.pane-video-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.ghost-button {
  flex: 0 0 auto;
}

.pane-head span {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.pane-head strong {
  display: block;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  line-height: 1.25;
}

.video-meta {
  display: block;
  max-width: 360px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-meta[hidden] {
  display: none;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.pane-head button,
.pane-head .file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  text-align: center;
}

.pane-video-actions > .file-button,
.pane-video-actions > .ghost-button {
  width: 58px;
  padding: 0;
}

.file-button input {
  display: none;
}

.drop {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: var(--video-matte);
}

.drop.dragging {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--video-matte);
}

.video-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.5;
  pointer-events: none;
}

.video-overlay.hidden {
  display: none;
}

.hint {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
  pointer-events: none;
}

.hint b {
  color: var(--text);
  font-size: 20px;
}

.hint.hidden {
  display: none;
}

.pane-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  min-height: 54px;
  padding: 9px 10px;
  border-top: 1px solid var(--line-soft);
  background: #131a22;
}

.pane-controls > span,
.timeline div,
.list-head span {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.pane-controls > span {
  margin-left: auto;
  min-width: 145px;
  text-align: right;
}

.overlay-file-button,
.overlay-panel-toggle,
#toggleOverlay,
#clearOverlay {
  width: 50px;
  min-width: 0;
  height: 36px;
  padding: 0;
  white-space: nowrap;
}

.overlay-controls {
  display: flex;
  flex: 0 1 auto;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
  align-content: center;
  position: relative;
}

.overlay-loaded-control[hidden] {
  display: none !important;
}

.overlay-panel-toggle {
  display: inline-flex;
}

.overlay-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 5;
  display: none;
  align-items: center;
  gap: 8px;
  min-width: 260px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #171e26;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.36);
}

.overlay-panel.is-open {
  display: flex;
}

.overlay-opacity {
  display: inline-flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 7px;
  height: 36px;
  min-width: 0;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #202832;
  color: var(--muted);
  font-size: 12px;
}

.pane-head .overlay-opacity span {
  display: inline;
  margin: 0;
  white-space: nowrap;
  font-size: 12px;
}

.overlay-opacity input {
  width: 76px;
}

.transport {
  grid-column: 1;
  grid-row: 3;
  display: grid;
  grid-template-columns: auto minmax(240px, 1fr) minmax(140px, 170px);
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.transport-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.timeline {
  min-width: 0;
}

.timeline div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.settings {
  display: grid;
  grid-template-columns: minmax(120px, 1fr);
  gap: 8px;
}

.settings label,
.form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.settings input,
.settings select,
.form input,
.form select,
.form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
}

.settings input,
.settings select,
.form input,
.form select {
  height: 34px;
  padding: 0 8px;
}

.review {
  grid-column: 2;
  grid-row: 2 / 4;
  display: grid;
  grid-template-rows: minmax(160px, var(--editor-height, auto)) minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  overflow: hidden;
}

.episode-panel,
.editor,
.list-shell {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
}

.episode-panel {
  grid-column: 4;
  grid-row: 1;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.editor {
  grid-column: 1;
  grid-row: 1;
  padding: 12px;
  overflow: auto;
}

.section-head,
.list-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.export-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.export-actions button {
  height: 34px;
  padding: 0 10px;
}

.section-head h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: 0;
}

.form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 11px;
}

.wide,
#captureTime,
.form-actions {
  grid-column: 1 / -1;
}

.form label:has(#markerTime) {
  display: none;
}

.form textarea {
  min-height: 104px;
  max-height: 190px;
  padding: 10px;
  resize: vertical;
  line-height: 1.5;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.list-shell {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
}

.list-head {
  align-items: center;
  min-height: 46px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line-soft);
}

.episode-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 9px 8px;
  border-bottom: 1px solid var(--line-soft);
}

.episode-actions .episode-batch-action {
  grid-column: 1 / -1;
}

.episode-actions button {
  min-width: 0;
  height: 32px;
  padding: 0 8px;
  white-space: nowrap;
}

.episode-list {
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding: 10px;
}

.episode-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  width: 100%;
  height: auto;
  min-height: 48px;
  padding: 8px 9px;
  border-color: #2f3945;
  background: #131a21;
  text-align: left;
}

.episode-item.is-active {
  border-color: #2dad78;
  background: #18271f;
  box-shadow: inset 3px 0 0 #4ee0a1;
}

.episode-item.is-selected:not(.is-active) {
  border-color: #54718c;
  background: #19242e;
}

.episode-main {
  min-width: 0;
}

.episode-title {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.episode-files {
  overflow: hidden;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.episode-badge {
  align-self: center;
  min-width: 42px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
  white-space: nowrap;
}

.filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 102px;
  gap: 8px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line-soft);
}

.filters input,
.filters select {
  min-width: 0;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
  background: var(--panel-2);
  color: var(--text);
}

.marker-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 10px;
}

.empty {
  display: grid;
  min-height: 160px;
  place-items: center;
  color: var(--muted);
}

.marker {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  grid-template-areas:
    "time tags"
    "time text"
    "time actions";
  gap: 8px 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #131a21;
}

.marker + .marker {
  margin-top: 8px;
}

.marker-meta {
  grid-area: time;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.badge,
.time-button {
  min-height: 28px;
  padding: 5px 7px;
  border-radius: 7px;
  background: #10161d;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.marker-tags {
  grid-area: tags;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #1f2831;
  color: var(--muted);
  font-size: 11px;
}

.time-button {
  width: 48px;
  border: 1px solid #2b3540;
  text-align: center;
}

.marker-text {
  grid-area: text;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  font-size: 14px;
}

.marker-actions {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.marker-actions button {
  height: 28px;
  padding: 0 9px;
  border-color: #2f3945;
  background: #202832;
  color: #d7e1eb;
  font-size: 13px;
}

.marker-actions button:hover {
  background: #2a3440;
}

.layout-resizer {
  z-index: 30;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  border: 0;
  background: transparent;
  touch-action: none;
}

.layout-resizer::after {
  content: "";
  display: block;
  border-radius: 999px;
  background: #3a4654;
  opacity: 0.34;
  transition: opacity 120ms ease, background 120ms ease;
}

.layout-resizer:hover::after,
.layout-resizer.is-active::after {
  background: var(--accent);
  opacity: 0.95;
}

.resize-review,
.resize-episode {
  align-self: stretch;
  width: 12px;
  cursor: col-resize;
}

.resize-review::after,
.resize-episode::after {
  width: 2px;
  height: 100%;
}

.resize-review {
  grid-column: 2;
  grid-row: 2 / 4;
  justify-self: start;
  margin-left: -12px;
}

.resize-episode {
  grid-column: 4;
  grid-row: 1;
  justify-self: start;
  margin-left: -11px;
}

.resize-transport,
.resize-review-stack {
  justify-self: stretch;
  height: 12px;
  cursor: row-resize;
}

.resize-transport::after,
.resize-review-stack::after {
  width: 100%;
  height: 2px;
}

.resize-transport {
  grid-column: 1;
  grid-row: 3;
  align-self: start;
  margin-top: -12px;
}

.resize-review-stack {
  grid-column: 1;
  grid-row: 2;
  align-self: start;
  margin-top: -12px;
}

body.is-layout-resizing,
body.is-layout-resizing * {
  user-select: none;
}

@media (max-width: 1280px) {
  body {
    overflow: auto;
  }

  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(430px, 62vh) auto minmax(520px, auto);
    min-height: 100vh;
    height: auto;
    overflow: visible;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .project-panel {
    grid-template-columns: 1fr;
  }

  .project-actions {
    justify-content: flex-start;
  }

  .switches {
    justify-content: flex-start;
  }

  .transport {
    grid-column: 1;
    grid-row: 3;
    grid-template-columns: 1fr;
  }

  .videos {
    grid-column: 1;
    grid-row: 2;
  }

  .review {
    grid-column: 1;
    grid-row: 4;
    min-height: 520px;
  }

  .resize-review {
    display: none;
  }
}

@media (max-width: 1560px) {
  .pane-head {
    grid-template-columns: minmax(134px, 170px) minmax(0, 1fr);
    gap: 10px;
  }

  .pane-head-actions,
  .pane-video-actions,
  .overlay-controls {
    gap: 6px;
  }

  .overlay-file-button,
  .overlay-panel-toggle,
  #toggleOverlay,
  #clearOverlay {
    width: 46px;
  }

  .pane-video-actions > .file-button,
  .pane-video-actions > .ghost-button {
    width: 54px;
  }
}

@media (max-width: 900px) {
  .app {
    grid-template-rows: auto auto auto minmax(520px, auto);
  }

  .videos {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(360px, 1fr) auto minmax(360px, 1fr) minmax(220px, auto);
  }

  .pane[data-side="left"],
  .sync-bridge,
  .pane[data-side="right"],
  .episode-panel {
    grid-column: 1;
  }

  .pane[data-side="left"] {
    grid-row: 1;
  }

  .sync-bridge {
    grid-row: 2;
  }

  .pane[data-side="right"] {
    grid-row: 3;
  }

  .episode-panel {
    grid-row: 4;
  }

  .resize-episode,
  .resize-transport,
  .resize-review-stack {
    display: none;
  }

  .episode-panel {
    min-height: 220px;
  }

  .episode-list {
    max-height: 240px;
  }

  .sync-link-toggle {
    grid-template-columns: auto auto;
    width: auto;
    min-height: 54px;
    padding: 8px 12px;
  }

  .pane-controls > span {
    margin-left: 0;
    width: 100%;
    text-align: left;
  }
}

@media (max-width: 760px) {
  .modal-backdrop {
    padding: 8px;
  }

  .batch-import-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .batch-import-head,
  .batch-import-body,
  .batch-import-footer {
    padding-left: 12px;
    padding-right: 12px;
  }

  .batch-source-grid {
    grid-template-columns: 1fr;
  }

  .batch-pair-toolbar,
  .batch-import-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .batch-pair-actions,
  .batch-import-footer-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .batch-pair-actions button,
  .batch-import-footer-actions button {
    width: 100%;
  }
}
