@font-face {  
  font-family: 'Manrope';
  src: url('fonts/Manrope-VariableFont_wght.ttf') format('truetype');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('fonts/JetBrainsMono-VariableFont_wght.ttf') format('truetype');
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

/* Colour and radius tokens from kvalifik.dk */
:root {
  --color-brand--purple-100: #ded0fd;
  --color-brand--purple-200: #cfbff3;
  --color-brand--purple-300: #bbadd9;
  --color-brand--purple-400: #9b89c4;
  --color-brand--purple-500: #6044a2;
  --color-brand--purple-900: #534e5e;
  --color-neutral--black: #1e1e1e;
  --color-neutral--grey-100: #f2f2f2;
  --color-neutral--grey-200: #ebebeb;
  --color-neutral--grey-300: #e3e3e3;
  --color-neutral--grey-400: #d4d4d4;
  --color-neutral--grey-500: #b2b2b2;
  --color-neutral--grey-600: #8b8b8b;
  --color-neutral--grey-700: #6a6a6a;
  --color-neutral--grey-800: #313131;
  --color-neutral--grey-900: #282828;
  --color-neutral--white: #f9f9f9;
  --radius-xsmall: .25rem;
  --radius-small: .5rem;
  --radius-medium: .875rem;
  --radius-large: 1rem;
  --radius-button: 6.25rem;

  /* Semantic tokens (light surfaces). The dock redefines these for dark. */
  --bg: var(--color-neutral--grey-200);
  --text: var(--color-neutral--black);
  --text-2: var(--color-neutral--grey-700);
  --text-3: var(--color-neutral--grey-600);
  --card: var(--color-neutral--grey-100);
  --card-hover: var(--color-neutral--white);
  --line: var(--color-neutral--grey-300);
  --line-strong: var(--color-neutral--grey-400);
  --accent: var(--color-brand--purple-500);
  --highlight: var(--color-brand--purple-100);
  --btn-bg: var(--color-neutral--black);
  --btn-text: var(--color-neutral--white);
  --error: #c4291c;
  --warn: #9a5b00;

  --dock-space: 16rem; /* room left under the grid for the floating dock */
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Manrope', system-ui, sans-serif;
  font-weight: 425;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 3rem 2rem var(--dock-space);
  display: flex;
  flex-direction: column;
  gap: 2rem;
}
@media (max-width: 600px) { .page { padding: 1.75rem 1rem var(--dock-space); } }

/* Disabled while converting. */
fieldset.settings { border: none; min-width: 0; }

.intro { display: flex; flex-direction: column; gap: 0.75rem; }
.intro .tagline { max-width: 680px; }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
/* Baseline alignment: an image's baseline is its bottom edge, which is
   where the logo's letters sit, so "by" lines up with them. */
.logo {
  display: flex; align-items: baseline; gap: 0.4rem; flex-shrink: 0; line-height: 1;
  color: var(--text-2); text-decoration: none; font-size: 0.8rem; transition: opacity 0.2s;
}
.logo:hover { opacity: 0.6; }
.logo img { display: block; height: 0.85rem; width: auto; }
.logo .ext { display: block; color: var(--text); align-self: center; }
h1 { font-size: clamp(2rem, 4vw, 3rem); font-weight: 600; letter-spacing: -0.035em; line-height: 1; }
.tagline { font-size: 0.95rem; color: var(--text-2); }

/* ---- Drop zone: large when empty, a grid tile once videos are added ---- */
.drop-zone {
  border: 1.5px dashed var(--color-neutral--grey-500);
  border-radius: var(--radius-large);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 4rem 1rem;
  min-height: 40vh;
}
.drop-zone:hover, body.drag-over .drop-zone {
  border-color: var(--color-brand--purple-400);
  background: var(--highlight);
}
.drop-zone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.drop-zone .icon {
  width: 3rem; height: 3rem; border-radius: 50%;
  background: var(--btn-bg); color: var(--btn-text);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 300; line-height: 1;
  transition: background 0.2s;
}
.drop-zone .label { font-size: 1rem; font-weight: 600; }
.drop-zone .sub { font-size: 0.8rem; color: var(--text-2); }
.grid .drop-zone { min-height: 0; padding: 1.5rem 1rem; border-radius: var(--radius-small); }
.grid .drop-zone .icon { width: 2.5rem; height: 2.5rem; font-size: 1.25rem; }
.grid .drop-zone .label { font-size: 0.85rem; }

/* ---- Video grid ---- */
.grid {
  display: grid;
  /* 300px keeps the three download buttons (MP4, WebM, Poster) on one row. */
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 1rem;
}
.grid:not(.has-items) { display: block; }

.item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  padding: 0.375rem;
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-size: 0.8rem;
  transition: border-color 0.2s, background 0.2s;
}
.item:hover { background: var(--card-hover); border-color: var(--line-strong); }
.item.working { border-color: var(--accent); }
.item.failed, .item.dupe { border-color: var(--error); }

