@font-face {
  font-family: 'Geist';
  src: url('/static/fonts/geist.woff2') format('woff2');
  font-weight: 400 600;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('/static/fonts/geist-mono.woff2') format('woff2');
  font-weight: 400 500;
  font-display: swap;
}
@font-face {
  font-family: 'Instrument Serif';
  src: url('/static/fonts/instrument-serif.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Instrument Serif';
  src: url('/static/fonts/instrument-serif-italic.woff2') format('woff2');
  font-style: italic;
  font-display: swap;
}

:root {
  --bg: #09090b;
  --surface: #111114;
  --surface-2: #17171b;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --fg: #ededf0;
  --muted: #8b8b94;
  --faint: #82828c;
  --accent: #ff6a2a;
  --success: #3ddc84;
  --error: #ff5c5c;
  --glow: #ff6a2a, #ff2e7e, #7b5cff, #2ec5ff, #ff6a2a;

  /* Motion identity: one curve, three durations */
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --ease-out-back: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --t-quick: 140ms;
  --t-std: 260ms;
  --t-slow: 480ms;

  --radius: 18px;
  --sans: 'Geist', ui-sans-serif, system-ui, sans-serif;
  --mono: 'Geist Mono', ui-monospace, monospace;
}

@property --a {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--fg);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* Ambient: a warm light above the console, plus grain */
body::before {
  content: '';
  position: fixed;
  inset: -20% -10% auto;
  height: 70vh;
  background:
    radial-gradient(40% 50% at 35% 40%, rgba(255, 106, 42, 0.10), transparent 70%),
    radial-gradient(35% 45% at 70% 30%, rgba(123, 92, 255, 0.09), transparent 70%);
  pointer-events: none;
  animation: drift 18s ease-in-out infinite alternate;
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  opacity: 0.045;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px;
}
@keyframes drift {
  from { transform: translate3d(-2%, 0, 0); }
  to { transform: translate3d(3%, 2%, 0); }
}

.page {
  position: relative;
  z-index: 1;
  max-width: 660px;
  margin: 0 auto;
  padding: 72px 20px 80px;
}

.rise { animation: rise var(--t-slow) var(--ease) both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* Brand */
.brand { margin-bottom: 36px; }
.brand h1 {
  font-family: 'Instrument Serif', serif;
  font-weight: 400;
  font-size: clamp(3.4rem, 9vw, 4.6rem);
  line-height: 0.95;
  letter-spacing: -0.035em;
}
.brand h1 em {
  font-style: italic;
  background: linear-gradient(100deg, #ff8a4c 10%, #ff2e7e 55%, #8f75ff 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-right: 0.06em;
}
.brand p {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 34ch;
}

/* Console: the input card with the rim glow */
.console {
  position: relative;
  border-radius: var(--radius);
  animation-delay: 80ms;
}
.console .halo,
.console .rim {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: conic-gradient(from var(--a), var(--glow));
  animation: spin 10s linear infinite;
  pointer-events: none;
}
.console .halo {
  inset: 6px;
  filter: blur(22px);
  opacity: 0.28;
  transform: scale(1);
  transition: opacity var(--t-slow) var(--ease), transform var(--t-slow) var(--ease);
}
.console .rim {
  padding: 1px;
  opacity: 0.45;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  transition: opacity var(--t-slow) var(--ease);
}
.console:focus-within .halo { opacity: 0.5; }
.console:focus-within .rim { opacity: 0.8; }
.console.busy .halo { opacity: 0.7; transform: scale(1.03); }
.console.busy .rim { opacity: 1; }
@keyframes spin { to { --a: 360deg; } }

.console-inner {
  position: relative;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(23, 23, 27, 0.92), rgba(15, 15, 18, 0.96));
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

textarea {
  display: block;
  width: 100%;
  min-height: 76px;
  padding: 20px 20px 8px;
  border: 0;
  background: transparent;
  color: var(--fg);
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.6;
  outline: none;
  resize: none;
}
textarea::placeholder { color: var(--faint); }

.console-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 12px;
}
.hint {
  flex: 1;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.7rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Segmented format switch with a sliding indicator */
.seg {
  position: relative;
  display: flex;
  padding: 3px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}
.seg-ind {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 0;
  border-radius: 8px;
  background: var(--fg);
  transition: transform var(--t-std) var(--ease), width var(--t-std) var(--ease);
}
.seg button {
  position: relative;
  z-index: 1;
  padding: 7px 13px;
  border: 0;
  background: none;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  border-radius: 8px;
  transition: color var(--t-std) var(--ease);
}
.seg button[aria-pressed="true"] { color: var(--bg); }
@media (hover: hover) {
  .seg button[aria-pressed="false"]:hover { color: var(--fg); }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  cursor: pointer;
  font-family: var(--sans);
  font-weight: 500;
  user-select: none;
  transition: transform var(--t-quick) var(--ease), background-color var(--t-std) var(--ease),
              opacity var(--t-std) var(--ease), box-shadow var(--t-std) var(--ease);
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:focus-visible, .seg button:focus-visible, .q-chip:focus-visible {
  outline: 2px solid #8f75ff;
  outline-offset: 2px;
}

.fetch {
  height: 40px;
  padding: 0 14px 0 18px;
  border-radius: 11px;
  background: linear-gradient(100deg, #ff7a3a, #ff2e7e);
  color: #09090b;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 4px 18px -8px rgba(255, 46, 126, 0.6);
}
@media (hover: hover) {
  .fetch:hover:not(:disabled) { box-shadow: 0 8px 28px -6px rgba(255, 46, 126, 0.75); }
}
.fetch kbd {
  font-family: var(--mono);
  font-size: 0.7rem;
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.14);
}

/* Cards */
.cards { margin-top: 28px; display: grid; gap: 10px; }

.card {
  position: relative;
  display: flex;
  gap: 14px;
  padding: 12px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
  animation: card-in var(--t-std) var(--ease) both;
  animation-delay: calc(min(var(--i, 0), 8) * 40ms);
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(12px) scale(0.99); }
  to { opacity: 1; transform: none; }
}

.thumb {
  position: relative;
  width: 136px;
  min-width: 136px;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-2);
}
.thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity var(--t-slow) var(--ease), transform var(--t-slow) var(--ease);
}
.thumb img.loaded { opacity: 1; transform: none; }
.thumb .icon {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--faint);
}
.thumb .icon svg { width: 26px; height: 26px; }
.thumb.audio .icon { color: var(--accent); background: radial-gradient(circle, rgba(255, 106, 42, 0.12), transparent 70%); }
.thumb .dur {
  position: absolute;
  right: 5px;
  bottom: 5px;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.7);
  font-family: var(--mono);
  font-size: 0.64rem;
  color: #fff;
}

