/* MP4Fetch — single stylesheet */

:root {
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 16px;
  --radius-lg: 24px;
  --ease: cubic-bezier(.2, .8, .2, 1);

  --accent-1: #7c5cff;
  --accent-2: #22d3ee;
  --accent: #8b74ff;
  --grad: linear-gradient(120deg, var(--accent-1), var(--accent-2));

  --yt: #ff2d46;
  --tt: #25f4ee;
  --tt-2: #fe2c55;
  --ig: #e1306c;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0b10;
  --bg-2: #10121a;
  --surface: rgba(255, 255, 255, .04);
  --surface-2: rgba(255, 255, 255, .07);
  --surface-solid: #141722;
  --border: rgba(255, 255, 255, .09);
  --border-2: rgba(255, 255, 255, .16);
  --text: #eef0f6;
  --muted: #9aa1b5;
  --danger: #ff6b81;
  --danger-bg: rgba(255, 107, 129, .1);
  --ok: #4ade80;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, .7);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f7fb;
  --bg-2: #eef0f7;
  --surface: rgba(255, 255, 255, .7);
  --surface-2: #ffffff;
  --surface-solid: #ffffff;
  --border: rgba(16, 20, 40, .09);
  --border-2: rgba(16, 20, 40, .18);
  --text: #121521;
  --muted: #555c70;
  --accent: #5b3df5;
  --danger: #c8233f;
  --danger-bg: #fdecef;
  --ok: #15803d;
  --shadow: 0 20px 50px -24px rgba(30, 30, 80, .28);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  font: 16px/1.6 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
img { max-width: 100%; display: block; }
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -.02em; margin: 0; }
p { margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
kbd {
  font: 600 .75em var(--mono);
  padding: .1em .45em;
  border: 1px solid var(--border-2);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface);
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 1.25em; height: 1.25em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round;
}
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }

.skip-link {
  position: absolute; left: 1rem; top: -100px; z-index: 100;
  padding: .6rem 1rem; border-radius: 10px; background: var(--accent-1); color: #fff; text-decoration: none;
}
.skip-link:focus { top: 1rem; }

.container { width: min(1120px, 100% - 2.5rem); margin-inline: auto; }
.container-narrow { width: min(760px, 100% - 2.5rem); }

/* ---------- Buttons ---------- */
.btn {
  --h: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: var(--h); padding: 0 1.1rem;
  border: 1px solid transparent; border-radius: 12px;
  font-weight: 600; font-size: .95rem; white-space: nowrap; text-decoration: none;
  transition: transform .15s var(--ease), background .2s, border-color .2s, box-shadow .2s, opacity .2s;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  color: #fff; background: var(--grad);
  box-shadow: 0 8px 24px -10px var(--accent-1), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 10px 30px -8px var(--accent-1), inset 0 1px 0 rgba(255, 255, 255, .3); }
.btn-soft { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.btn-soft:hover { border-color: var(--border-2); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface); }
.btn-sm { --h: 36px; padding: 0 .8rem; font-size: .875rem; border-radius: 10px; }
.btn-lg { --h: 54px; font-size: 1.02rem; border-radius: 14px; }
.btn-block { width: 100%; }
.link-btn {
  background: none; border: 0; padding: .25rem 0; color: var(--muted); font-size: .9rem;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.link-btn:hover { color: var(--text); }
.icon-btn {
  position: relative; display: inline-grid; place-items: center;
  width: 44px; height: 44px; border-radius: 12px;
  background: transparent; border: 1px solid transparent; color: var(--muted);
  transition: background .2s, color .2s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .dot {
  position: absolute; top: 10px; right: 10px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-2); box-shadow: 0 0 0 2px var(--bg);
}
[data-theme="dark"] .show-light, [data-theme="light"] .show-dark { display: none; }

.spinner {
  display: none; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Header ---------- */
.header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 1rem; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--text); text-decoration: none; font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: var(--grad); color: #fff; box-shadow: 0 6px 18px -8px var(--accent-1);
}
.brand-mark .icon { stroke-width: 2.4; }
.brand-name span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav { display: flex; gap: .25rem; margin-left: auto; }
.nav a { padding: .5rem .8rem; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: .95rem; }
.nav a:hover { color: var(--text); background: var(--surface); }
.header-actions { display: flex; gap: .25rem; }
@media (max-width: 720px) {
  .nav { display: none; }
  .header-actions { margin-left: auto; }
}

