/* ============================================================
   trawl — lowkey developer styling
   plain CSS, no build step, no dependencies
   ============================================================ */

/* ---------- tokens ---------- */
:root {
  --bg: #0a0a0b;
  --bg-elev: #101012;
  --surface: rgba(255, 255, 255, 0.03);
  --surface-2: rgba(255, 255, 255, 0.055);
  --surface-3: rgba(255, 255, 255, 0.1);
  --stroke: rgba(255, 255, 255, 0.09);
  --stroke-2: rgba(255, 255, 255, 0.2);
  --text: #ededee;
  --text-2: #a1a1a6;
  --text-3: #8b8b93;
  --accent: #ededee;
  --accent-soft: rgba(255, 255, 255, 0.07);
  --accent-line: rgba(255, 255, 255, 0.32);
  --accent-ink: #0a0a0b;
  --btn: #ededee;
  --btn-hover: #ffffff;
  --btn-line: transparent;
  --ok: #4ade80;
  --warn: #fbbf24;
  --err: #f87171;
  --ring: rgba(255, 255, 255, 0.22);
  --tab-active: #ededee;

  --r-lg: 12px;
  --r-md: 9px;
  --r-sm: 6px;
  --r-full: 999px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text",
          "Segoe UI", Roboto, "Inter", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --label: 10.5px;
  --label-track: 0.1em;
  --h: 30px;

  --shadow-1: 0 1px 0 rgba(255, 255, 255, 0.02) inset;
  --shadow-2: 0 24px 60px -50px rgba(0, 0, 0, 0.9), 0 1px 0 rgba(255, 255, 255, 0.03) inset;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --speed: 160ms;
}

[data-theme="light"] {
  --bg: #ffffff;
  --bg-elev: #fbfbfb;
  --surface: rgba(0, 0, 0, 0.02);
  --surface-2: rgba(0, 0, 0, 0.045);
  --surface-3: rgba(0, 0, 0, 0.075);
  --stroke: rgba(0, 0, 0, 0.09);
  --stroke-2: rgba(0, 0, 0, 0.2);
  --text: #121213;
  --text-2: #5c5c61;
  --text-3: #6f6f76;
  --accent: #121213;
  --accent-soft: rgba(0, 0, 0, 0.05);
  --accent-line: rgba(0, 0, 0, 0.25);
  --accent-ink: #ffffff;
  --btn: #121213;
  --btn-hover: #2b2b2e;
  --btn-line: transparent;
  --ok: #16a34a;
  --warn: #b45309;
  --err: #dc2626;
  --ring: rgba(0, 0, 0, 0.18);
  --tab-active: #121213;
  --shadow-2: 0 24px 50px -46px rgba(0, 0, 0, 0.25), 0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-tap-highlight-color: transparent;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.004em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
h1, h2, h3, p, dl, dd, figure { margin: 0; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
a { color: inherit; text-decoration: none; }
code, pre, kbd { font-family: var(--mono); font-size: 0.9em; }
::selection { background: var(--accent-soft); color: var(--text); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- backdrop ---------- */
.backdrop { display: none; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 9px clamp(16px, 4vw, 30px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--stroke);
}
.brand { display: inline-flex; align-items: center; gap: 9px; }
.brand-mark {
  display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: var(--r-sm);
  background: transparent; color: var(--accent);
  border: 1px solid var(--stroke-2);
}
.brand-mark svg { width: 15px; height: 15px; }
.brand-text {
  font-family: var(--mono); font-size: 0.82rem; font-weight: 500;
  letter-spacing: -0.02em; white-space: nowrap;
}
.brand-dot { color: var(--text-2); }
.brand-sub {
  margin-left: 0; font-size: inherit; font-weight: 400;
  color: var(--text-3); letter-spacing: -0.02em;
}
.topbar-actions { display: flex; align-items: center; gap: 7px; }

/* the repo link: a small 3d tilt on hover, nothing that moves on its own */

.instance-pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: var(--h); padding: 0 10px; border-radius: var(--r-sm);
  background: transparent; border: 1px solid var(--stroke);
  color: var(--text-3); font-family: var(--mono); font-size: 0.7rem;
  transition: border-color var(--speed), color var(--speed);
}
.instance-pill:hover { border-color: var(--stroke-2); color: var(--text-2); }
.instance-pill .dot {
  width: 5px; height: 5px; border-radius: 1px; background: var(--text-3); flex: none;
}
.instance-pill[data-state="ok"] .dot { background: var(--ok); }
.instance-pill[data-state="bad"] .dot { background: var(--err); }
.instance-pill[data-state="checking"] .dot { background: var(--warn); animation: pulse 1.2s infinite; }
.instance-pill-label { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }


.icon-btn {
  display: inline-grid; place-items: center;
  width: var(--h); height: var(--h); border-radius: var(--r-sm);
  color: var(--text-3);
  border: 1px solid transparent;
  transition: color var(--speed), background var(--speed), border-color var(--speed);
}
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn:hover { color: var(--text); background: var(--surface); border-color: var(--stroke); }
.icon-btn.labeled {
  width: auto; gap: 7px; padding: 0 10px; grid-auto-flow: column;
  font-family: var(--mono); font-size: 0.72rem; border-color: var(--stroke);
}
.topbar-link {
  padding: 0 4px; color: var(--text-3);
  font-family: var(--mono); font-size: 0.7rem;
  transition: color var(--speed);
}
.topbar-link:hover { color: var(--text); }

/* ---------- layout ---------- */
.wrap {
  position: relative; z-index: 1;
  width: 100%; max-width: 900px;
  margin: 0 auto; padding: clamp(24px, 4.5vw, 44px) clamp(16px, 4vw, 26px) 40px;
}


/* ---------- composer ---------- */
.composer {
  position: relative;
  padding: 0;
  border-radius: var(--r-lg);
  background: var(--bg-elev);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow-1);
  transition: border-color var(--speed), box-shadow var(--speed);
}
.composer.is-focused { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }

.composer-main { display: flex; align-items: flex-start; gap: 8px; padding: 11px 11px 10px 11px; }
.service-badge {
  flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; min-width: 30px; margin-top: 3px; padding: 0 8px;
  border-radius: var(--r-sm); border: 1px solid var(--stroke);
  color: var(--text-3);
  transition: color var(--speed), border-color var(--speed);
}
.service-badge svg { width: 14px; height: 14px; flex: none; }
.service-mark { display: inline-flex; align-items: center; justify-content: center; }
.service-badge[data-empty="true"] { padding: 0; }
.service-name {
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: -0.01em;
  color: var(--text-2); white-space: nowrap;
}
.service-badge[data-empty="false"] { color: var(--accent); border-color: var(--accent-line); }

#url-input {
  flex: 1 1 auto; min-width: 0;
  padding: 8px 2px; max-height: 168px;
  background: transparent; border: 0; resize: none; outline: none;
  font-family: var(--mono); font-size: 0.86rem; line-height: 1.6;
  overflow-y: auto;
}
#url-input::placeholder { color: var(--text-3); opacity: 0.9; }
.composer-tools { display: flex; align-items: center; gap: 5px; flex: none; }