.thumb {
  position: relative; aspect-ratio: 16 / 9; background: var(--color-neutral--black);
  border-radius: .3125rem; overflow: hidden;
}
.thumb video { width: 100%; height: 100%; object-fit: contain; display: block; }
.thumb .no-preview {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  color: var(--color-neutral--grey-600); font-size: 0.75rem; text-align: center; padding: 1rem;
}
.item.no-preview .thumb video { display: none; }
.item.no-preview .thumb .no-preview { display: flex; }
.badge {
  position: absolute; top: 0.5rem; left: 0.5rem;
  font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em;
  padding: 0.25rem 0.6rem; border-radius: var(--radius-button);
  background: var(--color-neutral--white); color: var(--color-neutral--black);
  pointer-events: none;
}
.badge:empty { display: none; }
.item.working .badge { background: var(--color-brand--purple-200); }
.item.failed .badge { background: var(--error); color: var(--color-neutral--white); }
.thumb .remove {
  position: absolute; top: 0.45rem; right: 0.45rem;
  width: 1.75rem; height: 1.75rem; padding: 0; border-radius: 50%;
  background: rgba(30, 30, 30, 0.75); border: none; color: var(--color-neutral--white);
  font-size: 1.05rem; font-weight: 400; line-height: 1;
  opacity: 0; transition: opacity 0.2s, background 0.2s;
}
.item:hover .thumb .remove, .thumb .remove:focus-visible { opacity: 1; }
.thumb .remove:hover:not(:disabled) { background: var(--error); opacity: 1; }
.item-bar { height: 3px; margin: 0.3rem 0.1rem 0; border-radius: 2px; overflow: hidden; }
.item-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }

.item-body { padding: 0.35rem 0.45rem 0.4rem; display: flex; flex-direction: column; gap: 0.4rem; }
/* Output name: looks like a title, but the dashed underline and pencil
   show it can be edited. */
.name-wrap {
  display: flex; align-items: center; gap: 0.4rem;
  border-bottom: 1px dashed var(--line-strong); transition: border-color 0.2s;
  cursor: text;
  margin: 0; font-size: inherit; font-weight: inherit;
}
.name-wrap:hover { border-bottom-color: var(--text-2); }
.name-wrap:focus-within { border-bottom: 1px solid var(--accent); }
.item .out-name {
  flex: 1; min-width: 0;
  background: transparent; border: none; border-radius: 0;
  color: var(--text); font-family: inherit; font-size: 0.85rem; font-weight: 600;
  padding: 0.15rem 0; outline: none;
  text-overflow: ellipsis;
}
.name-wrap .pencil { flex-shrink: 0; color: var(--text-3); transition: color 0.2s; }
.name-wrap:hover .pencil { color: var(--text); }
.name-wrap:focus-within .pencil { color: var(--accent); }
.item-meta { color: var(--text-2); display: flex; justify-content: space-between; gap: 0.5rem; align-items: baseline; }
.item-meta .info { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.link-btn {
  background: none; border: none; padding: 0; border-radius: 0;
  color: var(--text); font-family: inherit; font-size: 0.8rem; font-weight: 425;
  text-transform: none; letter-spacing: 0;
  text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px;
  cursor: pointer; flex-shrink: 0; transition: color 0.2s;
}
.link-btn:hover:not(:disabled) { color: var(--accent); background: none; }
.link-btn.active { color: var(--accent); }
.trim-row { display: none; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.trim-row.visible { display: grid; }
.trim-row label { font-size: 0.7rem; font-weight: 425; color: var(--text-2); margin-bottom: 0.2rem; }
.trim-row input { font-size: 0.8rem; padding: 0.4rem 0.6rem; }
.item-msg { font-size: 0.75rem; line-height: 1.45; }
.item-msg:empty { display: none; }
.item-msg .err { color: var(--error); display: block; }
.item-msg .warn { color: var(--warn); display: block; }
.item-downloads { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.item-downloads:empty { display: none; }
.dl {
  flex: 1 1 auto;
  background: transparent; color: var(--text); border: 1px solid var(--line-strong);
  border-radius: var(--radius-xsmall);
  font-size: 0.75rem; font-weight: 600; text-transform: none; letter-spacing: 0;
  padding: 0.4rem 0.55rem;
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.05rem; text-align: left;
}
.dl:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); background: transparent; }
.dl .size { color: var(--text-2); font-weight: 425; font-variant-numeric: tabular-nums; }
.diff { color: var(--accent); font-weight: 600; }
/* Output size as a share of the source file. */
.dl .share {
  align-self: stretch; height: 3px; margin-top: 0.25rem;
  border-radius: 2px; background: var(--line);
  overflow: hidden;
}
.dl .share span { display: block; height: 100%; background: var(--accent); }

label {
  font-size: 0.8rem; font-weight: 600; color: var(--text);
  display: block; margin-bottom: 0.5rem;
}
.field { display: flex; flex-direction: column; min-width: 0; }

input[type="number"], input[type="text"] {
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xsmall);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 425;
  padding: 0.55rem 0.75rem;
  width: 100%;
  min-width: 0;
  outline: none;
  transition: border-color 0.2s;
}
input[type="number"]:focus, input[type="text"]:focus { border-color: var(--accent); }
input::placeholder { color: var(--text-3); }
input:disabled { opacity: 0.5; }