.shimmer {
  background: linear-gradient(90deg, var(--surface-2) 25%, #202026 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.sk { height: 11px; border-radius: 5px; margin-bottom: 8px; }
.sk.w75 { width: 75%; }
.sk.w40 { width: 40%; height: 9px; }
@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.title {
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.meta {
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
  min-height: 30px;
}

.dl {
  height: 30px;
  padding: 0 13px;
  border-radius: 9px;
  background: var(--fg);
  color: var(--bg);
  font-size: 0.78rem;
}
.dl svg { width: 14px; height: 14px; }
.dl.ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg);
  border: 1px solid var(--line);
}
@media (hover: hover) {
  .dl.ghost:hover { background: rgba(255, 255, 255, 0.1); }
}

.q-chip {
  height: 28px;
  padding: 0 9px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  cursor: pointer;
  transition: color var(--t-quick) var(--ease), border-color var(--t-quick) var(--ease),
              background-color var(--t-quick) var(--ease);
}
.q-chip[aria-pressed="true"] {
  color: var(--fg);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.07);
}
@media (hover: hover) {
  .q-chip[aria-pressed="false"]:hover { color: var(--fg); }
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.status.live { color: var(--fg); }
.status.ok { color: var(--success); }
.status.bad { color: var(--error); }

.spin {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  border-right-color: transparent;
  animation: rot 0.7s linear infinite;
}
@keyframes rot { to { transform: rotate(360deg); } }

.check {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--success);
  color: #06240f;
  animation: pop var(--t-std) var(--ease-out-back) both;
}
.check svg { width: 11px; height: 11px; }
.check path {
  stroke-dasharray: 16;
  stroke-dashoffset: 16;
  animation: draw var(--t-std) var(--ease) 120ms forwards;
}
@keyframes pop {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes draw { to { stroke-dashoffset: 0; } }

/* Progress runs along the card's bottom edge */
.progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
}
.progress > i {
  position: absolute;
  inset: 0;
  transform-origin: left;
  transform: scaleX(var(--p, 0));
  background: linear-gradient(90deg, #ff6a2a, #ff2e7e 70%, #8f75ff);
  box-shadow: 0 0 12px rgba(255, 46, 126, 0.7);
  transition: transform 700ms var(--ease);
}
.progress.sweep > i {
  transform: none;
  width: 35%;
  animation: sweep 1.3s var(--ease) infinite;
}
@keyframes sweep {
  from { transform: translateX(-100%); }
  to { transform: translateX(300%); }
}
.card.finished .progress > i {
  background: var(--success);
  box-shadow: 0 0 12px rgba(61, 220, 132, 0.6);
}
.card.finished .progress {
  animation: fade-out var(--t-slow) var(--ease) 900ms forwards;
}
@keyframes fade-out { to { opacity: 0; } }

.card.bad { border-color: rgba(255, 92, 92, 0.22); background: rgba(255, 92, 92, 0.035); }
.card.shake { animation: card-in var(--t-std) var(--ease) both, shake 360ms ease-in-out var(--t-std); }
@keyframes shake {
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}
.thumb.bad .icon { color: var(--error); background: rgba(255, 92, 92, 0.08); }
.err { color: var(--error); font-size: 0.8rem; margin-top: 2px; line-height: 1.4; }
.url { color: var(--faint); font-family: var(--mono); font-size: 0.66rem; margin-top: 4px; word-break: break-all; }

.all {
  margin-top: 6px;
  width: 100%;
  height: 46px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--fg);
  font-size: 0.88rem;
  animation: card-in var(--t-std) var(--ease) both;
}
@media (hover: hover) {
  .all:hover:not(:disabled) { background: rgba(255, 255, 255, 0.09); }
}