.ghost-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: var(--h); padding: 0 10px; border-radius: var(--r-sm);
  background: transparent; border: 1px solid var(--stroke);
  color: var(--text-2); font-family: var(--mono); font-size: 0.72rem;
  transition: color var(--speed), background var(--speed), border-color var(--speed);
}
.ghost-btn svg { width: 13px; height: 13px; }
a.ghost-btn { text-decoration: none; }
.ghost-btn:hover { color: var(--text); background: var(--surface); border-color: var(--stroke-2); }
.ghost-btn.small { padding: 4px 8px; font-size: 0.68rem; }
.ghost-btn.danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 28%, transparent); }

.composer-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 11px; flex-wrap: wrap;
  border-top: 1px solid var(--stroke);
}
.modes { display: inline-flex; gap: 2px; padding: 0; border-radius: var(--r-sm); }
.mode {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 10px; border-radius: var(--r-sm);
  color: var(--text-3); font-family: var(--mono); font-size: 0.72rem;
  transition: color var(--speed), background var(--speed);
}
.mode svg { width: 12px; height: 12px; }
.mode:hover { color: var(--text-2); }
.mode[aria-checked="true"] { background: var(--surface-2); color: var(--text); }
.mode-group { display: flex; align-items: center; gap: 6px; }
.format-note {
  color: var(--text-3); font-family: var(--mono); font-size: 0.64rem;
  white-space: nowrap; letter-spacing: 0.01em;
}
.format-note:empty { display: none; }
.icon-btn.tune { width: 24px; height: 24px; color: var(--text-3); border-color: transparent; }
.icon-btn.tune:hover { color: var(--text); }

.hint[data-action] {
  color: var(--accent); cursor: pointer;
  text-decoration: underline dotted; text-underline-offset: 3px;
}
.composer.is-dropping { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.composer-cta { display: flex; align-items: center; gap: 10px; }
.hint { color: var(--text-3); font-family: var(--mono); font-size: 0.68rem; max-width: 260px; text-align: right; }
.hint[data-tone="warn"] { color: var(--warn); }
.hint[data-tone="err"] { color: var(--err); }

.primary-btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 14px; border-radius: var(--r-sm);
  background: var(--btn); color: var(--accent-ink);
  font-family: var(--mono); font-size: 0.74rem; font-weight: 600;
  border: 1px solid var(--btn-line);
  transition: filter var(--speed), transform var(--speed);
}
.primary-btn svg { width: 13px; height: 13px; transition: transform var(--speed) var(--ease); }
.primary-btn:hover { background: var(--btn-hover); }
.primary-btn:hover svg { transform: translateX(2px); }
.primary-btn:active { transform: translateY(1px); }
.primary-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.primary-btn[data-busy="true"] svg { animation: spin 900ms linear infinite; }

.setup-note {
  margin: 0; padding: 10px 12px 11px;
  border-top: 1px solid var(--stroke);
  color: var(--text-3); font-size: 0.78rem; line-height: 1.5;
}
.setup-note p { max-width: 62ch; }
.link-btn {
  color: var(--accent); font-family: var(--mono); font-size: 0.74rem;
  text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px;
}


.queue { margin-top: clamp(24px, 4.4vw, 36px); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.section-actions { display: flex; align-items: center; gap: 10px; }
.qstats { color: var(--text-3); font-family: var(--mono); font-size: 0.64rem; }
.qstats:empty { display: none; }
.section-head h2 {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--text-2);
  font-family: var(--mono); font-size: var(--label); font-weight: 500;
  text-transform: uppercase; letter-spacing: var(--label-track);
}
.count {
  color: var(--text-3); font-size: 0.68rem; letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.count::before { content: "["; }
.count::after { content: "]"; }

.queue-list { display: flex; flex-direction: column; gap: 6px; }

.qitem {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 26px 1fr auto; gap: 12px; align-items: center;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--stroke);
  animation: rise 240ms var(--ease) both;
  transition: border-color var(--speed), background var(--speed);
}
.qitem:hover { border-color: var(--stroke-2); }
.qitem[data-status="error"] { border-color: color-mix(in srgb, var(--err) 26%, transparent); }

