.workspace {
  display: grid;
  grid-template-columns: 244px minmax(440px, 1fr) 352px;
  gap: 12px;
  align-items: start;
}

.queue,
.settings {
  position: sticky;
  top: 14px;
  max-height: calc(100vh - 28px);
  display: flex;
  flex-direction: column;
}

.queue-list,
.settings-scroll {
  min-height: 0;
  overflow: auto;
  scrollbar-color: #3a4538 transparent;
  scrollbar-width: thin;
}

.queue-list {
  padding: 8px;
}

.queue-empty {
  min-height: 210px;
  padding: 24px 12px;
  display: grid;
  place-items: center;
  color: #626c5f;
  text-align: center;
  font-size: .7rem;
}

.queue-item {
  position: relative;
  min-height: 66px;
  margin-bottom: 5px;
  padding: 8px 28px 8px 8px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #111511;
  cursor: pointer;
  transition: border-color .16s, background .16s;
}

.queue-item:hover {
  border-color: #344032;
  background: #151a15;
}

.queue-item.active {
  border-color: rgba(167, 255, 53, .5);
  background: rgba(167, 255, 53, .055);
}

.queue-item.done { border-color: rgba(106, 230, 142, .28); }
.queue-item.error { border-color: rgba(255, 101, 119, .32); }

.queue-thumb {
  position: relative;
  width: 48px;
  height: 45px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #687265;
  background: #090c09;
}

.queue-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(140deg, rgba(167, 255, 53, .13), transparent 60%);
}

.queue-thumb svg {
  width: 19px;
  height: 19px;
}

.queue-meta {
  min-width: 0;
}

.queue-meta strong,
.queue-meta small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-meta strong {
  color: #d3dbd0;
  font-size: .67rem;
  font-weight: 600;
}

.queue-meta small {
  margin-top: 3px;
  color: #697465;
  font-size: .55rem;
}

.queue-status {
  margin-top: 4px;
  color: var(--accent);
  font-size: .5rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.queue-status.error { color: var(--danger); }

.queue-remove {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 22px;
  height: 22px;
  padding: 0;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  border: 0;
  border-radius: 5px;
  color: #5e685b;
  background: transparent;
  cursor: pointer;
}

.queue-remove:hover {
  color: var(--danger);
  background: rgba(255, 101, 119, .08);
}

.queue-remove svg {
  width: 12px;
  height: 12px;
}

.add-more {
  min-height: 39px;
  margin: 0 8px 8px;
  border: 1px dashed #354033;
  border-radius: 7px;
  color: #7d8879;
  background: rgba(255, 255, 255, .012);
  font-size: .64rem;
  font-weight: 600;
  cursor: pointer;
}

.add-more:hover {
  border-color: rgba(167, 255, 53, .5);
  color: var(--accent);
}

.add-more svg {
  width: 13px;
  height: 13px;
  margin-right: 5px;
}

.queue footer {
  min-height: 42px;
  padding: 0 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  color: #6c7669;
  font-size: .57rem;
}

.queue footer span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.queue footer i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 8px var(--accent-2);
}

.queue footer strong {
  color: #9da898;
  font-size: .61rem;
}

.editor {
  overflow: hidden;
}

.preview-head {
  min-height: 74px;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.source-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.source-title > span {
  flex: 0 0 auto;
  padding: 5px 7px;
  border: 1px solid #3b4738;
  border-radius: 5px;
  color: var(--accent);
  background: rgba(167, 255, 53, .05);
  font-size: .53rem;
  font-weight: 800;
  letter-spacing: .08em;
}

.source-title div { min-width: 0; }

.source-title strong,
.source-title small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-title strong {
  max-width: 45vw;
  color: #dce4d9;
  font-size: .79rem;
}

.source-title small {
  margin-top: 3px;
  color: #687264;
  font-size: .58rem;
}

.preview-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  max-height: 67vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle, #171d16 0, #0c0f0c 65%),
    #090b09;
}

.preview-stage.fit-mode > video {
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  object-fit: contain !important;
  object-position: center center !important;
}

.preview-stage > video {
  width: auto !important;
  height: auto !important;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain !important;
  object-position: center center;
  background: #050605;
}

.placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  color: #4e594b;
  background:
    linear-gradient(rgba(255, 255, 255, .015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .015) 1px, transparent 1px),
    #0b0e0b;
  background-size: 28px 28px;
  font-size: .68rem;
}

.placeholder svg {
  width: 40px;
  height: 40px;
  color: #566450;
  stroke-width: 1.1;
}

