/* ================================================================
   AnyGrab — flat slate/azure design
   System fonts, one stylesheet, no framework, no web fonts.
   ================================================================ */

:root {
  --bg: #0a0c11;
  --bg-deep: #07090d;
  --bg-input: #0c1017;
  --surface: #11151d;
  --surface-2: #151b25;
  --surface-3: #1b2330;
  --fg: #eef2f8;
  --muted: #9aa7b8;
  --faint: #6f7c8e;
  --accent: #6ea8fe;
  --accent-2: #8cbcff;
  --accent-ink: #07101f;
  --accent-soft: rgba(110, 168, 254, 0.11);
  --accent-line: rgba(110, 168, 254, 0.38);
  --amber: #f4c15d;
  --red: #ff7b7b;
  --green: #5ad6a0;
  --line: #222a36;
  --line-strong: #334052;
  --radius: 18px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  --ease: cubic-bezier(0.22, 0.8, 0.28, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body.modal-open { overflow: hidden; }

::selection { background: rgba(110, 168, 254, 0.28); color: #fff; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }

button, input, select, textarea { font: inherit; }
button, .btn, .tab, .mode-btn, select, label { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

svg {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  vertical-align: -0.18em;
}
svg.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.skip-link {
  position: fixed;
  top: -60px;
  left: 16px;
  z-index: 120;
  padding: 8px 14px;
  border-radius: 7px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
}
.skip-link:focus { top: 14px; }

/* kept for old shared-page markup */
.page-glow, .glow, .grid-lines { display: none; }

/* ------------------------------------------------------------ topbar ---- */
.topbar {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--fg);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand:hover { color: var(--fg); }
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
}
.brand-mark svg { width: 19px; height: 19px; stroke-width: 2.5; }
.brand-name { font-size: 19px; }
.brand-name span { color: var(--accent); }
.topnav { display: flex; align-items: center; gap: 18px; }
.topnav a {
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition: color 0.18s ease, border-color 0.18s ease;
}
.topnav a:hover { color: var(--fg); border-bottom-color: var(--accent); }

/* -------------------------------------------------------------- main ---- */
.app-main {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 20px 48px;
  flex: 1;
}
.app-title {
  margin: 54px 0 30px;
  text-align: center;
  font-size: clamp(1.9rem, 5vw, 2.7rem);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.04em;
}
.app-title span { color: var(--accent); }

.card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.home-card { padding: 18px 18px 20px; }
.view-in { animation: view-in 0.42s var(--ease) both; }
@keyframes view-in {
  from { opacity: 0; transform: translateY(12px) scale(0.995); }
  to { opacity: 1; transform: none; }
}

/* ------------------------------------------------------- mode switch ---- */
.mode-switch {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}
.mode-glider {
  position: absolute;
  top: 4px;
  left: 0;
  width: 0;
  height: calc(100% - 8px);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-3);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
  transition: transform 0.34s var(--ease), width 0.34s var(--ease);
  pointer-events: none;
}
.mode-btn {
  position: relative;
  z-index: 1;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease;
}
.mode-btn:hover:not(:disabled) { color: var(--fg); }
.mode-btn[aria-selected="true"] { color: var(--fg); }
.mode-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ------------------------------------------------------------ inputs ---- */
.mode-panel:not([hidden]) { animation: panel-in 0.26s var(--ease) both; }
@keyframes panel-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

.url-row { display: flex; gap: 10px; }
.url-field { position: relative; flex: 1; min-width: 0; }
.url-field > svg {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  pointer-events: none;
  width: 18px;
  height: 18px;
}
.url-field input {
  width: 100%;
  height: 54px;
  padding: 0 46px 0 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--fg);
  font-size: 14px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
.url-field input:hover { border-color: var(--muted); }
.url-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.clear-url {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.clear-url:hover { color: var(--fg); background: var(--surface-2); }
.clear-url svg { width: 15px; height: 15px; }

textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
textarea:hover { border-color: var(--muted); }
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.bulk-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.bulk-stats { color: var(--faint); font-family: var(--mono); font-size: 10.5px; }
.field-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
#bulk-limit { margin: 8px 0 14px; }

/* ------------------------------------------------------------ buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 17px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
  font-size: 13.5px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease,
    transform 0.16s var(--ease), box-shadow 0.16s ease;
}
.btn:hover:not(:disabled) {
  background: var(--accent-2);
  border-color: var(--accent-2);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(110, 168, 254, 0.2);
}
.btn:active:not(:disabled) { transform: translateY(0) scale(0.985); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.url-row .btn { height: 54px; padding: 0 20px; }
.btn-ghost {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--fg);
}
.btn-ghost:hover:not(:disabled) {
  border-color: var(--muted);
  background: var(--surface-2);
  color: var(--fg);
  box-shadow: none;
}
.btn-block { width: 100%; }
.btn-small { height: 34px; padding: 0 12px; font-size: 12px; border-radius: 8px; }
.btn-download { height: 48px; min-width: 172px; }

.icon-btn {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  flex: none;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { background: var(--surface-2); color: var(--fg); border-color: var(--line); }
.icon-btn svg { width: 18px; height: 18px; }

/* ------------------------------------------------------- status/errors -- */
.inline-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.inline-status svg { color: var(--accent); }
.alert {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 123, 123, 0.3);
  border-radius: var(--radius-sm);
  background: rgba(255, 123, 123, 0.06);
  color: #ffc9c9;
  font-size: 13px;
  word-break: break-word;
}
.alert svg { margin-top: 2px; color: var(--red); }
.hint { color: var(--muted); font-size: 12.5px; margin: 10px 0 0; }
.hint-action {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--fg);
  font-size: 13px;
}
.hint-action > svg { color: var(--accent); }
.hint-action span { flex: 1 1 200px; }

/* ---------------------------------------------------------- progress ---- */
.progress-card { padding: 24px; }
.progress-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.progress-heading { min-width: 0; }
.eyebrow {
  margin: 0 0 5px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.progress-title {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.42;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.progress-pct {
  flex: none;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
}
.bar {
  height: 10px;
  margin-top: 18px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
}
.bar-fill {
  position: relative;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.38s var(--ease);
  will-change: width;
  overflow: hidden;
}
.bar.working .bar-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}
.progress-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 14px;
  min-height: 1.4em;
  margin-top: 9px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10.5px;
}
.progress-card.is-done { border-color: var(--accent-line); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.actions .btn { flex: 1 1 150px; }

/* ------------------------------------------------------------- share ---- */
.share {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  animation: panel-in 0.3s var(--ease) both;
}
.share-head {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.share-copy { display: flex; gap: 8px; margin-top: 9px; }
.share-copy input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--accent-line);
  border-radius: 7px;
  background: var(--bg-input);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11.5px;
}
.share-copy .btn { flex: none; height: 44px; }
#share-expiry, #share-error, #batch-share-expiry, #batch-share-error { margin-top: 10px; }

/* ------------------------------------------------------- batch items ---- */
.batch-list {
  list-style: none;
  margin: 18px 0 0;
  padding: 4px 10px;
  max-height: 380px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-input);
}
.batch-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  content-visibility: auto;
  contain-intrinsic-size: auto 62px;
}
.batch-item:last-child { border-bottom: 0; }
.batch-icon { flex: none; width: 17px; margin-top: 2px; color: var(--faint); }
.batch-icon svg { width: 15px; height: 15px; }
.batch-icon.done { color: var(--accent); }
.batch-icon.skipped { color: var(--amber); }
.batch-icon.failed { color: var(--red); }
.batch-icon.active { color: var(--accent); }
.batch-main { flex: 1; min-width: 0; }
.batch-title {
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.batch-sub {
  margin: 2px 0 0;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
  overflow-wrap: anywhere;
}
.batch-sub.ok { color: var(--accent); }
.batch-sub.warn { color: var(--amber); }
.batch-sub.bad { color: var(--red); }
.mini-bar {
  height: 3px;
  margin-top: 6px;
  border-radius: 2px;
  background: var(--surface-3);
  overflow: hidden;
}
.mini-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.25s linear;
  will-change: width;
}
.item-actions { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.item-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border: 1px solid var(--accent-line);
  border-radius: 5px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.item-link:hover { border-color: var(--accent); }
.item-link svg { width: 12px; height: 12px; }

/* ------------------------------------------------------------- footer --- */
.site-footer {
  width: 100%;
  max-width: 980px;
  margin: 28px auto 0;
  padding: 22px 24px 32px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px 20px;
  color: var(--faint);
  font-size: 11.5px;
}
.footer-brand { color: var(--fg); font-weight: 700; letter-spacing: -0.01em; }
.footer-note { flex: 1; }
.site-footer a { color: var(--muted); font-weight: 600; }
.site-footer a:hover { color: var(--accent); }

/* ================================================================
   Settings popup
   ================================================================ */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 22px;
  overflow-y: auto;
  background: rgba(4, 6, 10, 0.68);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
  opacity: 0;
  transition: opacity 0.22s ease;
}
.overlay.is-open { opacity: 1; }
.dialog {
  width: min(560px, 100%);
  max-height: min(88vh, 840px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateY(14px) scale(0.975);
  transition: opacity 0.2s ease, transform 0.32s var(--ease);
}
.overlay.is-open .dialog { opacity: 1; transform: none; }
.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.dialog-title { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -0.015em; }
.dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 18px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.dialog-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--line);
  flex: none;
}
.dialog-foot .btn-download { flex: none; margin-left: auto; }