.q-icon {
  display: grid; place-items: center; width: 26px; height: 26px;
  border-radius: 5px; border: 1px solid var(--stroke);
  color: var(--text-3);
}
.q-icon svg { width: 14px; height: 14px; }
.qitem[data-status="working"] .q-icon { color: var(--accent); border-color: var(--accent-line); }
.qitem[data-status="ready"] .q-icon,
.qitem[data-status="done"] .q-icon { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.qitem[data-status="error"] .q-icon { color: var(--err); border-color: color-mix(in srgb, var(--err) 30%, transparent); }

.q-body { min-width: 0; }
.q-title {
  font-family: var(--mono); font-size: 0.8rem; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.q-meta {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  margin-top: 2px; color: var(--text-3);
  font-family: var(--mono); font-size: 0.66rem;
}
.q-meta .sep { width: 2px; height: 2px; border-radius: 50%; background: currentColor; opacity: 0.5; }
.q-meta .q-err { color: var(--err); }

.q-actions { display: flex; align-items: center; gap: 3px; }
.q-actions .icon-btn { width: 26px; height: 26px; border-radius: 5px; }
.q-actions .icon-btn svg { width: 13px; height: 13px; }

.q-progress {
  grid-column: 1 / -1; height: 2px; border-radius: 0;
  background: var(--surface-2); overflow: hidden; margin-top: 2px;
  display: none;
}
.qitem[data-status="working"] .q-progress,
.qitem[data-status="downloading"] .q-progress { display: block; }
.q-progress-fill {
  height: 100%; width: 0%;
  background: var(--text);
  transition: width 160ms linear;
}
.qitem[data-indeterminate="true"] .q-progress-fill { width: 30% !important; animation: slide 1.5s var(--ease) infinite; }

.spinner {
  width: 12px; height: 12px; border-radius: 50%;
  border: 1.5px solid currentColor; border-top-color: transparent;
  animation: spin 760ms linear infinite;
}

.empty {
  display: grid; gap: 3px; justify-items: start;
  padding: 10px 2px 0;
  color: var(--text-3); font-size: 0.8rem;
}
.empty-tip { color: var(--text-3); font-family: var(--mono); font-size: 0.64rem; opacity: 0.85; }
.empty-tip {
  color: var(--text-3); font-family: var(--mono); font-size: 0.64rem;
  opacity: 0.8; word-break: break-all;
}

/* ---------- services ---------- */
/* ---------- recent ---------- */
.recent-line {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px;
  margin-top: 12px;
  color: var(--text-3); font-family: var(--mono); font-size: 0.68rem;
}
.recent-label {
  font-size: 0.62rem; text-transform: uppercase; letter-spacing: var(--label-track);
  color: var(--text-3);
}
.recent-item {
  color: var(--text-3); font-family: var(--mono); font-size: 0.68rem;
  transition: color var(--speed);
}
.recent-item:hover { color: var(--text-2); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- queue ---------- */
.queue { margin-top: clamp(24px, 4.4vw, 32px); }

/* ---------- services ---------- */
.services { margin-top: clamp(22px, 4vw, 32px); }
.services summary {
  display: inline-flex; align-items: center; gap: 7px;
  cursor: pointer; list-style: none;
  color: var(--text-3); font-family: var(--mono);
  font-size: var(--label); text-transform: uppercase; letter-spacing: var(--label-track);
}
.services summary::-webkit-details-marker { display: none; }
.services summary::before {
  content: "+"; width: 9px; text-align: center; color: var(--text-3);
}
.services[open] summary::before { content: "\2212"; }
.services summary:hover { color: var(--text-2); }
.services[open] summary { margin-bottom: 10px; }
.services-refresh { margin-top: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 5px;
  border: 1px solid var(--stroke);
  color: var(--text-3); font-family: var(--mono); font-size: 0.68rem;
  transition: color var(--speed), border-color var(--speed), background var(--speed);
}
.chip:hover { color: var(--text-2); border-color: var(--stroke-2); background: var(--surface); }
.chip svg { width: 11px; height: 11px; flex: none; opacity: 0.85; }
.chip-name { white-space: nowrap; }


.footer {
  position: relative; z-index: 1;
  max-width: 900px; margin: auto auto 0; padding: 18px clamp(16px, 4vw, 26px) 26px;
  color: var(--text-3); font-size: 0.66rem;
  /* was opacity: 0.55, which crushed the footer to 2:1 — too faint to read */
}
.footer p + p { margin-top: 5px; }
.help-note {
  margin: 20px auto 0; padding-top: 14px; max-width: 62ch;
  border-top: 1px solid var(--stroke);
  color: var(--text-3); font-size: 0.76rem; line-height: 1.65;
}
.help-note b { color: var(--text-2); font-weight: 600; }
.footer a { text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.footer a:hover { color: var(--text-2); }
.footer-meta { font-family: var(--mono); font-size: 0.64rem; color: var(--text-3); }

/* ---------- help ---------- */
.help-lede { max-width: 60ch; color: var(--text-2); font-size: 0.86rem; line-height: 1.6; }
.steps { display: grid; gap: 14px; margin: 18px 0 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; }
.steps li::before {
  counter-increment: step;
  content: "0" counter(step);
  padding-top: 1px;
  color: var(--text-3); font-family: var(--mono); font-size: 0.62rem;
}
.steps strong { display: block; margin-bottom: 2px; font-size: 0.82rem; font-weight: 600; }
.steps span { display: block; color: var(--text-3); font-size: 0.78rem; line-height: 1.6; }
.steps code, .faq code {
  padding: 1px 4px; border-radius: 4px;
  background: var(--surface-2); color: var(--text-2); font-size: 0.9em;
}
.help-sub {
  margin: 26px 0 4px;
  color: var(--text-3); font-family: var(--mono);
  font-size: var(--label); font-weight: 500;
  text-transform: uppercase; letter-spacing: var(--label-track);
}
.faq { border-top: 1px solid var(--stroke); }
.faq details { border-bottom: 1px solid var(--stroke); }
.faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 0; cursor: pointer; list-style: none;
  font-size: 0.82rem; font-weight: 500;
  transition: color var(--speed);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; flex: none;
  color: var(--text-3); font-family: var(--mono); font-size: 0.78rem;
}
.faq details[open] summary::after { content: "2"; }
.faq summary:hover { color: var(--text-2); }
.faq p { max-width: 64ch; padding: 0 0 12px; color: var(--text-3); font-size: 0.78rem; line-height: 1.6; }

/* ---------- settings sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 90; display: grid; }
.sheet-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  animation: fade 180ms var(--ease) both;
}
[data-theme="light"] .sheet-backdrop { background: rgba(0, 0, 0, 0.22); }
.sheet-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(640px, 100%);
  display: flex; flex-direction: column;
  background: var(--bg-elev);
  border-left: 1px solid var(--stroke);
  animation: slide-in 220ms var(--ease) both;
}
.sheet-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 18px 11px;
  border-bottom: 1px solid var(--stroke);
}
.sheet-head h2 { font-size: 1rem; font-weight: 600; letter-spacing: -0.015em; }
.sheet-sub { color: var(--text-3); font-family: var(--mono); font-size: 0.68rem; margin-top: 3px; }
.sheet-nav {
  display: flex; gap: 14px; padding: 0 18px; overflow-x: auto;
  border-bottom: 1px solid var(--stroke); scrollbar-width: none;
}
.sheet-nav::-webkit-scrollbar { display: none; }
.sheet-nav-item {
  flex: none; padding: 9px 0;
  color: var(--text-3); font-family: var(--mono); font-size: 0.72rem;
  border-bottom: 1px solid transparent;
  transition: color var(--speed), border-color var(--speed);
}
.sheet-nav-item:hover { color: var(--text-2); }
.sheet-nav-item.is-active { color: var(--text); border-bottom-color: var(--tab-active); }
.sheet-body {
  flex: 1 1 auto; overflow-y: auto; padding: 18px; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent;
}
.sheet-body::-webkit-scrollbar { width: 10px; }
.sheet-body::-webkit-scrollbar-thumb {
  background: var(--surface-3); border-radius: var(--r-full);
  border: 3px solid transparent; background-clip: content-box;
}
.pane { display: none; flex-direction: column; gap: 18px; }
.pane.is-active { display: flex; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field-label {
  display: block; font-size: 0.8rem; font-weight: 600; letter-spacing: -0.005em;
}
.field-label .optional {
  margin-left: 6px; padding: 0 5px;
  border-radius: 4px; border: 1px solid var(--stroke);
  color: var(--text-3);
  font-family: var(--mono); font-size: 0.6rem; font-weight: 400;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.field-help { color: var(--text-3); font-size: 0.74rem; line-height: 1.55; }
.field-help code {
  padding: 1px 4px; border-radius: 4px;
  background: var(--surface-2); color: var(--text-2);
  font-size: 0.9em;
}
.field-help a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.field-row { display: flex; gap: 6px; align-items: center; }
.wrap-row { flex-wrap: wrap; }
.footnote { margin-top: -4px; }

.text-input, .select {
  width: 100%; padding: 8px 10px;
  border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--stroke);
  color: var(--text); font-family: var(--mono); font-size: 0.76rem;
  transition: border-color var(--speed), box-shadow var(--speed);
}
.text-input::placeholder { color: var(--text-3); }
.text-input:hover, .select:hover { border-color: var(--stroke-2); }
.text-input:focus, .select:focus {
  outline: none; border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.select {
  appearance: none; padding-right: 30px;
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 15px) calc(50% + 1px), calc(100% - 11px) calc(50% + 1px);
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}

.seg {
  display: inline-flex; flex-wrap: nowrap; padding: 2px; gap: 1px;
  border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--stroke);
  align-self: flex-start;
}
.seg.wrap { flex-wrap: wrap; }
.seg.is-disabled { opacity: 0.4; }
.seg button:disabled { cursor: not-allowed; }
.seg button {
  padding: 5px 9px; border-radius: 4px;
  color: var(--text-3); font-family: var(--mono); font-size: 0.7rem;
  transition: color var(--speed), background var(--speed);
}
.seg button:hover { color: var(--text-2); }
.seg button[aria-checked="true"] { background: var(--surface-3); color: var(--text); }
.seg-suffix { padding: 5px 5px 5px 2px; color: var(--text-3); font-family: var(--mono); font-size: 0.66rem; }

.switch-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 18px;
  cursor: pointer;
}
.switch-row > span:first-child { display: flex; flex-direction: column; gap: 2px; }
.switch {
  appearance: none; flex: none; position: relative;
  width: 34px; height: 19px; margin-top: 2px;
  border-radius: var(--r-full);
  background: var(--surface-2); border: 1px solid var(--stroke-2);
  transition: background var(--speed), border-color var(--speed);
  cursor: pointer;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--text-3);
  transition: transform var(--speed) var(--ease), background var(--speed);
}
.switch:checked { background: var(--btn); border-color: var(--btn); }
.switch:checked::after { transform: translateX(15px); background: #ffffff; }

.filename-preview {
  display: flex; flex-direction: column; gap: 5px;
  padding: 10px 12px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--stroke);
}
.preview-label {
  color: var(--text-3); font-family: var(--mono); font-size: 0.6rem;
  text-transform: uppercase; letter-spacing: var(--label-track);
}
.filename-preview code { color: var(--text-2); font-size: 0.7rem; word-break: break-all; }

.notice {
  padding: 10px 12px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--stroke);
  color: var(--text-3); font-size: 0.76rem; line-height: 1.6;
}
.notice strong { color: var(--text-2); font-weight: 600; }

.code-block {
  margin: 0; padding: 12px;
  border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--stroke);
  color: var(--text-2); font-size: 0.68rem; line-height: 1.6;
  max-height: 240px; overflow: auto; white-space: pre-wrap; word-break: break-word;
}

.instance-card {
  padding: 12px;
  border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--stroke);
}
.instance-card-head {
  display: flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 0.74rem; color: var(--text-2);
}
.instance-card-head .dot { width: 5px; height: 5px; border-radius: 1px; background: var(--text-3); }
.instance-card[data-state="ok"] .instance-card-head .dot { background: var(--ok); }
.instance-card[data-state="bad"] .instance-card-head .dot { background: var(--err); }
.instance-card[data-state="checking"] .instance-card-head .dot { background: var(--warn); animation: pulse 1.2s infinite; }
.instance-meta { display: grid; gap: 5px; margin-top: 9px; font-family: var(--mono); font-size: 0.68rem; }
.instance-meta > div { display: flex; justify-content: space-between; gap: 12px; }
.instance-meta dt { color: var(--text-3); }
.instance-meta dd { margin: 0; color: var(--text-2); text-align: right; word-break: break-all; }
.instance-error { margin-top: 8px; color: var(--err); font-size: 0.72rem; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.7);
  animation: fade 160ms var(--ease) both;
}
.modal-inner {
  position: relative;
  display: flex; flex-direction: column;
  width: min(620px, 100%);
  max-height: min(82vh, 700px);
  border: 1px solid var(--stroke-2);
  border-radius: var(--r-lg);
  background: var(--bg-elev);
  box-shadow: var(--shadow-2);
  overflow: hidden;
  animation: pop 170ms var(--ease) both;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 14px; border-bottom: 1px solid var(--stroke);
}
.modal-head h2 { font-size: 0.86rem; font-weight: 600; letter-spacing: -0.01em; }
.modal-body { padding: 16px; overflow-y: auto; }
.modal-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 6px;
  padding: 11px 14px; border-top: 1px solid var(--stroke);
}
.modal-foot:empty { display: none; }

.picker-bulk {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px;
}
.picker-bulk-note { color: var(--text-3); font-family: var(--mono); font-size: 0.66rem; }

.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.picker-cell {
  position: relative; display: block; padding: 0; overflow: hidden;
  border-radius: var(--r-sm); border: 1px solid var(--stroke);
  background: var(--surface-2); aspect-ratio: 3 / 4;
}
.picker-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.picker-cell .picker-type {
  position: absolute; left: 6px; bottom: 6px;
  padding: 1px 6px; border-radius: 4px;
  background: rgba(0, 0, 0, 0.65); color: #fff;
  font-family: var(--mono); font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.06em;
}
.picker-cell[data-selected="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-line); }
.picker-cell[data-selected="true"]::after {
  content: "✓"; position: absolute; top: 6px; right: 6px;
  display: grid; place-items: center; width: 17px; height: 17px; border-radius: 4px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 0.65rem; font-weight: 700;
}
.picker-empty { color: var(--text-3); font-size: 0.78rem; }

.step-list { display: flex; flex-direction: column; gap: 5px; margin: 0; padding: 0; list-style: none; }
.step-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 10px; border-radius: 5px;
  background: var(--surface); border: 1px solid var(--stroke);
  font-size: 0.74rem;
}
.step-list code { color: var(--text-2); word-break: break-all; font-size: 0.68rem; }
.step-list .ghost-btn { flex: none; padding: 4px 8px; font-size: 0.68rem; }

/* ---------- toasts ---------- */
.toasts {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  z-index: 120; display: flex; flex-direction: column; gap: 6px; align-items: center;
  pointer-events: none; width: max-content; max-width: calc(100vw - 32px);
}
.toast {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: var(--r-sm);
  background: var(--bg-elev); border: 1px solid var(--stroke-2);
  color: var(--text-2); font-family: var(--mono); font-size: 0.7rem;
  animation: toast-in 200ms var(--ease) both;
}
.toast .dot { width: 5px; height: 5px; border-radius: 1px; background: var(--text-3); flex: none; }
.toast[data-tone="ok"] .dot { background: var(--ok); }
.toast[data-tone="err"] .dot { background: var(--err); }
.toast[data-tone="warn"] .dot { background: var(--warn); }
.toast.is-leaving { animation: toast-out 160ms var(--ease) both; }

/* ---------- motion ---------- */
@keyframes rise { from { transform: translateY(5px); } to { transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { transform: scale(0.99) translateY(4px); } to { transform: none; } }
@keyframes slide-in { from { transform: translateX(20px); } to { transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(340%); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(4px); } }

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

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .topbar { padding: 9px 14px; padding-top: max(9px, env(safe-area-inset-top)); }
  #url-input { font-size: 16px; }
  .mode { height: 34px; padding: 0 12px; font-size: 0.76rem; }
  .icon-btn { width: 36px; height: 36px; }
  .ghost-btn { height: 36px; padding: 0 12px; }
  .primary-btn { height: 40px; padding: 0 16px; }
  .nav-link { padding: 8px 10px; }
  .q-actions .icon-btn, .rq-actions .icon-btn { width: 34px; height: 34px; }
  .footer { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
  .brand-sub { display: none; }
  .icon-btn.labeled span { display: none; }
  .icon-btn.labeled { width: 30px; padding: 0; }
  .instance-pill { display: none; }
  .lede { font-size: 0.82rem; }
  .composer-main { flex-wrap: wrap; }
  /* keep the mark on phones: it is the fastest way to see what got detected */
  .service-badge svg { width: 12px; height: 12px; }
  .service-badge[data-empty="true"] { display: none; }
  .service-badge[data-empty="false"] { padding: 0 7px; }
  .service-name { font-size: 0.66rem; }
  #url-input { font-size: 0.8rem; }
  .composer-foot { flex-wrap: wrap; gap: 8px; }
  .composer-cta { width: 100%; }
  .format-note { margin-right: auto; }
  .hint { text-align: left; font-size: 0.64rem; max-width: none; }
  .modes { align-self: flex-start; }
  .mode { padding: 5px 7px; gap: 4px; }
  .qitem { grid-template-columns: 24px 1fr; row-gap: 6px; padding: 10px; gap: 9px; }
  .q-icon { width: 24px; height: 24px; }
  .q-actions { grid-column: 1 / -1; justify-content: flex-end; }
    .sheet-panel { width: 100%; }
  .modal {
    width: 100vw; max-height: 92vh;
    border-radius: var(--r-lg) var(--r-lg) 0 0; margin: auto auto 0;
  }
  .toasts { bottom: 12px; }
}

/* ---------- navigation ---------- */
.nav { display: flex; align-items: center; gap: 2px; margin-right: auto; margin-left: 18px; }
.nav-link {
  padding: 5px 8px; border-radius: var(--r-sm);
  color: var(--text-3); font-family: var(--mono); font-size: 0.72rem;
  transition: color var(--speed), background var(--speed);
}
.nav-link:hover { color: var(--text-2); background: var(--surface); }
.nav-link.is-active { color: var(--text); background: var(--surface-2); }

/* ---------- remux ---------- */
.page-h1 {
  font-size: 1.1rem; font-weight: 600; letter-spacing: -0.015em;
  text-align: center;
}
.page-lede { margin-left: auto; margin-right: auto; text-align: center; }

/* ---------- status page ---------- */
.status-card {
  margin: 22px auto 0; padding: 16px 18px;
  border: 1px solid var(--stroke); border-radius: var(--r-lg);
  background: var(--bg-elev); box-shadow: var(--shadow-1);
  max-width: 62ch;
}
.status-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.status-head b { font-size: 0.92rem; font-weight: 600; }
.status-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--text-3);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
  transition: background var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.status-card[data-state="up"] .status-dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.14); }
.status-card[data-state="degraded"] .status-dot { background: var(--warn); box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.14); }
.status-card[data-state="down"] .status-dot { background: var(--err); box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.14); }
.status-rows { margin: 14px 0 0; display: grid; gap: 6px; }
.status-rows > div { display: flex; justify-content: space-between; gap: 16px; }
.status-rows dt { color: var(--text-3); font-family: var(--mono); font-size: 0.7rem; }
.status-rows dd {
  margin: 0; color: var(--text-2); font-family: var(--mono); font-size: 0.7rem;
  text-align: right; transition: color var(--speed) var(--ease);
}
.status-rows dd[data-tone="ok"] { color: var(--ok); }
.status-rows dd[data-tone="warn"] { color: var(--warn); }
.status-rows dd[data-tone="err"] { color: var(--err); }
.uptime { margin-top: 14px; }
.uptime-head { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.uptime-pct { color: var(--text-2); font-family: var(--mono); font-size: 0.76rem; }
.uptime-meta { color: var(--text-3); font-family: var(--mono); font-size: 0.64rem; }
.uptime-strip { display: flex; gap: 2px; margin-top: 7px; flex-wrap: nowrap; overflow: hidden; }
.uptime-bar {
  width: 4px; height: 14px; border-radius: 1px; flex: 0 0 auto;
  background: var(--ok); opacity: 0.85;
  transform-origin: bottom;
  transition: background var(--speed) var(--ease);
}
.uptime-bar[data-ok="false"] { background: var(--err); }
.status-note { margin: 12px 0 0; color: var(--text-3); font-size: 0.76rem; line-height: 1.6; white-space: pre-wrap; }
.status-cta { margin: 12px 0 0; }
.status-card[data-state="no-instance"] .status-dot { background: var(--text-3); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06); }
.status-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* everything diagnostic hides in here until you ask for it */
.status-more { margin-top: 12px; border-top: 1px solid var(--stroke); padding-top: 10px; }
.status-more > summary {
  list-style: none; cursor: pointer;
  color: var(--text-3); font-family: var(--mono); font-size: 0.66rem;
  transition: color var(--speed) var(--ease);
}
.status-more > summary::-webkit-details-marker { display: none; }
.status-more > summary::before {
  content: "+"; display: inline-block; width: 12px; color: var(--text-3);
}
.status-more[open] > summary::before { content: "−"; }
.status-more > summary:hover { color: var(--text-2); }
.status-stamp { color: var(--text-3); font-family: var(--mono); font-size: 0.66rem; }

