:root {
  --bg: #070707;
  --fg: #f5f4ef;
  --fg2: rgba(245, 244, 239, .64);
  --fg3: rgba(245, 244, 239, .40);
  --fg4: rgba(245, 244, 239, .22);
  --glass: rgba(255, 255, 255, .055);
  --glass2: rgba(255, 255, 255, .085);
  --stroke: rgba(255, 255, 255, .085);
  --stroke2: rgba(255, 255, 255, .16);
  --hl: inset 0 1px 0 rgba(255, 255, 255, .07);
  --acc: #ff5b1f;
  --err: #ff7a66;
  --ink: #0a0a0a;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --spring: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100dvh; display: flex; flex-direction: column;
  color: var(--fg);
  font: 16px/1.45 var(--sans); letter-spacing: -.011em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
/* film grain so the black isn't flat */
body::after {
  content: ""; position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 100; pointer-events: none;
  opacity: .045; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
button, input { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: inherit; text-decoration: none; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mono { font-family: var(--mono); letter-spacing: 0; font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* ---------- ambient light from the current video ---------- */
.ambient {
  position: fixed; top: -15%; left: -15%; right: -15%; bottom: -15%; z-index: -1; pointer-events: none;
  opacity: 0; transition: opacity 1.4s var(--spring);
}
.ambient img { width: 100%; height: 100%; object-fit: cover; filter: blur(90px) saturate(1.9) brightness(.9); transform: scale(1.15); }
.ambient::after {
  content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, rgba(7, 7, 7, .25) 0%, rgba(7, 7, 7, .45) 45%, rgba(7, 7, 7, .85) 80%, var(--bg) 100%);
}
.ambient.on { opacity: .9; }

/* ---------- top ---------- */
.top {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; max-width: 1080px; margin: 0 auto; padding: 22px 28px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 700; letter-spacing: -.035em; }
.brand::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--acc); box-shadow: 0 0 14px rgba(255, 91, 31, .7); }
.top-btn {
  display: inline-flex; align-items: center; gap: 10px;
  height: 42px; padding: 0 18px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--stroke); box-shadow: var(--hl);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  font-size: 15px; font-weight: 560;
  transition: background .2s, border-color .2s, transform .2s var(--spring);
}
#navBtn { opacity: 0; transition: opacity .2s; }
#navBtn.ready { opacity: 1; }
.top-btn:hover { background: var(--glass2); border-color: var(--stroke2); }
.top-btn:active { transform: scale(.96); }
.count { font-family: var(--mono); font-size: 13px; color: var(--fg3); letter-spacing: 0; }
.count:empty { display: none; }

/* ---------- main ---------- */
.main { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; width: 100%; max-width: 1080px; margin: 0 auto; padding: 4px 28px 28px; }
.main.is-empty { justify-content: center; padding-bottom: 120px; }
.main.is-empty .field { width: min(720px, 100%); margin: 0 auto; }
.main.is-empty .status { text-align: center; }

