/* Uniquifier — Tools tab */

.uq-flash {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 500;
  min-height: 1.2em;
}

.uq-flash.is-ok {
  color: var(--ok);
}

.uq-flash.is-error {
  color: var(--red);
}

.uq-layout {
  display: grid;
  grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.uq-panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  padding: 14px 16px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.uq-panel__title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.uq-drop {
  position: relative;
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 110px;
  padding: 18px 14px;
  border: 1.5px dashed var(--border-strong);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  transition:
    border-color 0.14s var(--ease),
    background 0.14s var(--ease),
    color 0.14s var(--ease);
}

.uq-drop--audio {
  min-height: 96px;
  margin-top: 4px;
}

.uq-drop--audio.has-file {
  border-style: solid;
  border-color: rgba(91, 140, 255, 0.45);
  background: var(--accent-dim);
  color: var(--text);
}

.uq-track-clear {
  margin-top: 8px;
}

.uq-drop:hover,
.uq-drop.is-drag {
  border-color: rgba(91, 140, 255, 0.55);
  background: var(--accent-dim);
  color: var(--text);
}

.uq-drop__icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--accent);
}

.uq-drop__title {
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
}

.uq-drop__hint {
  font-size: 12.5px;
  max-width: 280px;
  line-height: 1.4;
}

.uq-drop input[type='file'] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.uq-file {
  display: none;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  gap: 10px;
  align-items: center;
}

.uq-file.is-on {
  display: flex;
}

.uq-file__meta {
  min-width: 0;
  flex: 1;
}

.uq-file__name {
  font-weight: 650;
  font-size: 13.5px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.uq-file__sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.uq-options {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.uq-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.uq-field {
  display: grid;
  gap: 6px;
}

.uq-field--wide {
  grid-column: 1 / -1;
}

.uq-label {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--muted);
}

.uq-track-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.uq-track-pick {
  position: relative;
  cursor: pointer;
}

.uq-track-name {
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(100%, 240px);
}

.is-hidden {
  display: none !important;
}

#uqMusicWrap[hidden] {
  display: none !important;
}

.uq-audio-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.uq-mode {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 12px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.uq-mode:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.uq-mode.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.uq-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.uq-preview {
  display: grid;
  gap: 10px;
  align-content: start;
  min-width: 0;
}

.uq-screens {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
  min-width: 0;
}

.uq-screen {
  min-width: 0;
  display: grid;
  gap: 6px;
  justify-items: center;
}

.uq-screen__label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  width: 100%;
  text-align: center;
}

.uq-preview__stage {
  position: relative;
  height: min(44vh, 360px);
  width: min(100%, calc(min(44vh, 360px) * 9 / 16));
  max-width: 100%;
  margin: 0 auto;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: #000;
  box-sizing: border-box;
}

.uq-preview__stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}

.uq-preview__empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  background: var(--surface-2);
}

.uq-preview__empty[hidden],
.uq-preview__stage video[hidden] {
  display: none !important;
}

.uq-result-meta {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.4;
}

.uq-result-meta strong {
  color: var(--text);
  font-weight: 650;
}

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

.uq-history {
  margin-top: 6px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  min-height: 0;
}

.uq-history__list {
  display: grid;
  gap: 8px;
  max-height: min(22vh, 180px);
  overflow: auto;
  padding-right: 2px;
}

.uq-hist-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
}

.uq-hist-row__thumb {
  width: 40px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-2);
  flex-shrink: 0;
}

.uq-hist-row__meta {
  min-width: 0;
  flex: 1;
}

.uq-hist-row__name {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.uq-hist-row__sub {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}

.uq-hist-row__actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.uq-busy {
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}

.uq-busy.is-on {
  display: inline-flex;
}

.uq-busy__spin {
  width: 14px;
  height: 14px;
  border: 2px solid var(--accent-dim);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: uq-spin 0.7s linear infinite;
}

@keyframes uq-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 960px) {
  .uq-layout {
    grid-template-columns: 1fr;
  }

  .uq-row {
    grid-template-columns: 1fr;
  }

  .uq-preview__stage {
    height: min(32vh, 260px);
    width: min(100%, calc(min(32vh, 260px) * 9 / 16));
  }

  .uq-history__list {
    max-height: min(28vh, 200px);
  }
}

@media (max-width: 640px) {
  .uq-screens {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .uq-preview__stage {
    height: min(28vh, 220px);
    width: min(100%, calc(min(28vh, 220px) * 9 / 16));
  }
}