.pills { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.pill { position: relative; cursor: pointer; margin: 0; font-weight: 425; }
.pill input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.pill span {
  display: inline-block;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-button);
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
/* Checkbox pills (pick several) are squarer than radio pills (pick one). */
.pill input[type="checkbox"] + span { border-radius: 0.125rem; }
.pill:hover span { border-color: var(--text); }
.pill input:checked + span { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-text); }
.pill input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.custom-width { display: none; }
.custom-width.visible { display: block; }

.check { display: flex; align-items: center; gap: 0.6rem; cursor: pointer; margin: 0; font-size: 0.85rem; font-weight: 425; }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check .box {
  width: 1.1rem; height: 1.1rem; flex-shrink: 0;
  border: 1px solid var(--line-strong); border-radius: var(--radius-xsmall);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.2s, border-color 0.2s;
}
.check .box::after {
  content: ''; width: 0.3rem; height: 0.58rem;
  border: solid var(--btn-text); border-width: 0 2px 2px 0;
  transform: translateY(-1px) rotate(45deg); opacity: 0; transition: opacity 0.2s;
}
.check:hover .box { border-color: var(--text); }
.check input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 2px; }
.check input:checked + .box { background: var(--btn-bg); border-color: var(--btn-bg); }
.check input:checked + .box::after { opacity: 1; }

.hint { font-size: 0.75rem; color: var(--text-2); margin-top: 0.5rem; line-height: 1.5; }
.hint strong { color: var(--text); font-weight: 600; }

button {
  background: var(--btn-bg);
  color: var(--btn-text);
  border: 1px solid var(--btn-bg);
  border-radius: var(--radius-button);
  padding: 0.75rem 1.4rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, opacity 0.2s;
}
button:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: var(--color-neutral--white); }
button:disabled { opacity: 0.35; cursor: not-allowed; }

/* ---- Floating dock (bottom center), dark like kvalifik.dk's dark sections ---- */
.dock {
  --bg: var(--color-neutral--black);
  --text: var(--color-neutral--white);
  --text-2: var(--color-neutral--grey-500);
  --text-3: var(--color-neutral--grey-700);
  --line: var(--color-neutral--grey-800);
  --line-strong: var(--color-neutral--grey-700);
  --accent: var(--color-brand--purple-200);
  --btn-bg: var(--color-neutral--white);
  --btn-text: var(--color-neutral--black);
  --error: #ff8a7a;
  --warn: #f2b45a;

  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  width: min(780px, calc(100% - 2rem));
  background: var(--bg);
  color: var(--text);
  border-radius: var(--radius-large);
  box-shadow: 0 20px 50px rgba(30, 30, 30, 0.28), 0 2px 8px rgba(30, 30, 30, 0.12);
  z-index: 10;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
@media (max-width: 600px) { .dock { bottom: 0.75rem; width: calc(100% - 1.5rem); } }
.dock button:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: var(--color-neutral--black); }
.dock .link-btn { color: var(--text-2); }
.dock .link-btn:hover:not(:disabled) { color: var(--text); background: none; }