/* ---------- input ---------- */
.field {
  display: flex; align-items: center; gap: 8px;
  height: 76px; padding: 0 11px 0 30px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--stroke);
  box-shadow: var(--hl), 0 30px 80px -30px rgba(0, 0, 0, .8);
  -webkit-backdrop-filter: blur(28px) saturate(1.4); backdrop-filter: blur(28px) saturate(1.4);
  transition: border-color .25s, background .25s, box-shadow .25s;
}
.field:focus-within { background: var(--glass2); border-color: var(--stroke2); }
.field input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent;
  font-size: 19px; font-weight: 450; text-overflow: ellipsis;
}
.field input::placeholder { color: var(--fg3); }
.field-clear { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--fg3); transition: color .2s, background .2s; }
.field-clear:hover { color: var(--fg); background: var(--glass); }
.field-clear svg { width: 18px; height: 18px; }
.field-paste {
  height: 40px; padding: 0 16px; border-radius: 999px;
  background: var(--glass2); border: 1px solid var(--stroke); font-size: 14.5px; font-weight: 600;
}
.go {
  position: relative; flex: none; display: grid; place-items: center;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--fg); color: var(--ink);
  transition: transform .25s var(--spring), background .25s, color .25s;
}
.go:hover { transform: scale(1.04); }
.go:active { transform: scale(.92); }
.go .i-arrow { width: 22px; height: 22px; stroke-width: 2.2; transition: transform .25s var(--spring); }
.go:hover .i-arrow { transform: translateX(2px); }
.go .ring { position: absolute; top: -4px; left: -4px; width: 64px; height: 64px; transform: rotate(-90deg); opacity: 0; transition: opacity .2s; }
.ring circle { fill: none; stroke-width: 2.4; }
.ring-track { stroke: rgba(255, 255, 255, .1); }
.ring-fill { stroke: var(--acc); stroke-linecap: round; stroke-dasharray: 182.2; stroke-dashoffset: 182.2; transition: stroke-dashoffset .3s var(--spring); }
.ring.indet { animation: spin 1s linear infinite; }
.ring.indet .ring-fill { stroke-dashoffset: 130; transition: none; }
.go-pct { display: none; font: 600 13px/1 var(--mono); letter-spacing: 0; }
.is-busy .go { background: var(--glass2); color: var(--fg); transform: none; }
.is-busy .go .ring { opacity: 1; }
.is-busy .go .i-arrow { display: none; }
.is-busy .go .go-pct { display: block; }
@keyframes spin { to { transform: rotate(270deg); } from { transform: rotate(-90deg); } }

.status {
  margin: 18px 30px 0; font: 500 12px/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--fg3);
  animation: fade .3s var(--spring) both;
}
.status.is-error { color: var(--err); text-transform: none; letter-spacing: 0; font: 500 15px/1.4 var(--sans); }
@keyframes fade { from { opacity: 0; transform: translateY(-4px); } }

/* ---------- result ---------- */
.result { margin-top: 26px; display: grid; gap: 22px; }
.card {
  display: grid; grid-template-columns: 1fr; gap: 22px;
  padding: 16px; border-radius: 34px;
  background: rgba(16, 16, 16, .5); border: 1px solid var(--stroke);
  box-shadow: var(--hl), 0 50px 100px -50px rgba(0, 0, 0, .9);
  -webkit-backdrop-filter: blur(40px) saturate(1.3); backdrop-filter: blur(40px) saturate(1.3);
  animation: rise .55s var(--spring) both;
}
.card + .card { animation-delay: .06s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } }
@media (min-width: 760px) {
  .card { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 34px; padding: 18px; }
}
.media {
  position: relative; overflow: hidden; border-radius: 24px; background: #000;
  max-height: min(calc(100dvh - 300px), 720px); align-self: start;
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .8);
}
.media img { display: block; width: 100%; height: 100%; max-height: min(calc(100dvh - 300px), 720px); object-fit: cover; }
.tag {
  position: absolute; display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border-radius: 999px;
  background: rgba(0, 0, 0, .45); border: 1px solid rgba(255, 255, 255, .1);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  font: 600 12px/1 var(--mono); letter-spacing: .02em;
}
.tag.br { right: 12px; bottom: 12px; }
.tag.tl { left: 12px; top: 12px; }

