/* ============================================================
   Daun — UI styles. No frameworks, no external fonts.
   ============================================================ */
:root {
  --bg: #0b0b0c;
  --surface: #131315;
  --surface-2: #1a1a1d;
  --surface-3: #232327;
  --border: #26262b;
  --border-strong: #3a3a41;
  --text: #f4f4f5;
  --text-2: #b4b4bc;
  --muted: #7c7c86;
  --accent: #7aa2ff;
  --accent-2: #5b86f7;
  --on-accent: #0b0b0c;
  --ok: #4ade80;
  --warn: #fbbf24;
  --err: #f87171;
  --primary: #ffffff;
  --on-primary: #0b0b0c;
  --radius: 16px;
  --radius-sm: 11px;
  --radius-xs: 8px;
  --shadow: 0 12px 40px rgba(0, 0, 0, .45);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --ring: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
  color-scheme: dark;
}
html[data-theme="light"] {
  --bg: #f4f4f6;
  --surface: #ffffff;
  --surface-2: #f2f2f5;
  --surface-3: #e9e9ee;
  --border: #e1e1e7;
  --border-strong: #c9c9d3;
  --text: #111114;
  --text-2: #3f3f47;
  --muted: #71717c;
  --accent: #2f5bea;
  --accent-2: #254bd0;
  --on-accent: #ffffff;
  --primary: #111114;
  --on-primary: #ffffff;
  --shadow: 0 12px 30px rgba(20, 20, 40, .10);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: var(--mono); }
.inline-ic { width: 14px; height: 14px; vertical-align: -2px; margin-right: .3rem; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-xs); }

/* ---------- layout ---------- */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
main { width: min(100% - 2rem, 800px); margin: 0 auto; flex: 1; padding: 0 0 3rem; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  width: min(100% - 2rem, 1100px); margin: 0 auto; padding: .9rem 0;
}
.brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--text); font-weight: 700; letter-spacing: -.01em; font-size: 1.15rem; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; color: var(--accent); }
.brand-name { display: inline-flex; align-items: baseline; }
.brand-tld { color: var(--muted); font-size: .62em; font-weight: 700; margin-left: .06em; }
.nav { display: flex; gap: .25rem; }
.nav-btn {
  display: inline-flex; align-items: center; gap: .45rem; height: 38px; padding: 0 .85rem;
  border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--text-2); font-weight: 500;
}
.nav-btn:hover { background: var(--surface); color: var(--text); }
.nav-btn.is-active { background: var(--surface); border-color: var(--border); color: var(--text); }
.nav-btn svg { width: 17px; height: 17px; }
.nav-theme { width: 38px; padding: 0; justify-content: center; }
.nav-theme .ic-moon { display: none; }
html[data-theme="light"] .nav-theme .ic-sun { display: none; }
html[data-theme="light"] .nav-theme .ic-moon { display: block; }

/* ---------- views ---------- */
.view { display: none; }
.view.is-active { display: block; animation: rise .22s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1.5rem 0 .75rem; }
h2 { font-size: 1.35rem; margin: 0; letter-spacing: -.01em; }
h3 { font-size: 1.02rem; margin: 0 0 .5rem; }
.lead { color: var(--text-2); font-size: 1.05rem; margin: 0 0 1.25rem; max-width: 60ch; }

/* ---------- hero / omnibox ---------- */
.hero { padding-top: clamp(1.5rem, 8vh, 6rem); transition: padding .25s ease; }
body.is-empty .hero { padding-top: clamp(3rem, 18vh, 12rem); }
.hero-title { font-size: clamp(1.35rem, 3.2vw, 1.9rem); font-weight: 600; letter-spacing: -.02em; margin: 0 0 1.1rem; color: var(--text); }
body:not(.is-empty) .hero-title { font-size: 1.05rem; color: var(--muted); font-weight: 500; margin-bottom: .75rem; }

