:root {
  --bg: #050304;
  --blood: #d1142f;
  --blood-hi: #ec2d4b;
  --blood-deep: #6e0014;
  --ink: #f4eded;
  --muted: #9b8c8e;
  --faint: #5e5254;
  --line: rgba(255, 235, 235, .1);
  --glass: rgba(10, 5, 6, .62);
  --ease: cubic-bezier(.22, 1, .36, 1);
    --font: 'Geist', ui-sans-serif, system-ui, 'Segoe UI', sans-serif;
  --gut: clamp(20px, 5vw, 56px);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100svh; background: var(--bg); color: var(--ink); font: 400 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden; display: flex; flex-direction: column; }
h1, p { margin: 0; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--blood-hi); outline-offset: 3px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: #000; padding: 10px 14px; border-radius: 8px; font-weight: 600; }
.skip:focus { top: 12px; }

.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--bg); }
.bg-glow { position: absolute; left: 50%; top: 50%; width: min(90vw, 900px); aspect-ratio: 1; transform: translate(-50%, -50%); background: radial-gradient(closest-side, rgba(170, 10, 40, .36), rgba(100, 0, 22, .14) 55%, transparent 75%); transition: opacity 1.2s var(--ease); }
.bg-art { position: absolute; inset: -12%; background-size: cover; background-position: center; filter: blur(64px) saturate(1.35); transform: scale(1.12); opacity: 0; transition: opacity 1.4s var(--ease); }
.bg-art.on { opacity: .62; }
.bg-shade { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 45%, rgba(5, 3, 4, .45), rgba(5, 3, 4, .88) 85%); }
.has-art .bg-glow { opacity: 0; }

.screen { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 16px; padding: 40px var(--gut); width: min(560px, 100%); margin-inline: auto; }
.logo { width: 72px; height: 72px; filter: drop-shadow(0 0 28px rgba(209, 20, 47, .55)); transition: transform .6s var(--ease); }
.logo:hover { transform: scale(1.06); }

h1 { font: 600 clamp(24px, 3vw, 30px)/1.2 var(--font); letter-spacing: -.02em; text-wrap: balance; }
h1 span { color: var(--blood-hi); }