/* ------------------------------------------------------------- media ---- */
.dialog-media {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}
.dialog-thumb {
  flex: none;
  width: 104px;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #000;
  overflow: hidden;
}
.dialog-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-icon {
  flex: none;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}
.media-icon svg { width: 22px; height: 22px; }
.media-text { min-width: 0; }
.media-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1.42;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.media-meta {
  margin: 5px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 11px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
}
.media-meta span { display: inline-flex; align-items: center; gap: 4px; }
.media-meta svg { width: 11px; height: 11px; }
.media-meta b { font-weight: 400; }
.badge {
  flex: none;
  align-self: flex-start;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid var(--accent-line);
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

/* ------------------------------------------------------------- range ---- */
.range-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 12px;
}
.range-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.range-field input {
  width: 80px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 12px;
}
.range-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.range-row .btn { margin-bottom: 1px; }
.range-note { margin-left: auto; padding-bottom: 9px; color: var(--faint); font-size: 10.5px; }

/* -------------------------------------------------------- selection ----- */
.list-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 9px; }
.list-count { margin-left: auto; color: var(--faint); font-family: var(--mono); font-size: 10px; }

.pick-list {
  list-style: none;
  margin: 0;
  padding: 4px;
  max-height: 300px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-input);
}
.pick-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 8px;
  transition: background 0.15s ease, opacity 0.15s ease;
  content-visibility: auto;
  contain-intrinsic-size: auto 54px;
}
.pick-item:hover { background: var(--surface-2); }
.pick-item.is-unchecked { opacity: 0.42; }
.pick-check {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  display: grid;
  place-content: center;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.pick-check::before {
  content: "";
  width: 4px;
  height: 8px;
  margin-top: -2px;
  border: solid var(--accent-ink);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.15s var(--ease);
}
.pick-check:checked { border-color: var(--accent); background: var(--accent); }
.pick-check:checked::before { transform: rotate(45deg) scale(1); }
.pick-thumb {
  flex: none;
  width: 58px;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #000;
  overflow: hidden;
}
.pick-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pick-body { flex: 1; min-width: 0; }
.pick-name {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pick-sub {
  margin: 2px 0 0;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9.5px;
  overflow-wrap: anywhere;
}
.pick-sub.warn { color: var(--amber); }
.pick-sub.bad { color: var(--red); }

/* -------------------------------------------------------------- tabs ---- */
.tabs { display: flex; gap: 22px; margin: 2px 0 16px; border-bottom: 1px solid var(--line); }
.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 0 8px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease;
}
.tab:hover:not(:disabled):not([aria-selected="true"]) { color: var(--fg); }
.tab[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--accent); }
.tab:disabled { opacity: 0.35; cursor: not-allowed; }