.omnibox {
  display: flex; align-items: center; gap: .65rem; height: 58px; padding: 0 .75rem 0 1rem;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s;
}
.omnibox:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.omni-icon { color: var(--muted); width: 20px; height: 20px; }
.omnibox input {
  flex: 1; min-width: 0; background: none; border: 0; outline: none; height: 100%;
  font: 500 1rem/1.4 var(--mono); color: var(--text);
}
.omnibox input::placeholder { color: var(--muted); font-family: var(--font); font-weight: 400; }
.omni-clear { color: var(--muted); }
.omni-status { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; min-height: 1.6rem; margin: .55rem .25rem 0; color: var(--text-2); font-size: .92rem; }
.omni-status.is-error { color: var(--err); }
.omni-status .spinner { width: 14px; height: 14px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.omni-status .err-detail { color: var(--muted); font-size: .82rem; }
.omni-status button.link { background: none; border: 0; padding: 0; color: var(--accent); font-size: .85rem; }
@keyframes spin { to { transform: rotate(360deg); } }

.toolbar { display: flex; align-items: center; gap: .6rem; margin-top: .85rem; flex-wrap: wrap; }
.toolbar .segmented { margin: 0 auto; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; height: 42px; padding: 0 1.05rem;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-weight: 500; font-size: .95rem; white-space: nowrap; transition: background .12s, border-color .12s, transform .06s, opacity .12s;
  text-decoration: none;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--on-primary); border-color: transparent; }
.btn-primary:hover { background: color-mix(in srgb, var(--primary) 88%, var(--accent)); }
.btn-ghost { background: transparent; }
.btn-sm { height: 34px; padding: 0 .75rem; font-size: .88rem; border-radius: var(--radius-xs); }
.btn-sm svg { width: 15px; height: 15px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 1px solid transparent;
  background: transparent; color: var(--text-2); transition: background .12s, color .12s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; }