/* a real button back to the app, not a text link */
.back-btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 12px 0 10px;
  border: 1px solid var(--stroke); border-radius: var(--r-sm);
  color: var(--text-2); font-family: var(--mono); font-size: 0.72rem;
  text-decoration: none;
  transition: color var(--speed), border-color var(--speed), background var(--speed);
}
.back-btn svg { width: 14px; height: 14px; }
.back-btn:hover, .back-btn:focus-visible {
  color: var(--text); border-color: var(--stroke-2); background: var(--surface-2);
}

/* ---------- donations ---------- */
.donate-lede { color: var(--text-2); font-size: 0.86rem; line-height: 1.6; margin: 0 0 12px; }
.donate-note { color: var(--text-3); font-size: 0.76rem; margin: 0 0 14px; }
.donate-list { display: flex; flex-direction: column; gap: 8px; margin: 0 0 14px; }
.donate-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 11px; border: 1px solid var(--stroke); border-radius: var(--r-sm);
  background: var(--surface);
}
.donate-id { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.donate-label {
  font-family: var(--mono); font-size: 0.7rem; color: var(--text-3);
  text-transform: lowercase; letter-spacing: 0.02em;
}
.donate-value {
  font-family: var(--mono); font-size: 0.78rem; color: var(--text);
  overflow-wrap: anywhere; text-decoration: none;
}
a.donate-value { color: var(--accent); }
a.donate-value:hover { text-decoration: underline; }
.donate-hint { font-size: 0.7rem; color: var(--text-3); }
.donate-fine { color: var(--text-3); font-size: 0.72rem; line-height: 1.6; margin: 0; }

/* ---------- one sponsor slot, off by default ---------- */
.slot {
  margin: 20px auto 0; max-width: 44ch; padding: 9px 12px 10px;
  border: 1px solid var(--stroke); border-radius: var(--r-md);
  color: var(--text-3); font-size: 0.72rem; line-height: 1.5;
  text-align: center;
}
.slot-label {
  display: block; margin-bottom: 3px;
  font-family: var(--mono); font-size: 0.58rem; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--text-3); opacity: 0.65;
}
.slot-body { color: var(--text-2); }
.slot a { color: var(--text-2); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- terms page ---------- */
.terms { max-width: 64ch; margin: 22px auto 0; }
.terms h2 {
  margin: 26px 0 7px; color: var(--text);
  font-size: 0.82rem; font-weight: 600; letter-spacing: -0.005em;
}
.terms h2:first-child { margin-top: 0; }
.terms p { margin: 0; color: var(--text-2); font-size: 0.82rem; line-height: 1.7; }
.terms ul { margin: 8px 0 0; padding-left: 18px; color: var(--text-2); font-size: 0.82rem; line-height: 1.7; }
.terms li + li { margin-top: 5px; }
.terms b { color: var(--text); font-weight: 600; }
.page-lede { margin-top: 6px; max-width: 62ch; color: var(--text-3); font-size: 0.86rem; line-height: 1.6; }

.dropzone {
  position: relative;
  display: grid; justify-items: center; gap: 8px;
  margin-top: 22px; padding: 34px 20px 26px;
  border: 1px dashed var(--stroke-2); border-radius: var(--r-lg);
  background: var(--surface); text-align: center;
  cursor: pointer;
  transition: border-color var(--speed), background var(--speed), transform var(--speed);
}
.dropzone:hover { border-color: var(--text-3); background: var(--surface-2); }
.dropzone:focus-visible { outline: 2px solid var(--text-2); outline-offset: 2px; }
.dropzone.is-dragging {
  border-color: var(--text-2); background: var(--surface-2);
  transform: scale(1.004);
}
.dropzone-icon { width: 26px; height: 26px; color: var(--text-3); }
.dropzone-title { font-size: 0.92rem; font-weight: 600; }
.dropzone-hint { color: var(--text-3); font-family: var(--mono); font-size: 0.66rem; }
.dropzone .primary-btn { margin-top: 6px; }
.dropzone[data-busy="true"] { opacity: 0.6; pointer-events: none; }

.remux-privacy { margin-top: 10px; color: var(--text-3); font-size: 0.72rem; }
.remux-queue { margin-top: 26px; }

.rqueue { display: flex; flex-direction: column; gap: 6px; }
.rqitem {
  display: grid; grid-template-columns: 26px 1fr auto; gap: 12px; align-items: center;
  padding: 11px 13px;
  border: 1px solid var(--stroke); border-radius: var(--r-md);
  background: var(--surface);
}
.rqitem[data-status="error"] { border-color: color-mix(in srgb, var(--err) 30%, transparent); }
.rq-icon {
  display: grid; place-items: center; width: 26px; height: 26px;
  border: 1px solid var(--stroke); border-radius: 5px; color: var(--text-3);
}
.rq-icon svg { width: 14px; height: 14px; }
.rqitem[data-status="working"] .rq-icon { color: var(--text); border-color: var(--stroke-2); }
.rqitem[data-status="done"] .rq-icon { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.rqitem[data-status="error"] .rq-icon { color: var(--err); border-color: color-mix(in srgb, var(--err) 30%, transparent); }
.rqitem[data-status="cancelled"] .rq-icon { color: var(--warn); }

.rq-body { min-width: 0; }
.rq-title {
  font-family: var(--mono); font-size: 0.8rem; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rq-meta { margin-top: 2px; color: var(--text-3); font-family: var(--mono); font-size: 0.66rem; }
.rq-meta .rq-warn { color: var(--warn); }
.rq-meta .rq-err { color: var(--err); }
.rq-progress { display: none; height: 2px; margin-top: 8px; background: var(--surface-2); overflow: hidden; }
.rqitem[data-status="working"] .rq-progress { display: block; }
.rq-fill { height: 100%; width: 0%; background: var(--text); transition: width 140ms linear; }
.rqitem[data-indeterminate="true"] .rq-fill { width: 30% !important; animation: slide 1.5s var(--ease) infinite; }
.rq-actions { display: flex; align-items: center; gap: 3px; }
.rq-actions .icon-btn { width: 26px; height: 26px; border-radius: 5px; }
.rq-actions .icon-btn svg { width: 13px; height: 13px; }

.remux-help { margin-top: 26px; border-top: 1px solid var(--stroke); }
.remux-help summary {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 12px 0; cursor: pointer; list-style: none;
  color: var(--text-3); font-family: var(--mono); font-size: var(--label);
  text-transform: uppercase; letter-spacing: var(--label-track);
}
.remux-help summary::-webkit-details-marker { display: none; }
.remux-help summary::before { content: "+"; width: 9px; }
.remux-help[open] summary::before { content: "\2212"; }
.remux-help-body { display: grid; gap: 8px; padding-bottom: 14px; max-width: 66ch; }
.remux-help-body p { color: var(--text-3); font-size: 0.8rem; line-height: 1.65; }
.remux-help-body b { color: var(--text-2); font-weight: 600; }

@media (max-width: 720px) {
  .nav { margin-left: 10px; }
  .nav-link { padding: 5px 6px; font-size: 0.68rem; }
  .dropzone { padding: 26px 16px 22px; }
  .rqitem { grid-template-columns: 24px 1fr; row-gap: 6px; }
  .rq-actions { grid-column: 1 / -1; justify-content: flex-end; }
}

/* ---------- remux explainer ---------- */
.explain { margin-top: 30px; }
.explain-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px 24px; padding: 18px 0; border-top: 1px solid var(--stroke);
}
.explain-item h3 {
  margin-bottom: 5px;
  color: var(--text-3); font-family: var(--mono);
  font-size: var(--label); font-weight: 500;
  text-transform: uppercase; letter-spacing: var(--label-track);
}
.explain-item p { color: var(--text-2); font-size: 0.82rem; line-height: 1.6; max-width: 34ch; }
.remux-help { margin-top: 0; }

/* ---------- local-file notice ---------- */
.file-note {
  max-width: 900px; margin: 14px auto 0; padding: 10px 14px;
  border: 1px solid var(--warn); border-radius: var(--r-md);
  background: color-mix(in srgb, var(--warn) 10%, transparent);
  color: var(--text-2); font-size: 0.78rem; line-height: 1.55;
}
.file-note code {
  padding: 1px 5px; border-radius: 4px; background: var(--surface-2); color: var(--text);
}

/* ---------- disclosure sections (queue / files) ---------- */
.disclosure > summary { list-style: none; cursor: pointer; -webkit-user-select: none; user-select: none; }
.disclosure > summary::-webkit-details-marker { display: none; }
.section-label {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--text-2); font-family: var(--mono);
  font-size: var(--label); font-weight: 500;
  text-transform: uppercase; letter-spacing: var(--label-track);
}
.chev { width: 11px; height: 11px; color: var(--text-3); flex: none; transition: transform 150ms var(--ease); }
.disclosure[open] .chev { transform: rotate(90deg); }
.disclosure > summary:hover .section-label { color: var(--text); }
.disclosure .queue-list, .disclosure .rqueue { margin-top: 10px; }
.disclosure .empty { margin-top: 2px; }

/* ---------- nav tools menu ---------- */
.nav-tools { position: relative; }
.nav-tools > summary { list-style: none; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.nav-tools > summary::-webkit-details-marker { display: none; }
.nav-tools[open] > summary .chev { transform: rotate(180deg); }
.nav-menu {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 60;
  display: grid; min-width: 148px; padding: 5px;
  border: 1px solid var(--stroke-2); border-radius: var(--r-md);
  background: var(--bg-elev); box-shadow: var(--shadow-2);
}
.nav-menu a {
  padding: 7px 9px; border-radius: var(--r-sm);
  color: var(--text-2); font-family: var(--mono); font-size: 0.74rem;
}
.nav-menu a:hover { background: var(--surface-2); color: var(--text); }
.nav-menu a.is-active { background: var(--surface-3); color: var(--text); }

/* ---------- tool panels ---------- */
.tool { margin-top: 24px; display: grid; gap: 14px; }
.tool-file {
  font-family: var(--mono); font-size: 0.72rem; color: var(--text-3);
  padding-bottom: 12px; border-bottom: 1px solid var(--stroke);
}
.tool-note { color: var(--text-3); font-size: 0.78rem; line-height: 1.6; }
.tool-note[data-tone="err"] { color: var(--err); }
.tool-note[data-tone="warn"] { color: var(--warn); }
.tool-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.track-list, .tag-list { display: flex; flex-direction: column; gap: 6px; }
.track {
  display: grid; grid-template-columns: 18px 1fr auto; gap: 10px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--stroke); border-radius: var(--r-md);
  background: var(--surface); cursor: pointer;
}
.track.is-disabled { cursor: not-allowed; opacity: 0.6; }
.track-box { width: 15px; height: 15px; accent-color: var(--text); }
.track-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.track-name { font-size: 0.82rem; font-weight: 550; }
.track-meta { color: var(--text-3); font-family: var(--mono); font-size: 0.66rem; }
.badge {
  padding: 2px 7px; border-radius: var(--r-full);
  border: 1px solid var(--stroke); color: var(--text-3);
  font-family: var(--mono); font-size: 0.62rem; white-space: nowrap;
}
.badge.is-warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }

