:root {
  --bg: #14110c;
  --ink: #f3ece1;
  --muted: #b4a894;
  --line: #3a342b;
  --card: #1d1913;
  --accent: #e23d2b;
  --accent-2: #f0c14a;
  --ok: #6fbf73;
  --warn: #f0c14a;
  --err: #e23d2b;
}

* {
  box-sizing: border-box;
}

/* .drop, .drops and label all set display, which beats the UA rule for [hidden]. */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 500px at 10% -10%, #2a2118 0%, transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: Outfit, ui-sans-serif, system-ui, sans-serif;
}

.frame {
  width: min(980px, calc(100% - 32px));
  margin: 40px auto 72px;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.kicker {
  margin: 0 0 6px;
  color: var(--accent-2);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: Newsreader, Georgia, serif;
  font-size: clamp(40px, 6vw, 64px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 0.9;
}

.limit {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.top-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 500px at 10% -10%, #2a2118 0%, transparent 55%),
    rgba(20, 17, 12, 0.96);
}

.gate-card {
  width: min(420px, 100%);
  padding: 28px 24px;
  background: var(--card);
  border: 1px solid var(--line);
}

.gate-card h1 {
  font-size: 48px;
  margin-bottom: 8px;
}

.gate-card label {
  display: block;
  margin: 18px 0 14px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.gate-card input {
  display: block;
  width: 100%;
  margin-top: 8px;
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: #14110c;
  color: var(--ink);
  font: inherit;
}

.gate-card button {
  height: 46px;
  width: 100%;
  border: 0;
  background: var(--accent);
  color: #fff7f2;
  font-weight: 600;
  cursor: pointer;
}

body.locked .frame {
  visibility: hidden;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 22px;
  border: 1px solid var(--line);
}

.tabs button {
  height: 42px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
}

.tabs button.active {
  background: var(--ink);
  color: var(--bg);
}

.modes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.modes .mode {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.modes .mode.active {
  border-color: var(--accent-2);
  color: var(--accent-2);
}

.hint {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.drop .thumbs img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #0d0b08;
}

.drops {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 14px;
}

.drops.single,
.drops.pair {
  grid-template-columns: 1fr;
}

.drops.pair {
  grid-template-columns: 1fr 1fr;
}

.drop {
  position: relative;
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 240px;
  padding: 18px;
  border: 1px dashed var(--line);
  background: var(--card);
  cursor: pointer;
}

.drop:hover,
.drop.drag {
  border-color: var(--accent-2);
}

.drop input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-label {
  font-size: 18px;
  font-weight: 600;
}

.drop-hint,
.file-name {
  color: var(--muted);
  font-size: 13px;
}

.file-name {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  word-break: break-all;
}

.drop img,
.drop video,
.drop audio,
#result-video,
#result-image {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  background: #0d0b08;
}

#result-video,
#result-image {
  max-height: 480px;
  object-fit: contain;
}

.controls {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.cols-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 16px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.prompt-label {
  margin-bottom: 14px;
}

.check {
  align-content: end;
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
  font-size: 14px;
}

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

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

input[type="text"],
input[type="number"],
select,
textarea {
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: #120f0c;
  color: var(--ink);
}

textarea {
  height: 120px;
  padding: 10px;
  resize: vertical;
  text-transform: none;
  letter-spacing: 0;
  font-size: 15px;
  line-height: 1.45;
}

.advanced {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.advanced summary {
  cursor: pointer;
  color: var(--muted);
}

.advanced-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 22px;
}

.actions .error {
  margin-right: auto;
}

.btn,
form button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  padding: 0 18px;
  border: 0;
  background: var(--accent);
  color: #fff7f2;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

form button[type="submit"] {
  height: 46px;
  min-width: 160px;
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

form button[type="submit"]:disabled,
.tabs button:disabled,
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.error {
  margin: 0;
  color: var(--err);
  text-transform: none;
  letter-spacing: 0;
}

.warning {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-left: 2px solid var(--accent-2);
  background: var(--card);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

.status,
.result {
  margin-top: 28px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--line);
}

.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--warn);
}

.dot.progress {
  background: var(--accent-2);
}

.dot.done {
  background: var(--ok);
}

.dot.fail {
  background: var(--err);
}

.mono,
#elapsed {
  margin-left: auto;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 13px;
  color: var(--muted);
}

#status-copy {
  margin: 10px 0 0;
  color: var(--muted);
}

.result-media {
  background: #0d0b08;
}

.result-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(72px, auto));
  gap: 20px;
  margin: 0;
}

.result-stats dt {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.result-stats dd {
  margin: 4px 0 0;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 16px;
}

.result-actions {
  display: flex;
  flex-shrink: 0;
  gap: 10px;
}

.log-panel {
  margin-top: 28px;
}

.log-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}

.log-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.log-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--card);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
}

th,
td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

td:last-child {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

#log-empty td {
  color: var(--muted);
}

@media (max-width: 800px) {
  .drops,
  .drops.pair,
  .cols-5,
  .cols-4,
  .advanced-grid,
  .modes,
  .tabs {
    grid-template-columns: 1fr;
  }

  .top,
  .result-bar,
  .actions,
  .result-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .result-actions .btn,
  form button[type="submit"] {
    width: 100%;
  }

  .mono {
    margin-left: 0;
  }
}