/* Drawer: grows upward from the dock's top edge. */
.drawer { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.25s ease; }
.drawer.open { grid-template-rows: 1fr; }
.drawer > .drawer-inner { overflow: hidden; min-height: 0; }
.drawer.open > .drawer-inner { border-bottom: 1px solid var(--line); }
.drawer-body {
  /* Fits whatever space is left above the dock's bar (--dock-chrome is
     measured in JS: bar height + gap under the dock + a top margin). */
  max-height: calc(100vh - var(--dock-chrome, 13rem));
  max-height: calc(100dvh - var(--dock-chrome, 13rem));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.5rem 1.25rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem 1.75rem;
}
.drawer-body .wide { grid-column: 1 / -1; }
@media (max-width: 640px) { .drawer-body { grid-template-columns: 1fr; padding: 1.25rem 1rem; } }

.dock-progress { height: 3px; }
.dock-progress .progress-bar { height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }

.dock-main { padding: 0.9rem 1.1rem 1rem; display: flex; flex-direction: column; gap: 0.8rem; }
.dock-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.dock-row.settings-row { justify-content: space-between; align-items: flex-start; flex-wrap: nowrap; }
.dock-settings { display: flex; flex-direction: column; gap: 0.6rem; min-width: 0; }
.dock-note { font-size: 0.75rem; line-height: 1.45; }
.dock-note:empty { display: none; }
/* Same label width for both rows so the pills line up. */
.dock-settings .dock-label { min-width: 4.75rem; }
@media (max-width: 600px) {
  /* Phones: label on its own line, pills below it. */
  .dock-settings .dock-label { flex-basis: 100%; min-width: 0; }
}
.dock-label { font-size: 0.8rem; color: var(--text-2); margin: 0 0.3rem 0 0; font-weight: 425; }
.dock .pill span { padding: 0.1rem 0.75rem; font-size: 0.8rem; }
.dock .custom-width input { width: 6.5rem; padding: 0.1rem 0.7rem; font-size: 0.8rem; border-radius: var(--radius-button); }
.width-group { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
.drawer-toggle { flex-shrink: 0; margin-top: 0.3rem; }
.drawer-toggle .arrow { display: inline-block; transition: transform 0.2s; text-decoration: none; }
.drawer-toggle[aria-expanded="true"] .arrow { transform: rotate(180deg); }

.dock-status { flex: 1; min-width: 0; font-size: 0.85rem; color: var(--text-2); line-height: 1.45; font-variant-numeric: tabular-nums; }
.dock-status strong { color: var(--text); font-weight: 600; }
.dock-status .err { color: var(--error); }
.dock-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }
.zip-btn { background: transparent; color: var(--text); border-color: var(--line-strong); display: none; }
.zip-btn.visible { display: inline-block; }
.stop-btn { background: transparent; color: var(--text); border-color: var(--line-strong); display: none; }
.stop-btn.visible { display: inline-block; }
#processBtn.hidden { display: none; }
@media (max-width: 520px) {
  .dock-actions { width: 100%; }
  .dock-actions button { flex: 1; }
}

.snippet pre {
  background: var(--color-neutral--grey-900);
  border-radius: var(--radius-small);
  padding: 0.85rem 1rem;
  font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  font-size: 0.72rem;
  line-height: 1.6;
  color: var(--text);
  overflow: auto;
  white-space: pre;
  margin-bottom: 0.6rem;
}
.snippet .copy-btn {
  background: transparent; color: var(--text); border-color: var(--line-strong);
  font-size: 0.75rem; padding: 0.45rem 1rem;
}

.log-box {
  font-size: 0.72rem; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: none;
}
.log-box.visible:not(:empty) { display: block; }

.error-msg, .warn-msg { font-size: 0.8rem; line-height: 1.45; display: none; }
.error-msg { color: var(--error); }
.warn-msg { color: var(--warn); }
.error-msg.visible, .warn-msg.visible { display: block; }
.warn-text { color: var(--warn); }

.browser-notice {
  background-color: var(--error);
  color: var(--color-neutral--white);
  border-radius: var(--radius-small);
  padding: 0.85rem 1rem;
  font-size: 0.85rem;
  line-height: 1.5;
  display: none;
}
.browser-notice.visible { display: block; }
.browser-notice strong { font-weight: 600; }