.processing {
  position: absolute;
  inset: 0;
  z-index: 5;
  padding: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(7, 9, 7, .93);
  backdrop-filter: blur(8px);
}

.engine-bars {
  height: 42px;
  margin-bottom: 20px;
  display: flex;
  align-items: end;
  gap: 5px;
}

.engine-bars i {
  width: 6px;
  border-radius: 5px;
  background: var(--accent);
  box-shadow: 0 0 14px rgba(167, 255, 53, .28);
  animation: engine-pulse 1s ease-in-out infinite alternate;
}

.engine-bars i:nth-child(1) { height: 17px; }
.engine-bars i:nth-child(2) { height: 38px; animation-delay: -.25s; }
.engine-bars i:nth-child(3) { height: 26px; animation-delay: -.55s; }

@keyframes engine-pulse {
  to { height: 8px; opacity: .35; }
}

.processing strong {
  color: #e2e9df;
  font-size: .86rem;
}

.processing > span {
  max-width: 460px;
  margin-top: 5px;
  overflow: hidden;
  color: #778274;
  font-size: .62rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress {
  width: min(420px, 82%);
  height: 5px;
  margin-top: 24px;
  overflow: hidden;
  border-radius: 10px;
  background: #252c23;
}

.progress i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #73d80e, var(--accent));
  box-shadow: 0 0 10px rgba(167, 255, 53, .3);
  transition: width .15s linear;
}

.progress-info {
  width: min(420px, 82%);
  margin-top: 7px;
  display: flex;
  justify-content: space-between;
  color: #687364;
  font-size: .56rem;
}

.progress-info b { color: var(--accent); }

.timeline {
  padding: 14px 16px 13px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #0c0f0c;
}