.segmented {
  display: inline-flex; padding: 3px; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.seg {
  display: inline-flex; align-items: center; gap: .4rem; height: 34px; padding: 0 .85rem; border: 0; border-radius: 8px;
  background: transparent; color: var(--text-2); font-weight: 500; transition: background .12s, color .12s;
}
.seg:hover { color: var(--text); }
.seg.is-active { background: var(--surface-3); color: var(--text); }
.seg svg { width: 16px; height: 16px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }

/* ---------- preview ---------- */
.preview { margin-top: 1rem; overflow: hidden; animation: rise .22s ease both; }
.preview-head { display: flex; gap: .9rem; padding: .9rem; align-items: flex-start; }
.pv-thumb-wrap { position: relative; width: 148px; aspect-ratio: 16 / 9; border-radius: var(--radius-xs); overflow: hidden; background: var(--surface-3); flex: none; }
.pv-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.pv-duration { position: absolute; right: 6px; bottom: 6px; padding: 1px 6px; border-radius: 5px; background: rgba(0, 0, 0, .75); color: #fff; font-size: .74rem; font-weight: 600; font-family: var(--mono); }
.pv-duration:empty { display: none; }
.preview-meta { flex: 1; min-width: 0; }
.pv-title { font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pv-sub { color: var(--muted); font-size: .88rem; margin-top: .25rem; display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: 1px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: .76rem; font-weight: 600; letter-spacing: .01em; }
.badge.live { background: color-mix(in srgb, var(--err) 25%, transparent); color: var(--err); }

.preview-body { border-top: 1px solid var(--border); }
.opt-row { display: flex; gap: .9rem; align-items: flex-start; padding: .6rem .9rem; }
.opt-row + .opt-row { border-top: 1px solid var(--border); }
.opt-label { width: 72px; flex: none; padding-top: .42rem; color: var(--muted); font-size: .84rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; flex: 1; }
.chip {
  display: inline-flex; align-items: center; gap: .35rem; height: 32px; padding: 0 .8rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font-size: .88rem; font-weight: 500;
  transition: background .12s, color .12s, border-color .12s;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.is-active { background: var(--primary); color: var(--on-primary); border-color: transparent; }
.chip.is-active small { opacity: .75; }
.chip:disabled { opacity: .45; cursor: not-allowed; }
.chip small { font-weight: 400; opacity: .7; font-size: .78rem; }
.chip svg { width: 14px; height: 14px; }
.chip.toggle.is-active svg { stroke: var(--on-primary); }

.sub-panel { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem 1rem; padding: .7rem .9rem .8rem; border-top: 1px dashed var(--border); background: var(--surface-2); }
.sub-panel-title { width: 100%; color: var(--muted); font-size: .82rem; }
.sub-panel .chips { flex: 1 1 100%; }
.field { display: inline-flex; align-items: center; gap: .5rem; color: var(--text-2); font-size: .9rem; }
.field input { width: 92px; height: 34px; padding: 0 .6rem; border-radius: var(--radius-xs); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-family: var(--mono); }
.field input:focus { outline: none; border-color: var(--accent); }
.check { display: inline-flex; align-items: center; gap: .45rem; color: var(--text-2); font-size: .9rem; cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }

.preview-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem .9rem; border-top: 1px solid var(--border); }
.pv-summary { color: var(--muted); font-size: .88rem; }

/* ---------- search results ---------- */
.search { margin-top: 1rem; overflow: hidden; }
.search-head { display: flex; align-items: center; gap: .6rem; padding: .7rem .9rem; color: var(--text-2); font-size: .92rem; border-bottom: 1px solid var(--border); }
.search-head svg { color: var(--muted); }
.search-head span { flex: 1; }
.search-list { list-style: none; margin: 0; padding: .35rem; }
.search-btn {
  display: flex; align-items: center; gap: .8rem; width: 100%; text-align: left; padding: .5rem .6rem;
  border: 0; border-radius: var(--radius-xs); background: transparent; color: var(--text);
}
.search-btn:hover { background: var(--surface-2); }
.search-thumb { width: 96px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: var(--surface-3); flex: none; }
.search-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.search-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-sub { color: var(--muted); font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-dur { color: var(--muted); font-family: var(--mono); font-size: .82rem; }

/* ---------- jobs ---------- */
.jobs { display: flex; flex-direction: column; gap: .7rem; margin-top: 1.25rem; }
.job { display: grid; grid-template-columns: 112px 1fr auto; gap: .9rem; padding: .8rem .9rem; align-items: center; animation: rise .22s ease both; }
.job-thumb-wrap { width: 112px; aspect-ratio: 16 / 9; border-radius: var(--radius-xs); overflow: hidden; background: var(--surface-3); display: grid; place-items: center; color: var(--muted); }
.job-thumb { width: 100%; height: 100%; object-fit: cover; display: none; }
.job-thumb[src] { display: block; }
.job-thumb[src] + .job-thumb-ph { display: none; }
.job-main { min-width: 0; display: flex; flex-direction: column; gap: .3rem; }
.job-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-sub { color: var(--muted); font-size: .84rem; display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.job-bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; position: relative; }
.job-fill { height: 100%; width: 0; border-radius: 3px; background: var(--accent); transition: width .3s ease; }
.job.is-done .job-fill { background: var(--ok); width: 100% !important; }
.job.is-error .job-fill, .job.is-cancelled .job-fill, .job.is-expired .job-fill { background: var(--err); }
.job.is-indeterminate .job-fill {
  width: 40% !important; animation: slide 1.2s ease-in-out infinite;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }
.job-stats { color: var(--muted); font-size: .82rem; font-family: var(--mono); min-height: 1.1em; }
.job-error { color: var(--err); font-size: .86rem; line-height: 1.4; }
.job-error .hint { color: var(--warn); display: block; margin-top: .15rem; }
.job-error details { color: var(--muted); font-size: .8rem; margin-top: .2rem; }
.job-error summary { cursor: pointer; }
.job-actions { display: flex; align-items: center; gap: .4rem; }
.job.is-done .btn-save { animation: pop .25s ease both; }
@keyframes pop { from { transform: scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.job.is-downloading .status-dot { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.job.is-done .status-dot { background: var(--ok); }
.job.is-error .status-dot, .job.is-expired .status-dot { background: var(--err); }
@keyframes pulse { 50% { opacity: .35; } }

.hint { color: var(--muted); font-size: .86rem; text-align: center; margin: 2.2rem auto 0; max-width: 56ch; }
body:not(.is-empty) .hint { display: none; }
.empty { color: var(--muted); text-align: center; padding: 3rem 1rem; }

/* ---------- history ---------- */
.history-list { list-style: none; margin: .75rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.history-item { display: grid; grid-template-columns: 88px 1fr auto; gap: .8rem; align-items: center; padding: .6rem .75rem; }
.h-thumb { width: 88px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: var(--surface-3); }
.h-main { min-width: 0; }
.h-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-sub { color: var(--muted); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-actions { display: flex; gap: .3rem; }

/* ---------- settings ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: .9rem; }
fieldset.card { margin: 0; padding: .35rem 1rem .6rem; min-width: 0; }
legend { padding: 0 .4rem; color: var(--muted); font-size: .82rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .65rem 0; }
.row + .row { border-top: 1px solid var(--border); }
.row > span:first-child { color: var(--text-2); font-size: .93rem; }
.row select, .row input[type="text"], .row input[type="url"], .row input[type="password"] {
  height: 36px; padding: 0 .65rem; border-radius: var(--radius-xs); border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  max-width: 55%; min-width: 0;
}
.row select { padding-right: 1.6rem; }
.row input.short { width: 110px; font-family: var(--mono); }
.row input.wide { width: 240px; font-family: var(--mono); }
.row input:focus, .row select:focus { outline: none; border-color: var(--accent); }
.row input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.row-cookies { align-items: flex-start; flex-wrap: wrap; }
.row-cookies > span:first-child { flex: 1 1 240px; }
.row-cookies small { display: block; margin-top: .2rem; line-height: 1.4; }
.cookies-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; }
.pill { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .65rem; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: .8rem; }
.pill.ok { color: var(--ok); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ---------- about ---------- */
.about-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: .9rem; }
.about-grid .card { padding: 1rem 1.1rem; }
.stat-head { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .82rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; margin-bottom: .4rem; }
.kv { margin: 0; display: flex; flex-direction: column; }
.kv > div { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-top: 1px solid var(--border); font-size: .92rem; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; font-family: var(--mono); font-size: .86rem; text-align: right; }
.kv dd.ok { color: var(--ok); }
.kv dd.warn { color: var(--warn); }
.stat-actions { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-top: .8rem; }
.prose p { color: var(--text-2); margin: .35rem 0 .7rem; line-height: 1.55; }
.compare { width: 100%; border-collapse: collapse; font-size: .9rem; }
.compare th { text-align: left; color: var(--muted); font-weight: 600; font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; padding: .3rem .4rem; }
.compare td { padding: .42rem .4rem; border-top: 1px solid var(--border); color: var(--text-2); }
.compare td:nth-child(2), .compare td:nth-child(3), .compare th:nth-child(2), .compare th:nth-child(3) { text-align: center; width: 72px; }
.compare td:nth-child(3) { color: var(--ok); font-weight: 600; }
.code { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-xs); padding: .7rem .8rem; font: .78rem/1.5 var(--mono); overflow-x: auto; color: var(--text-2); white-space: pre-wrap; word-break: break-all; margin: .3rem 0 0; }

/* ---------- footer ---------- */
.foot { width: min(100% - 2rem, 1100px); margin: 0 auto; padding: .9rem 0 1.2rem; display: flex; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: .8rem; }
.foot-left { display: inline-flex; align-items: center; gap: .5rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
.dot.err { background: var(--err); }
.dot.warn { background: var(--warn); }

/* ---------- cookie consent ---------- */
.cookie-bar {
  position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); z-index: 60;
  width: min(100% - 2rem, 560px); display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .8rem 1rem; border-radius: var(--radius-sm); background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow); animation: rise .22s ease both;
}
.cookie-text { margin: 0; flex: 1 1 260px; color: var(--text-2); font-size: .9rem; line-height: 1.45; }
.cookie-actions { display: flex; gap: .45rem; margin-left: auto; }
@media (max-width: 480px) {
  .cookie-actions { width: 100%; }
  .cookie-actions .btn { flex: 1; }
}

/* The wall shown to someone who declines: it covers everything, so the only ways on are the
   two buttons inside it. */
.cookie-wall {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center;
  padding: 1rem; background: rgba(0, 0, 0, .72); backdrop-filter: blur(4px);
}
.cookie-wall-card {
  width: min(100%, 440px); padding: 1.4rem 1.5rem; text-align: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); animation: rise .22s ease both;
}
.cookie-wall-text { margin: 0 0 1.1rem; color: var(--text); font-size: 1rem; line-height: 1.5; }
.cookie-wall .cookie-actions { justify-content: center; margin: 0; }

/* ---------- toasts ---------- */
.toasts { position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); display: flex; flex-direction: column; gap: .5rem; z-index: 50; pointer-events: none; width: min(100% - 2rem, 420px); }
.toast {
  pointer-events: auto; padding: .7rem 1rem; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow); color: var(--text); font-size: .92rem; animation: rise .2s ease both; display: flex; gap: .5rem; align-items: center;
}
.toast.ok { border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); }
.toast.err { border-color: color-mix(in srgb, var(--err) 50%, var(--border)); }
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }

/* ---------- dialog ---------- */
.dialog { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 1rem; width: min(100% - 2rem, 720px); max-height: 80vh; box-shadow: var(--shadow); }
.dialog::backdrop { background: rgba(0, 0, 0, .55); backdrop-filter: blur(3px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .6rem; }
.dialog input[type="search"] { width: 100%; height: 38px; padding: 0 .75rem; border-radius: var(--radius-xs); border: 1px solid var(--border); background: var(--surface-2); color: var(--text); margin-bottom: .7rem; }
.sites-list { display: flex; flex-wrap: wrap; gap: .35rem; max-height: 55vh; overflow: auto; padding-right: .25rem; }
.sites-list span { padding: .2rem .55rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: .78rem; color: var(--text-2); font-family: var(--mono); }

.dialog-terms { width: min(100% - 2rem, 580px); }
.terms-lead { color: var(--text); margin: .2rem 0 .7rem; line-height: 1.55; }
.terms-list { margin: 0; padding-left: 1.15rem; color: var(--text-2); line-height: 1.55; }
.terms-list li { margin: .4rem 0; }
.terms-list li::marker { color: var(--accent); }
.dialog-foot { display: flex; justify-content: flex-end; margin-top: 1rem; }
.foot a { color: var(--muted); text-decoration: underline dotted; }
.foot a:hover { color: var(--text); }
.badge.embed { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }

/* On a public instance the machine's internals belong to whoever runs it, not to visitors. */
body.is-public .owner-only { display: none !important; }

/* ---------- platform status ---------- */
.status-strip { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .35rem .5rem; margin: 1rem auto 0; max-width: 60ch; font-size: .8rem; color: var(--muted); }
body:not(.is-empty) .status-strip { display: none; }
.status-strip .lbl { margin-right: .2rem; }
.status-pill { display: inline-flex; align-items: center; gap: .35rem; padding: .18rem .55rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); }
.status-pill .dot { width: 7px; height: 7px; }
.status-pill.ok { color: var(--ok); }
.status-pill.warn { color: var(--warn); }
.status-pill.err { color: var(--err); }
.kv dd .dot { margin-right: .4rem; vertical-align: 1px; }
.kv dd.err { color: var(--err); }
.kv dd .why { display: block; color: var(--muted); font-family: var(--font); font-size: .78rem; margin-top: .1rem; max-width: 34ch; }
html[data-theme="light"] :is(#selftest-card, #status-strip) {
  --ok: #15803d;
  --warn: #9a6700;
  --err: #c62929;
}

/* Explain access restrictions without asking public visitors for credentials. */
.access-help, .job-error .access-help { margin-top: .5rem; color: var(--text-2); font: .85rem/1.5 var(--font); text-align: left; }
.access-help summary { cursor: pointer; color: var(--accent); }
.access-help p { margin: .6rem 0; }
.access-help p:last-child { color: var(--muted); font-size: .8rem; }
.access-help strong { font-weight: 600; }
.omni-status .access-help { flex-basis: 100%; }
.omni-status .access-help p { max-width: 70ch; }
.kv dd { min-width: 0; }
.kv dd .access-help { max-width: 34ch; }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  .nav-btn span { display: none; }
  .nav-btn { padding: 0 .7rem; }
  .toolbar { gap: .5rem; }
  .toolbar .segmented { order: -1; width: 100%; display: flex; }
  .toolbar .seg { flex: 1; justify-content: center; }
  .toolbar #paste, .toolbar #go { flex: 1; }
  .omnibox { height: 54px; }
  .preview-head { flex-wrap: wrap; }
  .pv-thumb-wrap { width: 100%; }
  .preview-meta { order: 3; flex-basis: 100%; }
  #pv-close { order: 2; margin-left: auto; }
  .opt-row { flex-direction: column; gap: .4rem; }
  .opt-label { padding-top: 0; }
  .job { grid-template-columns: 1fr auto; }
  .job-thumb-wrap { display: none; }
  .history-item { grid-template-columns: 1fr auto; }
  .h-thumb { display: none; }
  .row input.wide { width: 160px; }
  .foot { flex-direction: column; gap: .25rem; align-items: center; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
}
