:root {
  --bg: #0f0f14; --surface: #191921; --surface-2: #23232e; --line: #2e2e3b;
  --text: #f3f2f7; --muted: #a09fb0; --accent: #ffb547; --accent-2: #ff7a59;
  --ok: #4ade80; --err: #ff6b6b; --radius: 18px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-font-smoothing: antialiased;
}
main, .top, .foot { max-width: 640px; margin: 0 auto; padding-inline: 18px; }

.top { display: flex; align-items: center; justify-content: space-between; padding-block: 14px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.15rem; letter-spacing: -.01em; }
.beta { font-size: .65rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); border: 1px solid #ffb54755; border-radius: 99px; padding: 2px 7px; }
.privacy { font-size: .8rem; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 5px 10px; }

.intro h1 { font-size: clamp(1.6rem, 6vw, 2.2rem); line-height: 1.12; letter-spacing: -.02em; margin: 18px 0 10px; }
.intro em { font-style: normal; background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.intro p { color: var(--muted); margin: 0 0 22px; }
body.has-results .intro { display: none; }

.drop {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  padding: 26px 18px; border-radius: var(--radius); cursor: pointer;
  background: linear-gradient(180deg, #ffb54714, #ffb54706); border: 1.5px dashed #ffb54770;
  transition: transform .15s, border-color .15s, background .15s;
}
.drop:active { transform: scale(.985); }
.drop.over { border-color: var(--accent); background: #ffb54722; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; color: #1a1206; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 8px 24px #ff7a5940; margin-bottom: 6px; }
.drop-title { font-weight: 700; font-size: 1.1rem; }
.drop-sub { color: var(--muted); font-size: .85rem; }
body.has-results .drop { flex-direction: row; padding: 12px 14px; gap: 12px; text-align: left; }
body.has-results .drop-icon { width: 40px; height: 40px; border-radius: 12px; margin: 0; }
body.has-results .drop-icon svg { width: 20px; height: 20px; }
body.has-results .drop-title { font-size: 1rem; }
body.has-results .drop-sub, body.has-results .help { display: none; }

.help { margin: 14px 2px 0; color: var(--muted); font-size: .9rem; }
.help summary { cursor: pointer; padding: 6px 0; }
.help ul { margin: 6px 0 0; padding-left: 18px; }
.help li { margin-bottom: 6px; }

.bulk { display: flex; align-items: center; justify-content: space-between; margin: 18px 2px 0; color: var(--muted); font-size: .9rem; }

.results { display: grid; gap: 18px; margin: 16px 0 28px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; animation: in .3s ease-out; }
@keyframes in { from { opacity: 0; transform: translateY(8px); } }
.stage { position: relative; background: #0a0a0e; aspect-ratio: 16 / 9; display: grid; place-items: center; overflow: hidden; transition: aspect-ratio .3s; }
.hero { width: 100%; height: 100%; object-fit: contain; display: block; opacity: 0; transition: opacity .25s; user-select: none; -webkit-user-drag: none; }
.hero.ready { opacity: 1; }
.shimmer { position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, #ffffff0d 50%, transparent 70%) 0 0 / 200% 100%; animation: sh 1.4s linear infinite; }
@keyframes sh { to { background-position: -200% 0; } }
.card.done .shimmer, .card.error .shimmer { display: none; }
.badge { position: absolute; top: 12px; left: 12px; font-size: .75rem; font-weight: 700; color: #1a1206; background: var(--accent); padding: 4px 10px; border-radius: 99px; }
.badge.orig { background: var(--text); }
.compare { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); white-space: nowrap; font: inherit; font-size: .8rem; color: var(--text); background: #0f0f14cc; backdrop-filter: blur(8px); border: 1px solid #ffffff22; border-radius: 99px; padding: 8px 14px; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }

.meta { padding: 12px 14px 4px; }
.name { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status { margin-top: 4px; }
.step { font-weight: 600; font-size: .95rem; }
.card.error .step { color: var(--err); font-weight: 500; }
.bar { height: 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin: 8px 0 6px; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .2s; }
.card.done .bar, .card.error .bar { display: none; }

.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 6px 14px 4px; }
.thumbs:empty { display: none; }
.thumb { position: relative; padding: 0; border: 2px solid transparent; border-radius: 10px; overflow: hidden; background: var(--surface-2); aspect-ratio: 3 / 4; cursor: pointer; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb[aria-selected="true"] { border-color: var(--accent); }
.thumb span { position: absolute; left: 4px; bottom: 4px; font-size: .65rem; font-weight: 600; background: #000a; padding: 1px 5px; border-radius: 6px; }

.actions { display: flex; gap: 10px; padding: 12px 14px 14px; }
.btn { font: inherit; font-weight: 600; border-radius: 12px; padding: 12px 16px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); cursor: pointer; transition: transform .1s, filter .15s; }
.btn:active { transform: scale(.97); }
.btn.primary { flex: 1; border: 0; color: #1a1206; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.btn.ghost { background: transparent; }
.btn.small { padding: 7px 12px; font-size: .85rem; }

.foot { color: var(--muted); font-size: .75rem; text-align: center; padding-block: 8px 28px; }

.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--text); color: var(--bg); font-weight: 600; font-size: .9rem; padding: 10px 16px; border-radius: 12px; box-shadow: 0 8px 30px #0008; animation: in .2s; z-index: 10; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.stage { max-height: 68vh; width: 100%; }
.card:not(.done):not(.error) .stage { max-height: 34vh; }