.timeline-head {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.timeline-head strong {
  color: #9da796;
  font-size: .57rem;
  letter-spacing: .1em;
}

.timeline-head div {
  display: flex;
  gap: 4px;
}

.timeline-head button {
  height: 25px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #778373;
  background: #131713;
  font-size: .53rem;
  cursor: pointer;
}

.timeline-head button:hover {
  border-color: #465343;
  color: var(--accent);
}

.timeline-track {
  position: relative;
  height: 38px;
  border: 1px solid #2d352b;
  border-radius: 5px;
  background: #080a08;
  cursor: ew-resize;
  touch-action: none;
  user-select: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.timeline-track:hover,
.timeline-track:focus-visible,
.timeline-track.scrubbing {
  border-color: rgba(167, 255, 53, .62);
  box-shadow: inset 0 0 0 1px rgba(167, 255, 53, .13);
  outline: none;
}

.timeline-track.scrubbing {
  cursor: grabbing;
}

.timeline-grid {
  position: absolute;
  inset: 0;
  opacity: .3;
  background: repeating-linear-gradient(90deg, transparent 0, transparent calc(10% - 1px), #556150 10%);
}

.trim-selection {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 100%;
  border-left: 2px solid var(--accent);
  border-right: 2px solid var(--accent);
  background: rgba(167, 255, 53, .15);
  pointer-events: none;
}

.playhead {
  position: absolute;
  z-index: 4;
  top: -3px;
  bottom: -3px;
  left: 0;
  width: 2px;
  transform: translateX(-1px);
  background: #fff;
  box-shadow: 0 0 6px rgba(255, 255, 255, .7);
  pointer-events: none;
}

.playhead::after {
  content: "";
  position: absolute;
  top: -5px;
  left: 50%;
  width: 9px;
  height: 9px;
  border: 2px solid #0a0d08;
  border-radius: 50%;
  background: #fff;
  transform: translateX(-50%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .28);
}

.timeline-track:hover .playhead,
.timeline-track.scrubbing .playhead {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(167, 255, 53, .8);
}

.timeline-track:hover .playhead::after,
.timeline-track.scrubbing .playhead::after {
  background: var(--accent);
}

.trim-range {
  position: absolute;
  z-index: 3;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  pointer-events: none;
}

.trim-range::-webkit-slider-thumb {
  width: 23px;
  height: 38px;
  pointer-events: auto;
  cursor: ew-resize;
}

.trim-range::-moz-range-thumb {
  width: 23px;
  height: 38px;
  border: 0;
  pointer-events: auto;
  cursor: ew-resize;
}

.time-row {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}

.time-row label {
  color: #5d6859;
  font-size: .48rem;
  font-weight: 700;
  letter-spacing: .08em;
}

.time-row label:last-child { text-align: right; }

.time-row input {
  width: 103px;
  margin-left: 6px;
  padding: 3px 5px;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #9ea99a;
  background: transparent;
  font: .57rem ui-monospace, monospace;
}

.time-row label:last-child input {
  margin-right: 0;
  text-align: right;
}

.time-row input:hover,
.time-row input:focus {
  border-color: var(--line);
  background: #131713;
}

.time-row > div { text-align: center; }
.time-row > div b { display: block; color: var(--accent); font-size: .62rem; }
.time-row > div small { display: block; color: #596255; font-size: .49rem; }

.source-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #0b0e0b;
}

.source-stats span {
  min-width: 0;
  padding: 13px 8px;
  border-right: 1px solid var(--line);
  text-align: center;
}

.source-stats span:last-child { border-right: 0; }

.source-stats b,
.source-stats small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-stats b {
  color: #cad3c7;
  font-size: .68rem;
}

.source-stats small {
  margin-top: 2px;
  color: #5d675a;
  font-size: .51rem;
}

.result {
  position: relative;
  padding: 18px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  border-top: 1px solid rgba(106, 230, 142, .23);
  background: linear-gradient(90deg, rgba(106, 230, 142, .065), transparent);
}

.result-check {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(106, 230, 142, .5);
  border-radius: 50%;
  color: var(--accent-2);
  background: rgba(106, 230, 142, .08);
}

.result strong,
.result small {
  display: block;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result strong { color: #dde8da; font-size: .78rem; }
.result small { margin-top: 3px; color: #6f7b6c; font-size: .58rem; }
.result video { display: none; }

.convert-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: #0c0f0c;
}

.engine-status {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.engine-status > i {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #596356;
}

.engine-status > i.ready {
  background: var(--accent-2);
  box-shadow: 0 0 9px rgba(106, 230, 142, .5);
}

.engine-status > i.loading {
  background: var(--warning);
  animation: dot-pulse .8s infinite alternate;
}

.engine-status > i.error { background: var(--danger); }

@keyframes dot-pulse { to { opacity: .25; } }

.engine-status span,
.engine-status b,
.engine-status small { display: block; }
.engine-status b { color: #9ca697; font-size: .61rem; }
.engine-status small { margin-top: 2px; color: #5c6659; font-size: .52rem; }

.convert {
  width: 100%;
  min-height: 48px;
  font-size: .8rem;
}

@media (max-width: 1250px) {
  .workspace {
    grid-template-columns: 210px minmax(420px, 1fr) 320px;
  }

  .format-grid { grid-template-columns: repeat(3, 1fr); }
  select { width: 130px; }
}

@media (max-width: 1010px) {
  .workspace {
    grid-template-columns: 210px minmax(0, 1fr);
  }

  .settings {
    position: static;
    grid-column: 1 / -1;
    max-height: none;
  }

  .settings-scroll { overflow: visible; }
  .preset-grid { grid-template-columns: repeat(3, 1fr); }
  .format-grid { grid-template-columns: repeat(7, 1fr); }
  .settings .setting.compact { display: grid; grid-template-columns: repeat(2, 1fr); column-gap: 28px; }
  .settings .setting.compact .select-row,
  .settings .setting.compact .toggle { min-height: 58px; }
}

@media (max-width: 730px) {
  .workspace { display: block; }

  .queue,
  .settings {
    position: static;
    max-height: none;
    margin-bottom: 12px;
  }

  .queue-list {
    max-height: 230px;
  }

  .editor { margin-bottom: 12px; }
  .preview-stage { max-height: none; }
  .preset-grid { grid-template-columns: repeat(2, 1fr); }
  .format-grid { grid-template-columns: repeat(4, 1fr); }
  .settings .setting.compact { display: block; }
  .source-title strong { max-width: 52vw; }
}

@media (max-width: 470px) {
  .preview-head { padding: 10px; }
  .preview-head > div:last-child { display: none; }
  .source-title strong { max-width: 62vw; }
  .timeline { padding-inline: 10px; }
  .time-row { gap: 3px; }
  .time-row input { display: block; width: 85px; margin: 3px 0 0; }
  .time-row label:last-child input { margin-left: auto; }
  .source-stats { grid-template-columns: repeat(2, 1fr); }
  .source-stats span:nth-child(2) { border-right: 0; }
  .source-stats span:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .result { grid-template-columns: 34px minmax(0, 1fr); }
  .result .btn { grid-column: 1 / -1; }
  .format-grid { grid-template-columns: repeat(3, 1fr); }
}