/* ---------- Hero ---------- */
.hero { position: relative; padding: clamp(3rem, 9vw, 6.5rem) 0 3rem; overflow: hidden; }
.hero-glow {
  position: absolute; inset: -30% -10% auto; height: 640px; pointer-events: none; z-index: -1;
  background:
    radial-gradient(40% 50% at 30% 40%, color-mix(in srgb, var(--accent-1) 28%, transparent), transparent 70%),
    radial-gradient(35% 45% at 72% 35%, color-mix(in srgb, var(--accent-2) 20%, transparent), transparent 70%);
  filter: blur(20px);
}
.hero-inner { display: flex; flex-direction: column; align-items: center; text-align: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .35rem .85rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); font-size: .85rem; font-weight: 500;
}
.eyebrow .icon { color: var(--accent-2); width: 1em; height: 1em; }
.hero h1 { margin-top: 1.25rem; font-size: clamp(2.4rem, 7vw, 4.6rem); font-weight: 800; letter-spacing: -.04em; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { margin-top: 1rem; max-width: 36rem; color: var(--muted); font-size: clamp(1rem, 2.2vw, 1.15rem); }

/* ---------- Fetch form ---------- */
.fetch { width: min(760px, 100%); margin-top: 2.25rem; }
.fetch-shell {
  --ring: var(--border-2);
  position: relative;
  display: flex; align-items: center; gap: .5rem;
  padding: 8px;
  border-radius: 22px;
  background: var(--surface-solid);
  border: 1px solid var(--ring);
  box-shadow: var(--shadow);
  transition: border-color .25s, box-shadow .25s;
}
/* Animated gradient ring on focus */
.fetch-shell::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1.5px;
  background: conic-gradient(from var(--angle, 0deg), var(--accent-1), var(--accent-2), var(--accent-1));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity .3s; pointer-events: none;
}
.fetch-shell:focus-within::before { opacity: 1; animation: ring 4s linear infinite; }
.fetch-shell:focus-within { box-shadow: var(--shadow), 0 0 0 6px color-mix(in srgb, var(--accent-1) 14%, transparent); }
@property --angle { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes ring { to { --angle: 360deg; } }

.fetch[data-invalid="true"] .fetch-shell { border-color: var(--danger); }
.fetch[data-invalid="true"] .fetch-shell::before { opacity: 0; }
.fetch.is-dragover .fetch-shell { border-color: var(--accent-2); }

.fetch-field { position: relative; flex: 1; display: flex; align-items: center; min-width: 0; }
.fetch-platform {
  display: grid; place-items: center; flex: none;
  width: 44px; height: 44px; margin-left: 2px; border-radius: 14px;
  background: var(--surface-2); color: var(--muted);
  transition: background .3s, color .3s, transform .3s var(--ease);
}
.fetch-platform .pf { display: none; width: 22px; height: 22px; }
.fetch[data-platform=""] .pf-none,
.fetch[data-platform="youtube"] .pf-youtube,
.fetch[data-platform="tiktok"] .pf-tiktok,
.fetch[data-platform="instagram"] .pf-instagram { display: block; }
.fetch[data-platform="youtube"] .fetch-platform { background: color-mix(in srgb, var(--yt) 16%, transparent); color: var(--yt); transform: scale(1.05); }
.fetch[data-platform="tiktok"] .fetch-platform { background: color-mix(in srgb, var(--tt-2) 14%, transparent); color: var(--tt-2); transform: scale(1.05); }
.fetch[data-platform="instagram"] .fetch-platform { background: color-mix(in srgb, var(--ig) 15%, transparent); color: var(--ig); transform: scale(1.05); }

.fetch input {
  flex: 1; min-width: 0; height: 52px; padding: 0 2.6rem 0 .85rem;
  border: 0; background: transparent; outline: none;
  font-size: 1.05rem; text-overflow: ellipsis;
}
.fetch input::placeholder { color: var(--muted); opacity: .85; }
.fetch input:focus-visible { outline: none; }
.fetch-clear {
  position: absolute; right: 4px; display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 10px; border: 0;
  background: transparent; color: var(--muted);
}
.fetch-clear:hover { background: var(--surface-2); color: var(--text); }
.fetch-actions { display: flex; gap: .5rem; flex: none; }
.fetch-actions .btn { --h: 52px; border-radius: 15px; }
.fetch-go { min-width: 124px; font-size: 1rem; }
.fetch-go-arrow { transition: transform .2s var(--ease); }
.fetch-go:hover .fetch-go-arrow { transform: translateX(3px); }
.fetch[data-state="loading"] .spinner { display: block; }
.fetch[data-state="loading"] .fetch-go-arrow { display: none; }

.fetch-hint { margin-top: .85rem; min-height: 1.5em; font-size: .9rem; color: var(--muted); }
.fetch-hint b { color: var(--text); font-weight: 600; }
.fetch-hint .hint-text:empty { display: none; }
.fetch-hint .hint-text:not(:empty) ~ .hint-default,
.fetch-hint:has(.hint-text:not(:empty)) .hint-default { display: none; }
.fetch[data-invalid="true"] .fetch-hint { color: var(--danger); }
.fetch[data-hint="ok"] .fetch-hint { color: var(--ok); }

@media (max-width: 600px) {
  .fetch-shell { flex-direction: column; align-items: stretch; padding: 8px; border-radius: 20px; }
  .fetch-actions { display: grid; grid-template-columns: auto 1fr; }
  .fetch-actions:has(#pasteBtn[hidden]) { grid-template-columns: 1fr; }
  .fetch-actions .btn { --h: 50px; }
  .fetch input { height: 50px; font-size: 1rem; }
}

/* ---------- Alerts ---------- */
.alert {
  display: flex; align-items: flex-start; gap: .75rem; text-align: left;
  width: min(760px, 100%); margin-top: 1.25rem; padding: 1rem 1.1rem;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface);
}
.alert-error { border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: var(--danger-bg); }
.alert-error > .icon { color: var(--danger); margin-top: .15rem; }
.alert > div { flex: 1; }
.alert p { color: var(--muted); font-size: .93rem; margin-top: .15rem; }

/* ---------- Result card ---------- */
.result {
  width: min(760px, 100%); margin-top: 1.5rem; text-align: left;
  display: grid; grid-template-columns: 260px 1fr; gap: 1.25rem;
  padding: 1rem; border-radius: var(--radius-lg);
  background: var(--surface-solid); border: 1px solid var(--border); box-shadow: var(--shadow);
  animation: rise .45s var(--ease);
  outline: none;
}
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.99); } }
.result-media {
  position: relative; aspect-ratio: 16 / 10; border-radius: 16px; overflow: hidden;
  background: var(--bg-2);
}
.result[data-platform="tiktok"] .result-media,
.result[data-platform="instagram"] .result-media { aspect-ratio: 4 / 5; }
.result-media img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .3s; }
.result-media img.is-loaded { opacity: 1; }
.result-badge {
  position: absolute; top: 10px; left: 10px; padding: .2rem .55rem; border-radius: 8px;
  font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #fff;
  background: rgba(0, 0, 0, .55); backdrop-filter: blur(8px);
}
.result[data-platform="youtube"] .result-badge { background: var(--yt); }
.result[data-platform="tiktok"] .result-badge { background: linear-gradient(120deg, #111 0%, #111 60%, var(--tt-2)); }
.result[data-platform="instagram"] .result-badge { background: linear-gradient(120deg, #f58529, #dd2a7b, #8134af); }
.result-duration {
  position: absolute; right: 10px; bottom: 10px; padding: .15rem .5rem; border-radius: 7px;
  background: rgba(0, 0, 0, .7); color: #fff; font: 600 .78rem var(--mono);
}
.result-body { display: flex; flex-direction: column; gap: .85rem; min-width: 0; }
.result-title { font-size: 1.15rem; font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.result-author { color: var(--muted); font-size: .92rem; margin-top: -.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-new { align-self: flex-start; }

/* Skeleton */
.sk { display: block; height: 1em; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), var(--border-2), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.sk-line { width: 90%; }
.sk-short { width: 40%; }
.result[aria-busy="true"] .result-media { background: linear-gradient(90deg, var(--bg-2), var(--surface-2), var(--bg-2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.result[aria-busy="true"] .seg,
.result[aria-busy="true"] .chips,
.result[aria-busy="true"] #downloadBtn,
.result[aria-busy="true"] .result-new { visibility: hidden; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Segmented control */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--border); }
.seg-item input { position: absolute; opacity: 0; pointer-events: none; }
.seg-item span {
  display: flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 40px; padding: 0 .75rem; border-radius: 10px;
  color: var(--muted); font-weight: 600; font-size: .92rem; cursor: pointer;
  transition: background .2s, color .2s, box-shadow .2s;
}
.seg-item span .icon { width: 1.05em; height: 1.05em; }
.seg-item input:checked + span { background: var(--surface-solid); color: var(--text); box-shadow: 0 2px 10px -4px rgba(0, 0, 0, .35), 0 0 0 1px var(--border); }
.seg-item input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Quality chips */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; padding: 0; border: 0; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 78px; min-height: 52px; padding: .35rem .8rem; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface);
  font-weight: 700; font-size: .95rem; line-height: 1.2; cursor: pointer;
  transition: border-color .2s, background .2s, transform .15s var(--ease);
}
.chip small { font-weight: 500; font-size: .72rem; color: var(--muted); }
.chip:hover span { border-color: var(--border-2); }
.chip input:checked + span {
  border-color: transparent;
  background: linear-gradient(var(--surface-solid), var(--surface-solid)) padding-box, var(--grad) border-box;
  border: 1.5px solid transparent;
  box-shadow: 0 6px 20px -12px var(--accent-1);
}
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip input:disabled + span { opacity: .45; cursor: not-allowed; }

/* Job progress */
.job { display: grid; gap: .5rem; }
.job-row { display: flex; justify-content: space-between; font-size: .92rem; font-weight: 600; }
.job-pct { font-family: var(--mono); color: var(--muted); }
.job-track { height: 10px; border-radius: 999px; background: var(--bg-2); overflow: hidden; border: 1px solid var(--border); }
.job-fill { height: 100%; width: 0; background: var(--grad); border-radius: inherit; transition: width .3s var(--ease); }
.job.is-indeterminate .job-fill { width: 35% !important; animation: indet 1.2s ease-in-out infinite; }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.job .link-btn { justify-self: start; }

.done {
  display: flex; align-items: center; gap: .65rem; flex-wrap: wrap;
  padding: .8rem 1rem; border-radius: 14px;
  background: color-mix(in srgb, var(--ok) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent);
  font-size: .92rem;
}
.done > .icon { color: var(--ok); }
.done p { flex: 1; min-width: 12rem; }
.done span { color: var(--muted); }

@media (max-width: 640px) {
  .result { grid-template-columns: 1fr; padding: .85rem; }
  .result-media, .result[data-platform] .result-media { aspect-ratio: 16 / 9; }
  .chip { flex: 1 1 calc(50% - .5rem); }
  .chip span { width: 100%; }
}

/* ---------- Platforms ---------- */
.platforms { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; margin: 2.25rem 0 0; padding: 0; list-style: none; }
.pchip {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .5rem .9rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); font-size: .87rem;
}
.pchip b { color: var(--text); margin-right: .2rem; }
.pchip-youtube .icon { color: var(--yt); }
.pchip-tiktok .icon { color: var(--tt-2); }
.pchip-instagram .icon { color: var(--ig); }

/* ---------- Sections ---------- */
.section { padding: clamp(3rem, 8vw, 5.5rem) 0; }
.section + .section { border-top: 1px solid var(--border); }
.section-head { text-align: center; margin-bottom: 2.25rem; }
.kicker { color: var(--accent); font-weight: 700; font-size: .82rem; letter-spacing: .12em; text-transform: uppercase; margin-bottom: .5rem; }
.section-head h2 { font-size: clamp(1.7rem, 4vw, 2.4rem); }

.card { padding: 1.4rem; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); }
.card h3 { font-size: 1.08rem; margin: .8rem 0 .35rem; }
.card p { color: var(--muted); font-size: .95rem; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; padding: 0; margin: 0; list-style: none; counter-reset: none; }
.step-n {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: var(--grad); color: #fff; font-weight: 800;
}
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.feature > .icon { width: 28px; height: 28px; color: var(--accent); }
@media (max-width: 860px) { .steps, .features { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .steps, .features { grid-template-columns: 1fr; } }

.faq { display: grid; gap: .6rem; }
.faq details { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  min-height: 56px; padding: .9rem 1.15rem; font-weight: 600; cursor: pointer; list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary .icon { color: var(--muted); transition: transform .25s var(--ease); }
.faq details[open] summary .icon { transform: rotate(180deg); }
.faq details p { padding: 0 1.15rem 1.1rem; color: var(--muted); }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); padding: 2rem 0 calc(2rem + env(safe-area-inset-bottom)); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 2rem; }
.footer-nav { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; margin-left: auto; }
.footer-nav a { color: var(--muted); text-decoration: none; font-size: .92rem; padding: .4rem 0; }
.footer-nav a:hover { color: var(--text); }
.footer-note { width: 100%; color: var(--muted); font-size: .82rem; }

/* ---------- Modal ---------- */
.modal {
  width: min(560px, calc(100% - 2rem)); max-height: min(80vh, 700px);
  padding: 1.25rem; border-radius: var(--radius-lg);
  border: 1px solid var(--border); background: var(--surface-solid); color: var(--text);
  box-shadow: var(--shadow);
}
.modal::backdrop { background: rgba(5, 6, 12, .6); backdrop-filter: blur(4px); }
.modal[open] { animation: rise .3s var(--ease); }
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { font-size: 1.2rem; }
.modal-sub { color: var(--muted); font-size: .9rem; margin-bottom: 1rem; }
.modal-foot { display: flex; justify-content: flex-end; margin-top: 1rem; }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.history li {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem .75rem; border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
}
.history .h-fmt { flex: none; padding: .2rem .45rem; border-radius: 7px; font: 700 .72rem var(--mono); background: var(--bg-2); }
.history .h-body { flex: 1; min-width: 0; }
.history .h-title { font-weight: 600; font-size: .93rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history .h-meta { color: var(--muted); font-size: .8rem; }
.history-empty { color: var(--muted); text-align: center; padding: 1.5rem 0; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; left: 50%; bottom: calc(1.25rem + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; display: grid; gap: .5rem; width: min(420px, calc(100% - 2rem)); }
.toast {
  padding: .8rem 1rem; border-radius: 14px; font-size: .92rem; font-weight: 500;
  background: var(--surface-solid); border: 1px solid var(--border-2); box-shadow: var(--shadow);
  animation: rise .3s var(--ease);
}
.toast.is-leaving { opacity: 0; transform: translateY(8px); transition: .25s; }

/* ---------- Legal page ---------- */
.legal { padding: 3rem 0 4rem; }
.legal h1 { font-size: clamp(2rem, 5vw, 2.8rem); margin-bottom: .5rem; }
.legal h2 { font-size: 1.4rem; margin: 2.5rem 0 .75rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.legal p, .legal li { color: var(--muted); }
.legal p + p { margin-top: .75rem; }
.legal ul { padding-left: 1.2rem; }
.legal strong { color: var(--text); }

.notfound { min-height: 60vh; display: grid; place-content: center; text-align: center; gap: 1rem; padding: 3rem 1rem; }
.notfound h1 { font-size: clamp(3rem, 12vw, 6rem); }

/* ---------- Motion & print ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

@media print {
  :root, [data-theme] { --bg: #fff; --surface: #fff; --surface-solid: #fff; --text: #000; --muted: #333; --border: #ccc; }
  body { background: #fff; color: #000; }
  .header, .hero-glow, .fetch, .result, .alert, .platforms, .toasts, .modal, .skip-link, .header-actions { display: none !important; }
  .hero { padding: 1rem 0; }
  .grad, .brand-name span { color: #000 !important; -webkit-text-fill-color: #000; background: none; }
  .card, .faq details { break-inside: avoid; box-shadow: none; }
  .faq details > p { display: block; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; }
}
.legal-back { margin-top: 2.5rem; }