.info { display: flex; flex-direction: column; min-width: 0; padding: 6px 4px 4px; }
.who { display: flex; align-items: center; gap: 14px; }
.pf-icon {
  display: grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 15px;
  background: var(--fg); color: var(--ink);
}
.pf-icon svg { width: 21px; height: 21px; fill: currentColor; stroke: none; }
.who-text { min-width: 0; }
.handle { font-size: 19px; font-weight: 680; letter-spacing: -.025em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name { font-size: 12.5px; color: var(--fg3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-acts { margin-left: auto; display: flex; gap: 8px; }
.text {
  margin: 18px 0 0; color: var(--fg2); font-size: 15.5px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}

.spec-head { margin: 26px 0 10px; font: 500 11.5px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--fg3); }
.seg {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 4px;
  padding: 5px; border-radius: 22px;
  background: rgba(255, 255, 255, .04); border: 1px solid var(--stroke);
}
.seg button {
  position: relative; overflow: hidden; height: 64px; border-radius: 17px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--fg2);
  transition: background .3s var(--spring), color .2s, transform .2s var(--spring);
}
.seg button:hover { color: var(--fg); background: rgba(255, 255, 255, .04); }
.seg button:active { transform: scale(.96); }
.seg b { font-size: 17px; font-weight: 680; letter-spacing: -.02em; color: inherit; position: relative; }
.seg small { font: 500 11px/1 var(--mono); letter-spacing: 0; color: var(--fg3); position: relative; }
.seg .on { background: var(--fg); color: var(--ink); box-shadow: 0 8px 24px -8px rgba(0, 0, 0, .6); }
.seg .on:hover { background: var(--fg); color: var(--ink); }
.seg .on small { color: rgba(10, 10, 10, .5); }
.seg .have::after { content: ""; position: absolute; top: 9px; right: 10px; width: 5px; height: 5px; border-radius: 50%; background: var(--acc); }
.seg .fill { position: absolute; top: 0; left: 0; bottom: 0; width: 0; background: rgba(255, 91, 31, .2); transition: width .3s var(--spring); }
.seg .loading { pointer-events: none; color: var(--fg); }

.actions { display: flex; gap: 10px; margin-top: auto; padding-top: 26px; }
.primary {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  height: 64px; padding: 0 26px; border-radius: 999px;
  background: var(--fg); color: var(--ink);
  font-size: 17.5px; font-weight: 680; letter-spacing: -.02em;
  box-shadow: 0 14px 40px -14px rgba(255, 255, 255, .25);
  transition: transform .25s var(--spring), box-shadow .25s;
  user-select: none; -webkit-user-select: none;
}
.primary:hover { transform: translateY(-1px); box-shadow: 0 18px 48px -14px rgba(255, 255, 255, .32); }
.primary:active { transform: scale(.97); }
.primary svg { width: 21px; height: 21px; stroke-width: 2.2; }
.primary .mono { font-size: 13px; font-weight: 500; opacity: .45; }
.primary.ghosted { background: var(--glass); color: var(--fg3); box-shadow: none; pointer-events: none; }
.round {
  flex: none; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%;
  background: var(--glass); border: 1px solid var(--stroke); box-shadow: var(--hl); color: var(--fg);
  transition: background .2s, border-color .2s, transform .25s var(--spring);
}
.round:hover { background: var(--glass2); border-color: var(--stroke2); }
.round:active { transform: scale(.92); }
.round.sm { width: 40px; height: 40px; }
.round.sm svg { width: 18px; height: 18px; }
.round.xs { width: 34px; height: 34px; box-shadow: none; }
.round.xs svg { width: 16px; height: 16px; }

/* ---------- history (full screen) ---------- */
.history { position: relative; z-index: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 18px 28px 80px; animation: fade .35s var(--spring) both; }
.history-head { display: flex; align-items: baseline; gap: 14px; margin: 0 2px 26px; }
.history-head h1 {
  margin: 0; font: 400 44px/1.05 ui-serif, "New York", "Iowan Old Style", Georgia, serif; letter-spacing: -.02em;
}
.history-head .mono { font-size: 14px; color: var(--fg3); }

.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 30px 18px; align-content: start;
}
@media (max-width: 520px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 12px; } .history-head h1 { font-size: 34px; } }
.tile { min-width: 0; animation: rise .45s var(--spring) both; }
.tile-media {
  position: relative; display: block; width: 100%; aspect-ratio: 4 / 5; overflow: hidden;
  border-radius: 20px; background: #000; border: 1px solid var(--stroke);
  transition: transform .3s var(--spring);
}
.tile-media:active { transform: scale(.97); }
.tile-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s var(--spring); }
.tile-media:hover img { transform: scale(1.04); }
.tile-media .tag { left: 9px; top: 9px; height: 26px; width: 26px; padding: 0; justify-content: center; }
.tile-media .tag svg { width: 12px; height: 12px; fill: currentColor; stroke: none; }
.tile-media .pin-dot { position: absolute; right: 10px; top: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--acc); box-shadow: 0 0 10px rgba(255, 91, 31, .8); }
.tile-cap { display: flex; align-items: center; gap: 6px; padding: 10px 2px 0; }
.tile-text { min-width: 0; flex: 1; }
.tile-h { font-size: 14px; font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-m { font-size: 11px; color: var(--fg3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.tile-cap .round.on { color: var(--acc); }
.tile-cap .round.on svg { fill: var(--acc); }
.empty-note { margin: 60px 0; text-align: center; color: var(--fg3); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 28px); z-index: 50;
  padding: 13px 20px; border-radius: 999px;
  background: rgba(245, 244, 239, .94); color: var(--ink);
  font-weight: 620; font-size: 15px; white-space: nowrap;
  box-shadow: 0 20px 50px -15px rgba(0, 0, 0, .7);
  opacity: 0; transform: translate(-50%, 14px) scale(.96); pointer-events: none;
  transition: opacity .25s, transform .4s var(--spring);
}
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

@media (max-width: 520px) {
  .top { padding: 12px 18px; }
  .main { padding: 0 16px 16px; }
  .field { height: 58px; padding-left: 22px; }
  .go { width: 46px; height: 46px; }
  .go .ring { width: 54px; height: 54px; }
  .card { border-radius: 28px; padding: 12px; gap: 14px; }
  .media { justify-self: center; }
  .media, .media img { border-radius: 20px; max-height: 30dvh; }
  .result { margin-top: 14px; }
  .who { gap: 12px; }
  .pf-icon { width: 42px; height: 42px; }
  .seg { grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); }
  .seg button { height: 58px; }
  .seg b { font-size: 16px; }
  .text { -webkit-line-clamp: 2; margin-top: 12px; }
  .spec-head { margin: 16px 0 8px; }
  .actions { padding-top: 16px; }
  .primary, .round { height: 58px; }
  .round { width: 58px; }
}

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

/* ---------- gallery head extras ---------- */
.history-head .top-btn { margin-left: auto; height: 38px; font-size: 14px; }

/* ---------- login ---------- */
.login-body { justify-content: center; align-items: center; }
.login-body::before {
  content: ""; position: fixed; z-index: -1; pointer-events: none;
  left: 50%; top: 18%; width: 900px; height: 600px; transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(255, 91, 31, .13), transparent 70%);
}
.login { width: min(400px, calc(100% - 40px)); margin: auto; padding-bottom: 6vh; animation: rise .7s var(--spring) both; }
.login-title {
  display: flex; align-items: center; justify-content: center; gap: 16px; margin: 0 0 36px;
  font: 400 66px/1 ui-serif, "New York", "Iowan Old Style", Georgia, serif; letter-spacing: -.035em;
}
.login-title::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--acc); box-shadow: 0 0 18px rgba(255, 91, 31, .8); }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-input {
  height: 62px; padding: 0 26px; border-radius: 999px; outline: 0;
  background: var(--glass); border: 1px solid var(--stroke); box-shadow: var(--hl);
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
  font-size: 17px; transition: background .2s, border-color .2s;
}
.login-input:focus { background: var(--glass2); border-color: var(--stroke2); }
.login-input::placeholder { color: var(--fg3); }
.login-btn { flex: none; width: 100%; margin-top: 8px; }
.login-btn .spinner { display: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid rgba(10, 10, 10, .2); border-top-color: var(--ink); animation: rot .7s linear infinite; }
.login-form.is-busy .login-btn span:first-child { display: none; }
.login-form.is-busy .login-btn .spinner { display: block; }
.login-error { min-height: 22px; margin: 8px 0 0; text-align: center; color: var(--err); font-size: 14.5px; }
.shake { animation: shake .42s var(--spring); }
@keyframes shake { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }
@keyframes rot { to { transform: rotate(360deg); } }