.tag { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--stroke); font-size: 0.78rem; }
.tag-key { flex: none; width: 120px; color: var(--text-3); font-family: var(--mono); font-size: 0.68rem; }
.tag-value { color: var(--text-2); overflow-wrap: anywhere; }

.tool-outputs { display: flex; flex-direction: column; gap: 6px; }
.out-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border: 1px solid var(--stroke); border-radius: var(--r-md);
  background: var(--surface);
}
.out-name { flex: 1; min-width: 0; font-family: var(--mono); font-size: 0.74rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.out-meta { color: var(--text-3); font-family: var(--mono); font-size: 0.66rem; }

@media (max-width: 720px) {
  .tag { flex-direction: column; gap: 2px; }
  .tag-key { width: auto; }
  .track { grid-template-columns: 18px 1fr; row-gap: 6px; }
  .badge { grid-column: 2; justify-self: start; }
  .nav-menu { left: auto; right: 0; }
}

/* ---------- homepage lead ---------- */
/* asked only when the link is ambiguous: what do you actually want? */
.quickpick {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 10px; padding: 9px 11px;
  border: 1px solid var(--accent-line); border-radius: var(--r-md);
  background: var(--bg-elev); box-shadow: var(--shadow-1);
}
.quickpick-q { margin: 0; color: var(--text-3); font-size: 0.74rem; }
.quickpick-q b { color: var(--text-2); font-weight: 500; }
.quickpick-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.quickpick-btn {
  height: 26px; padding: 0 10px; border-radius: var(--r-sm);
  border: 1px solid var(--stroke-2); background: var(--surface-2);
  color: var(--text-2); font-family: var(--mono); font-size: 0.68rem;
  cursor: pointer; transition: color var(--speed), border-color var(--speed), background var(--speed);
}
.quickpick-btn:hover, .quickpick-btn:focus-visible {
  color: var(--text); border-color: var(--text-3); background: var(--surface-3);
}
.quickpick-btn[data-default="true"] { color: var(--text); border-color: var(--text-2); }
.quickpick-close {
  margin-left: auto; height: 22px; padding: 0 7px;
  border: 1px solid var(--stroke); border-radius: var(--r-sm);
  background: transparent; color: var(--text-3);
  font-family: var(--mono); font-size: 0.62rem; cursor: pointer;
}
.quickpick-close:hover { color: var(--text-2); border-color: var(--stroke-2); }

/* one quiet line under the composer: shortcut + the local tools */
/* the download view: one centred column, nothing else competing */
#download-view {
  display: flex; flex-direction: column;
  /* `safe` keeps the composer reachable when the viewport is shorter than the
     content — plain `center` clips the top and you cannot scroll to it */
  justify-content: center;
  justify-content: safe center;
  flex: 1 1 auto; width: 100%;
}
.hero { width: 100%; }
.hero-kicker {
  margin: 0 0 16px; text-align: center;
  color: var(--text-3); font-family: var(--mono);
  font-size: 0.7rem; letter-spacing: 0.02em;
}