.field { display: flex; align-items: center; gap: 6px; width: 100%; padding: 6px; background: var(--glass); border: 1px solid var(--line); border-radius: 14px; backdrop-filter: blur(14px); transition: border-color .3s, box-shadow .5s var(--ease); }
.field:focus-within { border-color: rgba(236, 45, 75, .7); box-shadow: 0 0 0 4px rgba(209, 20, 47, .14), 0 16px 50px -18px rgba(209, 20, 47, .5); }
.field input { flex: 1; min-width: 0; min-height: 46px; padding: 0 12px; background: transparent; border: 0; outline: 0; color: var(--ink); font: 400 15px/1 var(--font); text-align: left; }
.field input::placeholder { color: var(--faint); }
.hint { color: var(--muted); font-size: 14px; }
.err { color: #ff6b7e; font-size: 14px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 46px; padding: 0 22px; border: 0; border-radius: 10px; font: 600 15px/1 var(--font); color: var(--ink); cursor: pointer; transition: transform .3s var(--ease), box-shadow .4s var(--ease), background .25s, opacity .2s; -webkit-tap-highlight-color: transparent; }
.btn:active { transform: scale(.96); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-blood { background: linear-gradient(180deg, #ec2d4b 0%, #b30f2c 100%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .34), inset 0 -12px 22px rgba(70, 0, 16, .55), 0 8px 26px -10px rgba(209, 20, 47, .8); }
.btn-blood:hover { transform: translateY(-2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), inset 0 -12px 22px rgba(70, 0, 16, .45), 0 14px 36px -10px rgba(236, 45, 75, .95); }
.btn-blood:active { transform: translateY(0) scale(.96); }
.btn-quiet { background: rgba(255, 235, 235, .06); }
.btn-quiet:hover { background: rgba(255, 235, 235, .12); transform: translateY(-1px); }
.spin { display: none; width: 15px; height: 15px; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; animation: rot .7s linear infinite; }
.is-busy .spin { display: block; }
@keyframes rot { to { transform: rotate(360deg); } }

[data-enter] [data-e] { opacity: 0; transform: translateY(10px); }
[data-enter].in [data-e] { opacity: 1; transform: none; transition: opacity .7s var(--ease), transform .7s var(--ease); transition-delay: calc(var(--i, 0) * 70ms); }

.stage { width: 100%; display: grid; justify-items: center; animation: rise .7s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.cover { width: 120px; height: 120px; border-radius: 6px; background: #1a1012 center/cover; box-shadow: 0 24px 60px -16px #000, 0 0 0 1px rgba(255, 255, 255, .06); margin-bottom: 18px; }
.title { font: 600 20px/1.25 var(--font); letter-spacing: -.01em; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { margin-top: 6px; color: var(--muted); font-size: 14px; }
.meta b { color: var(--ink); font-weight: 500; }

.opts { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 20px; }
.seg { display: inline-flex; padding: 3px; background: var(--glass); border: 1px solid var(--line); border-radius: 12px; backdrop-filter: blur(14px); }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.seg span { display: grid; place-items: center; min-width: 54px; height: 38px; padding: 0 14px; border-radius: 9px; font: 500 14px/1 var(--font); color: var(--muted); transition: color .2s, background .3s var(--ease); }
.seg label:hover span { color: var(--ink); }
.seg input:checked + span { background: rgba(255, 235, 235, .1); color: var(--ink); box-shadow: inset 0 0 0 1px rgba(255, 235, 235, .12); }
.seg input:focus-visible + span { outline: 2px solid var(--blood-hi); outline-offset: 2px; }

.go-row { margin-top: 16px; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.go-row .btn-blood { min-height: 50px; padding: 0 28px; }
.note { margin-top: 16px; padding: 12px 16px; border-radius: 10px; background: rgba(209, 20, 47, .1); color: #e8dcdc; font-size: 14px; max-width: 52ch; }
.note b { color: #fff; font-weight: 600; }
.note .ulink { color: var(--blood-hi); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.note .ulink:hover { color: #fff; }

.run { width: 100%; max-width: 420px; margin-top: 22px; display: grid; gap: 12px; }
.bar { position: relative; height: 6px; background: rgba(255, 235, 235, .1); border-radius: 6px; overflow: hidden; }
.bar i { position: absolute; inset: 0; transform-origin: left; transform: scaleX(0); background: var(--blood-hi); border-radius: inherit; box-shadow: 0 0 18px rgba(236, 45, 75, .7); }
.run-line { display: flex; justify-content: space-between; gap: 16px; font-size: 13px; color: var(--muted); }
.run-line b { color: var(--ink); font-weight: 500; }

.list { max-height: 210px; overflow: auto; text-align: left; border-top: 1px solid var(--line); scrollbar-width: thin; scrollbar-color: #3a2a2c transparent; }
.tr { display: grid; grid-template-columns: minmax(0, 1fr) 34px; align-items: center; gap: 8px; min-height: 42px; border-bottom: 1px solid var(--line); font-size: 14px; animation: rise .5s var(--ease) both; }
.tr .t { min-width: 0; display: flex; gap: 8px; align-items: baseline; }
.tr .t b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; }
.tr .t small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1 1 0; min-width: 0; }
.tr .st { display: grid; place-items: center; }
.ic { width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; }
.tr[data-s="pending"] .ic { border: 1.5px solid #3a2e30; }
.tr[data-s="matching"] .ic, .tr[data-s="downloading"] .ic, .tr[data-s="encoding"] .ic { border: 2px solid rgba(255, 255, 255, .12); border-top-color: var(--blood-hi); animation: rot .8s linear infinite; }
.tr[data-s="failed"] .t b { color: var(--faint); text-decoration: line-through; }
.tr[data-s="failed"] .ic { background: rgba(255, 90, 110, .16); color: #ff7b8e; }
.dl { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; color: var(--muted); transition: background .25s, color .25s, transform .3s var(--ease); animation: pop .5s var(--ease); }
.dl:hover { background: var(--blood); color: #fff; transform: translateY(-1px); }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.15); } 100% { transform: scale(1); opacity: 1; } }

.finish { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; clip-path: inset(0 50% 0 50%); opacity: 0; transition: clip-path .8s .3s var(--ease), opacity .5s .3s; }
.finish .btn-blood { min-height: 52px; padding: 0 30px; }
.ttl { font-size: 12px; color: var(--faint); }
.is-done .finish { clip-path: inset(0 0 0 0); opacity: 1; }
.is-done .bar i { background: var(--ink); box-shadow: 0 0 18px rgba(255, 255, 255, .35); transition: background .6s, box-shadow .6s; }
.is-failed .bar i { background: var(--faint); box-shadow: none; }

.foot { padding: 0 var(--gut) 24px; text-align: center; }
.foot p { color: var(--faint); font-size: 12.5px; }

@media (max-width: 560px) {
  .field { flex-wrap: wrap; }
  .field input { flex: 1 1 100%; }
  .field .btn { flex: 1; }
  .opts .seg { width: 100%; }
  .seg label { flex: 1; }
  .seg span { width: 100%; min-width: 0; }
  .go-row .btn, .finish .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; transition-delay: 0s !important; }
  [data-enter] [data-e] { opacity: 1; transform: none; }
}
