/* VideoBox — mobile-first styles. Desktop enhancements live in the min-width query at the bottom. */

:root {
  color-scheme: dark;
  --bg: #090d17;
  --surface-deep: #0e1421;
  --border: #2c3548;
  --border-strong: #343e52;
  --text: #f7f8fd;
  --text-soft: #dfe5f1;
  --muted: #8f9bb1;
  --faint: #6c7991;
  --accent: #8a79ff;
  --accent-text: #c9bfff;
  --success: #2ac995;
  --success-text: #78ebbf;
  --danger: #f47484;
  --danger-text: #ffb7c0;
  --gutter: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", ui-sans-serif, system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }
button, input { font: inherit; }
button, a { touch-action: manipulation; }
:focus-visible { outline: 3px solid #c9adff; outline-offset: 3px; }

.ambient { position: fixed; z-index: -1; pointer-events: none; border-radius: 50%; filter: blur(90px); opacity: .2; }
.ambient-one { width: 340px; height: 340px; background: #6950db; top: -60px; left: -190px; }
.ambient-two { width: 320px; height: 320px; background: #165eab; top: 360px; right: -210px; }

.shell {
  width: 100%;
  max-width: calc(910px + 2 * var(--gutter));
  margin: 0 auto;
  padding-left: calc(var(--gutter) + var(--safe-left));
  padding-right: calc(var(--gutter) + var(--safe-right));
}

/* Header */

.header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: var(--safe-top);
  background: rgba(9, 13, 23, .74);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.header.is-scrolled { border-bottom-color: rgba(44, 53, 72, .85); }
.header-inner { height: 60px; display: flex; justify-content: space-between; align-items: center; }

.brand { text-decoration: none; color: #fff; display: flex; gap: 10px; align-items: center; font-size: 20px; font-weight: 810; letter-spacing: -1px; }
.brand-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: linear-gradient(135deg, #9f8aff, #715df0); box-shadow: 0 8px 24px #6358d73b; }
.brand-accent { color: #a597ff; }

.top-badge { display: flex; align-items: center; gap: 8px; padding: 7px 11px; border: 1px solid #2c3549; border-radius: 100px; background: #141b29; color: #b9c3d6; font-size: 11px; font-weight: 650; }
.status-dot { height: 7px; width: 7px; background: #49d9b0; border-radius: 50%; box-shadow: 0 0 0 4px #49d9b01f; animation: pulse 2.4s ease-in-out infinite; }
.top-badge.is-offline .status-dot { background: var(--danger); box-shadow: 0 0 0 4px rgba(244, 116, 132, .15); animation: none; }

/* Hero */

.hero { text-align: center; padding: 30px 4px 24px; }
.eyebrow { display: inline-flex; align-items: center; gap: 9px; color: #b3a8ff; font-size: 10px; letter-spacing: 2px; font-weight: 800; margin-bottom: 14px; }
.eyebrow-mark { display: block; width: 17px; height: 1px; background: #ae9dff; }
.hero h1 { font-size: clamp(31px, 8.8vw, 61px); line-height: 1.12; letter-spacing: -.045em; margin: 0; font-weight: 800; }
.gradient-text { background: linear-gradient(92deg, #c2abff 4%, #9b85ff 50%, #6bbbe9 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.subtitle { color: #9da9bc; font-size: 14px; line-height: 1.6; max-width: 520px; margin: 14px auto 0; }

/* Download card */

.download-card {
  max-width: 770px;
  margin: 0 auto;
  padding: 20px 16px;
  background: linear-gradient(160deg, #1a2133, #131927);
  border: 1px solid #30384c;
  border-radius: 22px;
  box-shadow: 0 24px 60px #03070e7a, 0 1px 0 #65718c19 inset;
}

.card-top { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; }
.section-icon { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 12px; background: #806bff23; border: 1px solid #9b87ff38; color: #ab9cff; }
.card-top h2 { margin: 0; font-size: 16px; letter-spacing: -.3px; }
.card-top p { margin: 4px 0 0; color: #8995aa; font-size: 12px; }

.field-label { display: block; font-size: 11px; letter-spacing: 1.35px; color: #b4bfce; font-weight: 800; margin-bottom: 10px; }

.url-box {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-deep);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 6px 6px 6px 14px;
  transition: border-color .15s, box-shadow .15s;
}
.url-box:focus-within { border-color: #9686ff; box-shadow: 0 0 0 3px #8575ef29; }
.url-box.is-valid { border-color: rgba(42, 201, 149, .55); }
.url-box.is-valid:focus-within { box-shadow: 0 0 0 3px rgba(42, 201, 149, .16); }
.url-box.is-invalid { border-color: rgba(244, 116, 132, .65); animation: shake .36s; }
.url-icon { color: #b3a4ff; margin-right: 6px; display: flex; flex: none; }

/* 16px keeps iOS Safari from zooming the page when the field is focused. */
.url-box input { flex: 1; min-width: 0; height: 44px; padding: 0 2px; border: 0; outline: 0; background: transparent; color: #f9faff; font-size: 16px; }
.url-box input::placeholder { color: var(--faint); }

.icon-button { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; }
.icon-button:active { background: #232b3f; }

.paste-button { height: 44px; flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 0 13px; color: #d3ceff; background: #8979fc22; border: 1px solid #8a7ef051; border-radius: 10px; font-weight: 750; font-size: 13px; cursor: pointer; transition: background .15s, transform .12s; }
.paste-button:active { transform: scale(.95); background: #8979fc3d; }

.field-hint { font-size: 12px; color: #7f8da2; margin: 10px 2px 0; line-height: 1.5; }

.preview { margin-top: 12px; display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px; background: rgba(42, 201, 149, .07); border: 1px solid rgba(42, 201, 149, .26); animation: rise .3s var(--ease); }
.preview-thumb { width: 96px; aspect-ratio: 16 / 9; flex: none; border-radius: 9px; overflow: hidden; background: #1d2436; }
.preview-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview-text { min-width: 0; }
.preview-text strong { display: block; font-size: 13px; color: var(--success-text); }
.preview-text span { display: block; margin-top: 3px; white-space: nowrap; font-size: 12px; color: var(--muted); font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; overflow: hidden; text-overflow: ellipsis; }
.preview-check { margin-left: auto; width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--success); color: #05261b; }

.options-header { display: flex; align-items: center; justify-content: space-between; margin: 26px 0 10px; }
.options-header .field-label { margin: 0; }
.audio-tag { display: inline-flex; align-items: center; gap: 5px; color: #9faabf; font-size: 11px; }

.quality-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 0 0 22px; }
.quality-option { display: block; position: relative; cursor: pointer; }
.quality-option input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.quality-body { position: relative; min-height: 74px; padding: 13px 14px; border: 1px solid #333c50; border-radius: 14px; background: #101624; display: flex; flex-direction: column; justify-content: center; gap: 4px; transition: background .16s, border-color .16s, transform .12s; }
.quality-body strong { font-size: 15px; color: #e3e8f0; font-weight: 800; }
.quality-body small { font-size: 11px; color: #8a96aa; }
.quality-check { position: absolute; top: 10px; right: 10px; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; border: 1.5px solid #4a5570; color: #fff; transition: background .16s, border-color .16s; }
.quality-check svg { opacity: 0; transform: scale(.5); transition: opacity .16s, transform .16s var(--ease); }
.quality-option input:checked + .quality-body { background: #8570f925; border-color: #a593ff; box-shadow: 0 0 0 1px #a593ff2c inset; }
.quality-option input:checked + .quality-body strong { color: #d8ceff; }
.quality-option input:checked + .quality-body .quality-check { background: var(--accent); border-color: var(--accent); }
.quality-option input:checked + .quality-body .quality-check svg { opacity: 1; transform: none; }
.quality-option input:focus-visible + .quality-body { outline: 3px solid #c9adff; outline-offset: 3px; }
.quality-option:active .quality-body { transform: scale(.97); }

/* Keeps the main action under the thumb while the form is on screen. */
.submit-bar { position: sticky; bottom: calc(12px + var(--safe-bottom)); z-index: 5; }

.primary-button {
  width: 100%;
  height: 58px;
  border: 0;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  background: linear-gradient(100deg, #8772f7, #705ce2);
  box-shadow: 0 10px 28px #6758e54d, 0 1px 0 rgba(255, 255, 255, .18) inset;
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  font-weight: 800;
  transition: filter .15s, transform .12s;
}
.primary-button:active { transform: scale(.985); }
.primary-button:disabled { cursor: not-allowed; filter: saturate(.7) brightness(.85); transform: none; }
.button-arrow { margin-left: 2px; font-size: 22px; font-weight: 400; }
.spinner { display: none; width: 18px; height: 18px; border-radius: 50%; border: 2.4px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: spin .8s linear infinite; }
.primary-button.is-loading .spinner { display: block; }
.primary-button.is-loading .button-icon,
.primary-button.is-loading .button-arrow { display: none; }

.alert { padding: 13px 15px; color: var(--danger-text); background: #d7556920; border: 1px solid #db637449; border-radius: 12px; font-size: 13px; margin-top: 16px; line-height: 1.6; overflow-wrap: anywhere; animation: rise .25s var(--ease); }

/* Job card */

.job-card {
  max-width: 770px;
  margin: 16px auto 0;
  padding: 16px;
  border-radius: 22px;
  border: 1px solid #313e57;
  background: linear-gradient(160deg, #151e31, #111827);
  box-shadow: 0 20px 50px #03070e66;
  scroll-margin-top: calc(76px + var(--safe-top));
  scroll-margin-bottom: 20px;
  animation: rise .35s var(--ease);
  transition: border-color .3s, box-shadow .3s;
}
.job-card[data-state="completed"] { border-color: rgba(42, 201, 149, .5); box-shadow: 0 0 0 4px rgba(42, 201, 149, .08), 0 20px 50px #03070e66; }
.job-card[data-state="failed"],
.job-card[data-state="cancelled"] { border-color: rgba(244, 116, 132, .4); }

.job-head { display: flex; gap: 13px; align-items: flex-start; }
.job-thumb { position: relative; width: 92px; aspect-ratio: 16 / 9; flex: none; display: grid; place-items: center; border-radius: 11px; overflow: hidden; background: #8c7aff26; color: #b6aaff; }
.job-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.job-text { flex: 1; min-width: 0; }
.job-text h2 { margin: 7px 0 4px; font-size: 15px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.job-text p { margin: 0; color: #8d9ab0; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }

.job-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 999px; color: #c6baff; background: #8b78ff24; border: 1px solid #8b78ff36; font-size: 11px; font-weight: 700; white-space: nowrap; }
.job-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.6s ease-in-out infinite; }
.job-badge.ok { background: #2ac99522; border-color: #2ac99545; color: var(--success-text); }
.job-badge.error { background: #f4748422; border-color: #f4748455; color: #ffadb6; }
.job-badge.ok::before,
.job-badge.error::before { animation: none; }

.progress-info { display: flex; justify-content: space-between; align-items: baseline; margin: 18px 0 8px; color: #9da9be; font-size: 12px; }
#progress-percent { color: #cfbefd; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.job-card[data-state="completed"] #progress-percent { color: var(--success-text); }

.progress-track { position: relative; height: 10px; overflow: hidden; border-radius: 99px; background: #2c3449; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #8275fa, #66cbef); border-radius: 99px; transition: width .4s var(--ease); }
.job-card[data-state="completed"] .progress-fill { background: linear-gradient(90deg, #22b487, #66e0b8); }
.progress-track.is-busy::after { content: ""; position: absolute; inset: 0; width: 40%; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .28), transparent); animation: sweep 1.3s ease-in-out infinite; }

.job-actions { display: grid; gap: 10px; margin-top: 18px; }
.secondary-button,
.success-button { min-height: 50px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 13px; padding: 10px 18px; font-size: 14px; font-weight: 780; cursor: pointer; text-decoration: none; transition: background .15s, transform .12s; }
.secondary-button { color: #c0c9d8; background: transparent; border: 1px solid #44506a; }
.secondary-button:active { background: #2b3348; transform: scale(.98); }
.secondary-button:disabled { opacity: .6; cursor: progress; }
.success-button { min-height: 56px; order: -1; font-size: 15px; border: 1px solid #64cfae66; background: linear-gradient(100deg, #24a37d, #1f8f6d); color: #fff; box-shadow: 0 10px 26px rgba(35, 155, 119, .3); animation: rise .35s var(--ease); }
.success-button:active { transform: scale(.98); }

/* Features */

.features { max-width: 770px; margin: 28px auto 32px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.feature { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 9px; padding: 14px 6px; border-radius: 16px; background: rgba(21, 27, 43, .6); border: 1px solid #232b3d; }
.feature-icon { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 10px; font-weight: 850; font-size: 18px; }
.purple { background: #8c70ff23; color: #b9a1ff; }
.cyan { background: #2cadd622; color: #7bd9ee; }
.orange { background: #f9a75423; color: #fac28a; }
.feature strong { display: block; font-size: 12px; color: var(--text-soft); }
.feature p { color: #8793a9; font-size: 11px; margin: 4px 0 0; line-height: 1.4; }

.footer { padding: 18px 0 calc(24px + var(--safe-bottom)); border-top: 1px solid #273044; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; color: #7e8ca2; font-size: 11px; line-height: 1.5; }
.footer-sep { color: #6258b5; padding: 0 5px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(88px + var(--safe-bottom));
  z-index: 50;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(30, 37, 56, .96);
  border: 1px solid #3a4560;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
  transform: translateX(-50%);
  animation: toast-in .25s var(--ease);
}

@media (max-width: 360px) {
  .preview-thumb { width: 72px; }
  .job-thumb { width: 76px; }
}

/* Larger screens */

@media (min-width: 700px) {
  :root { --gutter: 24px; }
  .ambient { filter: blur(105px); opacity: .18; }
  .ambient-one { width: 470px; height: 470px; top: 60px; left: -250px; }
  .ambient-two { width: 420px; height: 420px; top: 370px; right: -280px; }
  .header { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; position: relative; }
  .header-inner { height: 90px; }
  .brand { font-size: 24px; gap: 11px; letter-spacing: -1.15px; }
  .brand-icon { width: 41px; height: 41px; border-radius: 13px; }
  .top-badge { font-size: 12px; padding: 9px 13px; }
  .hero { padding: 56px 0 42px; }
  .eyebrow { font-size: 11px; margin-bottom: 22px; }
  .subtitle { font-size: 15px; line-height: 1.7; margin-top: 21px; }
  .download-card { padding: 32px; border-radius: 24px; }
  .card-top { gap: 15px; margin-bottom: 30px; }
  .section-icon { width: 47px; height: 47px; border-radius: 13px; }
  .card-top h2 { font-size: 17px; }
  .url-box { padding-left: 17px; }
  .url-icon { margin-right: 9px; }
  .quality-grid { grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 26px; }
  .quality-body { min-height: 82px; align-items: center; text-align: center; }
  .submit-bar { position: static; }
  .job-card { padding: 24px 28px; margin-top: 20px; }
  .job-thumb { width: 128px; }
  .job-text h2 { font-size: 16px; }
  .job-actions { display: flex; justify-content: flex-end; }
  .secondary-button { min-height: 44px; font-size: 13px; }
  .success-button { min-height: 44px; order: 0; font-size: 13px; }
  .features { gap: 16px; margin: 34px auto 60px; }
  .feature { flex-direction: row; text-align: left; gap: 12px; padding: 14px 16px; }
  .footer { flex-direction: row; justify-content: space-between; text-align: left; gap: 25px; padding-bottom: 28px; }
  .toast { bottom: 32px; }
}

@media (hover: hover) {
  .paste-button:hover { background: #8979fc38; }
  .icon-button:hover { background: #1c2335; color: var(--text-soft); }
  .quality-option:hover .quality-body { border-color: #7b77a5; }
  .primary-button:not(:disabled):hover { filter: brightness(1.1); }
  .secondary-button:hover { background: #2b3348; }
  .success-button:hover { filter: brightness(1.12); }
}

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

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .45; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