.meta-line {
  margin-top: 12px; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px;
  color: var(--text-3); font-size: 0.72rem; line-height: 1.5;
}
.meta-line code {
  padding: 1px 5px; border-radius: 4px;
  background: var(--surface-2); color: var(--text-2);
  font-size: 0.95em; white-space: nowrap;
}
.meta-line a {
  color: var(--text-3); text-decoration: none;
  border-bottom: 1px solid transparent; transition: color var(--speed), border-color var(--speed);
}
.meta-line a:hover, .meta-line a:focus-visible { color: var(--text-2); border-bottom-color: var(--stroke-2); }
.meta-dot { color: var(--text-3); opacity: 0.6; }

/* hover/focus tip on the shortcut, so "<link>" isn't a riddle */
.tip { position: relative; cursor: help; }
.tip::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 7px); left: 50%;
  transform: translateX(-50%) translateY(2px);
  padding: 5px 9px; border-radius: 6px;
  background: var(--bg-elev); border: 1px solid var(--stroke-2);
  color: var(--text-2); font-size: 0.66rem; line-height: 1.4;
  white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity 120ms ease, transform 120ms ease;
  box-shadow: var(--shadow-1);
}
.tip:hover::after, .tip:focus-visible::after {
  opacity: 1; transform: translateX(-50%) translateY(0);
}
.tip:focus-visible { outline: 1px solid var(--stroke-2); outline-offset: 2px; border-radius: 4px; }
.shortcut-tag {
  display: inline-block; margin-right: 7px; padding: 1px 7px;
  border: 1px solid var(--stroke); border-radius: 999px;
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.04em;
  color: var(--text-3); vertical-align: 1px;
}