/* ------------------------------------------------------------ fields ---- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.field { min-width: 0; }
.field label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.field label svg { color: var(--faint); width: 12px; height: 12px; }
.select { position: relative; }
.select > svg {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  pointer-events: none;
  width: 14px;
  height: 14px;
}
select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 44px;
  padding: 0 36px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--fg);
  font-size: 12.5px;
  cursor: pointer;
  text-overflow: ellipsis;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
select option { background: var(--surface); color: var(--fg); }
select:hover:not(:disabled) { border-color: var(--muted); }
select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select:disabled { cursor: default; color: var(--faint); border-color: var(--line); }
.select:has(select:disabled) > svg { opacity: 0.3; }
#a-hint, #b-audio-hint { margin-top: 10px; }

/* --------------------------------------------------------- segmented ---- */
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0 0; }
.segmented label { position: relative; }
.segmented input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.segmented span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}
.segmented label:hover span { border-color: var(--muted); color: var(--fg); }
.segmented input:checked + span {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--fg);
}
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.output-hint { margin: 8px 0 0; font-size: 11.5px; color: var(--muted); }

/* ----------------------------------------------------------- summary ---- */
.summary {
  display: grid;
  gap: 6px;
  margin: 16px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.summary > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.summary-label {
  flex: none;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.summary-value { color: var(--accent); font-size: 12px; font-weight: 600; text-align: right; }
#batch-limits-text { color: var(--muted); font-weight: 400; }

/* -------------------------------------------------------------- keep ---- */
.keep {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}
.keep input {
  appearance: none;
  -webkit-appearance: none;
  display: grid;
  place-content: center;
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.keep input::before {
  content: "";
  width: 4px;
  height: 8px;
  margin-top: -2px;
  border: solid var(--accent-ink);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.15s var(--ease);
}
.keep input:checked { border-color: var(--accent); background: var(--accent); }
.keep input:checked::before { transform: rotate(45deg) scale(1); }
.keep span { color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.keep:has(input:checked) span { color: var(--fg); }

/* ----------------------------------------------------------- confirm ---- */
.confirm-overlay { z-index: 80; }
.confirm-dialog { width: min(430px, 100%); padding: 22px; }
.confirm-head { display: flex; align-items: flex-start; gap: 13px; }
.confirm-icon {
  flex: none;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
}
.confirm-head .dialog-title { margin-bottom: 5px; }
.confirm-head .hint { margin: 0; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ================================================================
   Shared file / docs pages
   ================================================================ */
.file-page main,
.docs main {
  width: 100%;
  margin: 0 auto;
  padding: 24px 22px 40px;
  flex: 1;
}
.file-page main { max-width: 740px; }
.share-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.file-card .share-title { margin-top: 2px; font-size: clamp(1.25rem, 3vw, 1.6rem); letter-spacing: -0.02em; }
.file-card .hint { margin-top: 10px; }
.file-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 16px; }
.file-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}
.file-meta svg { color: var(--accent); width: 12px; height: 12px; }
.player {
  margin: 0 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #000;
  overflow: hidden;
}
.player video { display: block; width: 100%; max-height: 65vh; background: #000; }
.audio-player {
  margin: 0 0 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}
.audio-player audio { display: block; width: 100%; }
.file-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.file-actions .btn { flex: 1 1 200px; }
.file-share { margin-top: 18px; }

.docs main { max-width: 900px; }
.docs-hero { padding: 38px 0 26px; }
.docs-hero h1 { font-size: clamp(2rem, 5vw, 2.8rem); }
.docs-hero .hero-lead { margin-left: 0; margin-right: 0; max-width: 620px; }
.doc-card { margin-bottom: 14px; }
.doc-card h2 { margin: 0 0 6px; font-size: 1.08rem; letter-spacing: -0.01em; }
.doc-card p { color: var(--muted); font-size: 13px; margin: 0 0 10px; }
.doc-card ol { margin: 10px 0 0; padding-left: 20px; color: var(--muted); font-size: 13px; }
.doc-card li + li { margin-top: 5px; }
.doc-card code {
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-input);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.92em;
}
.doc-card pre {
  margin: 8px 0 0;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-deep);
  color: #e3e9f2;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
}
.doc-card pre code { padding: 0; border: 0; background: none; color: inherit; font-size: inherit; white-space: inherit; }

/* docs use the old container classes */
.box {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.hero { max-width: 680px; margin: 0 auto; padding: 52px 0 34px; text-align: center; }
.hero h1 { margin: 0; font-size: clamp(2rem, 5vw, 2.8rem); line-height: 1.08; font-weight: 700; letter-spacing: -0.035em; }
.hero-lead { max-width: 560px; margin: 14px auto 0; color: var(--muted); font-size: 0.96rem; line-height: 1.65; }

/* ---------------------------------------------------------- API docs ---- */
.api-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 4px; }
.api-nav a {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
}
.api-nav a:hover { border-color: var(--accent-line); color: var(--accent); }

.api-note {
  display: flex;
  gap: 9px;
  margin-top: 12px;
  padding: 10px 12px;
  border-left: 2px solid var(--accent);
  background: var(--accent-soft);
  color: var(--muted);
  font-size: 12.5px;
}
.api-note svg { color: var(--accent); margin-top: 2px; }

.api-endpoint { padding-top: 22px; margin-top: 22px; border-top: 1px solid var(--line); }
.api-endpoint:first-of-type { padding-top: 0; margin-top: 0; border-top: 0; }
.endpoint-head { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-bottom: 5px; }
.method {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.method.get { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.method.post { color: var(--amber); border-color: rgba(244, 193, 93, 0.35); background: rgba(244, 193, 93, 0.07); }
.method.delete { color: var(--red); border-color: rgba(255, 123, 123, 0.35); background: rgba(255, 123, 123, 0.06); }
.endpoint-path { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--fg); }
.endpoint-desc { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.api-sub {
  margin: 16px 0 7px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.api-table-wrap { overflow-x: auto; }
.api-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.api-table th {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.api-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--muted); }
.api-table tr:last-child td { border-bottom: 0; }
.api-table td:first-child code { color: var(--accent); }
.api-table code { font-size: 11px; }
.api-type { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.api-required { color: var(--amber); font-family: var(--mono); font-size: 10px; }
.api-optional { color: var(--faint); font-family: var(--mono); font-size: 10px; }
.api-key { color: var(--accent); font-family: var(--mono); }

/* ---------------------------------------------------------- responsive -- */
@media (max-width: 760px) {
  .site-footer { flex-direction: column; align-items: flex-start; }
  .footer-note { flex: none; }
}

@media (max-width: 620px) {
  .topbar { padding: 16px 16px 0; }
  .app-main { padding: 0 14px 36px; }
  .file-page main, .docs main { padding: 20px 16px 32px; }
  .app-title { margin: 40px 0 22px; }
  .card { padding: 17px; border-radius: 16px; }
  .home-card { padding: 14px; }
  .url-row { flex-direction: column; }
  .url-row .btn { width: 100%; height: 48px; }
  .url-field input { height: 50px; }
  .grid { grid-template-columns: 1fr; }
  .overlay { padding: 12px; place-items: end center; }
  .dialog { max-height: 92vh; border-radius: 18px; }
  .dialog-head, .dialog-body { padding-left: 16px; padding-right: 16px; }
  .dialog-foot { padding: 12px 16px 16px; flex-wrap: wrap; }
  .dialog-foot .btn-download { width: 100%; margin-left: 0; }
  .dialog-thumb { width: 84px; }
  .actions .btn { flex: 1 1 100%; }
  .share-copy { flex-direction: column; }
  .share-copy .btn { width: 100%; }
  .range-note { margin-left: 0; padding-bottom: 0; width: 100%; }
  .item-actions { align-items: flex-start; }
  .site-footer { padding: 20px 16px 28px; }
  .docs-hero { padding: 30px 0 20px; }
  .endpoint-path { font-size: 12px; }
  .confirm-dialog { align-self: center; }
}

@media (max-width: 420px) {
  .topnav { gap: 12px; }
  .topnav a { font-size: 12px; }
  .brand-name { font-size: 17px; }
  .brand-mark { width: 31px; height: 31px; }
  .mode-btn { font-size: 12px; }
  .dialog-media { align-items: flex-start; }
  .badge { margin-left: auto; }
}

@media (hover: none) {
  .pick-item:hover { background: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