.footer {
  margin-top: 56px;
  text-align: center;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.68rem;
  line-height: 2;
}

/* Form errors */
.form-error {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 4px 0;
  color: var(--error);
  font-size: 0.82rem;
  animation: card-in var(--t-std) var(--ease) both;
}
.form-error[hidden] { display: none; }
.console.invalid .console-inner { border-color: rgba(255, 92, 92, 0.45); }
.console.shake { animation: shake 360ms ease-in-out; }

.sr-only, .hp {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.footer a, .prose a, .notice a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
  transition: text-decoration-color var(--t-quick) var(--ease), color var(--t-quick) var(--ease);
}
@media (hover: hover) {
  .footer a:hover, .prose a:hover, .notice a:hover { color: var(--fg); text-decoration-color: currentColor; }
}
.footer nav { margin-top: 10px; display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

/* Privacy notice (no cookies, so nothing to consent to; it just says so) */
.notice {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 10;
  width: min(560px, calc(100% - 32px));
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 12px 12px 16px;
  border-radius: 14px;
  background: rgba(23, 23, 27, 0.92);
  border: 1px solid var(--line-strong);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 18px 50px -12px rgba(0, 0, 0, 0.7);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
  transform: translate(-50%, 0);
  animation: notice-in var(--t-slow) var(--ease) 600ms both;
}
.notice[hidden] { display: none; }
.notice p { flex: 1; }
.notice.leaving { animation: notice-out var(--t-std) cubic-bezier(0.3, 0, 1, 1) forwards; }
@keyframes notice-in {
  from { opacity: 0; transform: translate(-50%, 16px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes notice-out {
  to { opacity: 0; transform: translate(-50%, 12px); }
}
.notice .btn {
  height: 32px;
  padding: 0 14px;
  border-radius: 9px;
  background: var(--fg);
  color: var(--bg);
  font-size: 0.8rem;
}

/* Legal pages and 404 */
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 28px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.75rem;
  text-decoration: none;
}
@media (hover: hover) { .back:hover { color: var(--fg); } }
.prose h1 {
  font-family: 'Instrument Serif', serif;
  font-weight: 400;
  font-size: clamp(2.4rem, 7vw, 3.2rem);
  letter-spacing: -0.03em;
  line-height: 1;
}
.prose .updated { margin-top: 10px; color: var(--faint); font-family: var(--mono); font-size: 0.72rem; }
.prose h2 { margin: 34px 0 10px; font-size: 1.02rem; font-weight: 600; }
.prose p, .prose li { color: #c4c4cc; font-size: 0.95rem; line-height: 1.7; }
.prose p + p { margin-top: 10px; }
.prose ul { margin: 8px 0 0 20px; display: grid; gap: 6px; }
.prose strong { color: var(--fg); font-weight: 500; }

.lost { text-align: left; }
.lost .code {
  font-family: 'Instrument Serif', serif;
  font-size: clamp(5rem, 22vw, 9rem);
  line-height: 0.9;
  letter-spacing: -0.04em;
  background: linear-gradient(100deg, #ff8a4c 10%, #ff2e7e 55%, #8f75ff 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lost p { margin: 16px 0 28px; color: var(--muted); max-width: 36ch; line-height: 1.6; }
.lost .fetch { display: inline-flex; text-decoration: none; padding: 0 20px; }

@media (max-width: 520px) {
  .page { padding: 48px 16px calc(56px + env(safe-area-inset-bottom)); }
  textarea { font-size: 16px; }
  .hint { display: none; }
  .console-bar { justify-content: space-between; }
  .card { flex-direction: column; gap: 10px; }
  .thumb { width: 100%; min-width: 0; }
  .title { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 1ms !important;
  }
  .console .halo, .console .rim { --a: 140deg; }
  .spin { animation: none; border-right-color: currentColor; opacity: 0.6; }
  .progress.sweep > i { animation: none; transform: none; width: 100%; opacity: 0.35; }
}
  