.services { margin-top: 10px; }
@media (max-width: 720px) {
  .intro { margin-bottom: 14px; }
  .intro-title { font-size: clamp(1.5rem, 7vw, 1.9rem); }
}

/* ---------- downloads dock ---------- */
.dock { position: relative; }
.dock-btn { position: relative; }
.dock-badge {
  position: absolute; top: 1px; right: 1px;
  min-width: 15px; height: 15px; padding: 0 4px;
  display: grid; place-items: center;
  border-radius: var(--r-full);
  background: var(--text); color: var(--bg);
  font-family: var(--mono); font-size: 9px; font-weight: 600; line-height: 1;
}
.dock.is-open .dock-btn { color: var(--text); background: var(--surface-2); border-color: var(--stroke); }
.dock-panel {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 70;
  width: min(430px, calc(100vw - 20px));
  max-height: min(70vh, 540px); overflow-y: auto; overscroll-behavior: contain;
  padding: 10px;
  border: 1px solid var(--stroke-2); border-radius: var(--r-md);
  background: var(--bg-elev); box-shadow: var(--shadow-2);
}
.dock-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.dock-panel .queue-list { gap: 6px; }
.dock-panel .empty { padding: 8px 2px 4px; }

@media (max-width: 720px) {
  .dock-panel {
    position: fixed;
    top: calc(54px + env(safe-area-inset-top));
    left: 8px; right: 8px; width: auto;
    max-height: 62vh;
  }
  .nav-link[data-view="download"] { display: none; }
}
.dock-badge.is-dot {
  width: 7px; height: 7px; min-width: 7px; padding: 0;
  top: 5px; right: 5px;
  font-size: 0; color: transparent;
}

