/* Same look as Block Grid: one dark surface, filled controls without outlines, quiet lines,
   JetBrains Mono for values, a green accent. Settings over the video cards; while encoding only the cards. */
:root {
  --bg: #1f1f1f;
  --card: #333333;
  --media: #2a2a2a;
  --field: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.045);
  --btn-fill: rgba(255, 255, 255, 0.08);
  --btn-fill-hover: rgba(255, 255, 255, 0.12);
  --text: #e2e2e2;
  --label: #b8b8b8;
  --muted: #8a8a8a;
  --value: #a8a8a8;
  --accent: #4fcf68;
  --accent-soft: #7be08f;
  --accent-tint: rgba(79, 207, 104, 0.22);
  --accent-grad: linear-gradient(270deg, #3fbe5a 4%, #5fd876 87%);
  --danger: #ff6b6b;
  --radius: 8px;
  --field-h: 30px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.ico { display: inline-block; flex: none; width: 16px; height: 16px; background-color: currentColor; -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat; vertical-align: middle; }
input, select, button { outline: none; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 500 14px/1.35 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; letter-spacing: -0.01em; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
button, input, select { font: inherit; color: inherit; letter-spacing: inherit; }

.app { position: relative; display: grid; grid-template-rows: 1fr auto; height: 100vh; }

/* Which step shows what. */
.step-list { display: flex; min-height: 0; }

/* ---------- settings and cards ---------- */
.step-list { flex-direction: column; overflow-y: auto; }

/* Settings sit in the bottom bar, labels above the controls; hidden while encoding. */
.bar-settings { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; min-width: 0; }
.app[data-step="encode"] .bar-settings { display: none; }
.field { display: grid; gap: 5px; min-width: 0; }
.label { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
input[type=text] { width: 100%; min-width: 0; height: var(--field-h); background: var(--field); border: 0; border-radius: var(--radius); padding: 0 9px; color: var(--text); font-size: 14px; }
input[type=text]::placeholder { color: #666; }
select { width: 210px; min-width: 0; height: var(--field-h); border: 0; border-radius: var(--radius); padding: 0 26px 0 9px; color: var(--text); font-size: 14px; appearance: none; -webkit-appearance: none; cursor: pointer; background: var(--field) url(ui/chevron-open.svg) right 7px center / 14px no-repeat; }
select option { background: #363636; }

.folder-btn { display: flex; align-items: center; gap: 8px; width: 200px; height: var(--field-h); padding: 0 10px; border: 0; border-radius: var(--radius); background: var(--field); color: var(--text); font-size: 14px; cursor: pointer; text-align: left; }
.folder-btn:hover { background: var(--btn-fill-hover); }
.folder-btn .ico { width: 15px; height: 15px; color: var(--muted); }
.folder-btn span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.folder-btn.unset { background: var(--accent-tint); color: var(--accent-soft); }
.folder-btn.unset .ico { color: var(--accent); }

/* "name ___ .mp4": the suffix is the only editable part. */
.name-field { display: flex; align-items: center; height: var(--field-h); padding: 0 9px; border-radius: var(--radius); background: var(--field); width: 200px; }
.name-field:focus-within { background: var(--btn-fill-hover); }
.name-field .pre, .name-field .post { color: var(--muted); font-size: 14px; flex: none; }
.name-field .pre { font-style: italic; margin-right: 5px; }
.name-field input { flex: 1; height: 100%; padding: 0; background: none !important; }


/* ---------- cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 28px 24px; padding: 20px; align-content: start; }
/* Adding videos: a tile after the cards; with no videos it fills the area as the drop zone. */
.add-tile { display: block; align-self: start; aspect-ratio: 592 / 416; padding: 20px; border: 0; border-radius: 12px; background: rgba(255, 255, 255, .035); color: var(--muted); cursor: pointer; text-align: center; transition: background .15s; }
/* A <button> centres its content vertically by itself; grid centring inside a button is unreliable in Chrome. */
.add-inner { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.add-tile:hover { background: rgba(255, 255, 255, .06); }
.add-tile .ico { width: 28px; height: 28px; color: var(--accent); margin-bottom: 4px; }
.add-title { font-size: 16px; font-weight: 550; color: var(--text); }
.add-sub { display: none; font-size: 13.5px; font-weight: 550; }
.add-tile.empty { grid-column: 1 / -1; aspect-ratio: auto; align-self: stretch; min-height: 320px; background: none; }
.add-tile.empty:hover { background: none; }
.add-tile.empty .ico { width: 40px; height: 40px; margin-bottom: 6px; }
.add-tile.empty .add-title { font-size: 26px; letter-spacing: -0.02em; }
.add-tile.empty .add-sub { display: block; }
.add-tile:not(.empty), .app[data-step="encode"] .add-tile { display: none; }
.cards:has(> .add-tile.empty) { grid-template-rows: 1fr; }

/* A card (Figma "Frame 3", at about half its size): the picture, the name, then a framed row of
   FPS / Resolution / Codec. No card background: it sits on the page. */
.card { position: relative; display: flex; flex-direction: column; min-width: 0; }

.media { position: relative; aspect-ratio: 592 / 416; border-radius: 12px; background: var(--media); display: grid; place-items: center; overflow: hidden; }
/* The video being encoded: its picture dimmed, the progress bar along its bottom edge. */
.card.encoding .media::after { content: ""; position: absolute; z-index: 1; inset: 0; background: rgba(0, 0, 0, .5); pointer-events: none; }
.media > img, .media > canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.media > video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.media > img { opacity: 0; transition: opacity .25s; }
.media > img.loaded { opacity: 1; }
.media .placeholder { color: #555; }
.media .placeholder .ico { width: 28px; height: 28px; }
.card.failed .media > img { filter: grayscale(1) brightness(.6); }

.badge { position: absolute; z-index: 2; padding: 3px 6px; border-radius: 5px; background: rgba(0, 0, 0, .62); color: #ddd; font: 500 11.5px var(--mono); font-feature-settings: "zero" 1; }
.badge.dur { right: 10px; bottom: 10px; }
.card.encoding .badge.dur { display: none; }

/* Centered state over the picture: a play button on finished videos. */
.overlay { position: absolute; z-index: 2; inset: 0; display: grid; place-items: center; pointer-events: none; }
.play { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .55); color: #fff; opacity: .9; transition: transform .15s, background .15s; }
.play .ico { width: 22px; height: 22px; margin-left: 3px; }
.card.done .media { cursor: pointer; }
.card.done .media:hover .play { transform: scale(1.08); background: rgba(79, 207, 104, .85); }
.card.playing .overlay, .card.playing .badge { display: none; }

/* Live percentage over the frame being encoded. */
.live-pct { position: absolute; z-index: 2; left: 10px; top: 10px; padding: 4px 8px; border-radius: 6px; background: rgba(0, 0, 0, .62); color: #fff; font: 500 13px var(--mono); }

.tools { position: absolute; z-index: 3; right: 8px; top: 8px; display: flex; gap: 4px; opacity: 0; transition: opacity .12s; }
.card:hover .tools, .card:focus-within .tools { opacity: 1; }
.tools .icon-btn { width: 28px; height: 28px; background: rgba(0, 0, 0, .55); color: #ddd; }
.tools .icon-btn:hover { background: rgba(0, 0, 0, .8); color: #fff; }
.tools .ico { width: 15px; height: 15px; }

/* Progress of this video, inside its picture; only while it encodes. */
.media > .card-progress { position: absolute; z-index: 2; left: 14px; right: 14px; bottom: 8px; }
.card-progress::before { background: rgba(255, 255, 255, .18); }
/* Width set directly (updates come 4 times a second): a transition can stall while the window is in the background. */
.card-progress .slider-fill { transition: none; }
.card:not(.encoding) .card-progress { display: none; }

/* "IMG_5542" bright, ".mp4" dim. */
.card-name { margin-top: 16px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 20px; line-height: 1.2; color: #a6a6a6; }
.card-name .ext { color: var(--muted); }

/* One frame split in three, in the design's 179 : 239 : 172 proportions, but never narrower than the text. */
.stats { display: grid; grid-template-columns: minmax(max-content, 179fr) minmax(max-content, 239fr) minmax(max-content, 172fr); margin-top: 11px; border: 1.5px solid #454545; border-radius: 8px; }
.stat { display: grid; gap: 4px; min-width: 0; padding: 9px 11px 10px; }
.stat + .stat { border-left: 1.5px solid #454545; }
/* Same colour as the bar's "Save to" labels. */
.stat-label { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; }
.stat-label .ico { width: 13px; height: 13px; color: var(--muted); }
.stat-value { color: #a6a6a6; font-size: 19px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.card-status { display: flex; align-items: center; gap: 6px; margin-top: 10px; font: 500 12.5px var(--mono); color: var(--label); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-status .ico { width: 14px; height: 14px; flex: none; }
.card.waiting .card-status, .card.cancelled .card-status { color: var(--muted); }
.card.done .card-status { color: var(--accent-soft); }
.card.failed .card-status { color: var(--danger); }
.card-error { margin-top: 4px; color: var(--danger); font-size: 12.5px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 6.5em; overflow: auto; }

/* ---------- buttons ---------- */
.btn { height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: var(--btn-fill); border: 0; border-radius: var(--radius); padding: 0 12px; cursor: pointer; white-space: nowrap; color: var(--label); font-size: 14px; }
.btn:hover { color: var(--text); background: var(--btn-fill-hover); }
.btn .ico { width: 15px; height: 15px; }
.btn.primary { background: var(--accent-grad); color: #12301a; font-weight: 600; padding: 0 16px; }
.btn.primary:hover { filter: brightness(1.08); color: #0c2413; }
.btn:disabled { opacity: .45; cursor: default; filter: none; }
.icon-btn { background: none; border: 0; padding: 0; border-radius: 6px; width: 28px; height: 28px; display: inline-grid; place-items: center; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: var(--btn-fill); color: var(--text); }

/* ---------- bottom bar ---------- */
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; min-height: 76px; padding: 10px 20px; border-top: 1.5px solid var(--line); }
.count { flex: none; font-size: 24px; font-weight: 400; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--label); white-space: nowrap; }
.count .dim { color: #555; }
/* The count sits in the top-left corner over the cards; with no videos there is nothing to show. */
/* Header: the count on the left, a + on the right (sized like Block Grid's project button). */
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 34px; padding: 16px 12px 0 20px; }
.list-head + .cards { padding-top: 14px; }
.add-btn { width: 34px; height: 34px; color: var(--label); }
.add-btn .ico { width: 24px; height: 24px; }
.count .size { margin-left: 12px; color: var(--muted); }
.cards { flex: 1; }
.bar-text.warn { color: var(--danger); }
.bar-text { color: var(--muted); font-size: 13px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-actions { margin-left: auto; display: flex; gap: 8px; }
.slider { --bar: 6px; --h: 20px; position: relative; display: block; height: var(--h); }
.slider::before { content: ""; position: absolute; left: 0; right: 0; top: calc((var(--h) - var(--bar)) / 2); height: var(--bar); border-radius: calc(var(--bar) / 2); background: var(--field); }
.slider-fill { position: absolute; left: 0; top: calc((var(--h) - var(--bar)) / 2); height: var(--bar); width: calc(var(--p, 0) * 100%); border-radius: calc(var(--bar) / 2); background: var(--accent-grad); transition: width .25s linear; }

/* Dragging files over the page: the whole page dims, no frame. */
.drop-hint { position: absolute; z-index: 20; inset: 0; background: rgba(0, 0, 0, .45); pointer-events: none; opacity: 0; transition: opacity .15s; }
.app.dragging .drop-hint { opacity: 1; }
.blocker { position: absolute; z-index: 30; inset: 0; display: grid; place-items: center; padding: 40px; background: var(--bg); text-align: center; color: var(--label); line-height: 1.5; }
.blocker b { display: block; font-size: 20px; font-weight: 500; color: var(--text); margin-bottom: 8px; }

@media (max-width: 760px) {
  .bar { flex-wrap: wrap; height: auto; padding: 12px 16px; }
}