/* ---------- intro kicker ---------- */

/* ---------- tools menu polish ---------- */
.nav-tools > summary {
  min-height: 28px; padding: 5px 9px;
  border-radius: var(--r-sm);
  transition: color var(--speed), background var(--speed);
}
.nav-tools > summary:hover { color: var(--text-2); }
.nav-tools > summary:focus-visible { outline: 2px solid var(--text-2); outline-offset: 2px; }
.nav-tools[open] > summary { background: var(--surface-2); color: var(--text); }
.nav-menu {
  top: calc(100% + 6px); left: 0; right: auto;
  min-width: 158px; padding: 4px; gap: 1px; z-index: 75;
  max-width: calc(100vw - 20px);
}
.nav-menu a {
  padding: 8px 10px; border-radius: 5px;
  transition: background var(--speed), color var(--speed);
}
.nav-menu a:focus-visible { outline: 2px solid var(--text-2); outline-offset: -2px; }
.nav-menu a.is-active { background: var(--surface-2); }

@media (max-width: 720px) {
  .nav-tools > summary { padding: 7px 8px; min-height: 34px; }
  .nav-menu { left: 0; right: auto; min-width: 150px; }
}

/* ---------- motion hygiene ---------- */
/* everyone who asks their OS for less motion gets none of ours */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* interactive bits that used to snap */
.nav-link, .icon-btn, .ghost-btn, .primary-btn, .chip, .sheet-nav-item,
.quickpick-btn, .back-btn, .mode, .seg button {
  will-change: auto;
}
