/* Vidstash mobile skin (phones, <= 640px). Loaded with media="(max-width: 640px)",
   so the desktop layout never sees any of this. Frosted glass panels with depth,
   raised 3D controls and the hooks mobile.js animates:
     .is-pressed      press depth (spring back on release)
     .ripple          touch ripple
     --rx / --ry      card tilt while a finger drags across it
     --mx / --my      where the light catches the glass
     .m-reveal/.m-in  cards rising into view on scroll */

:root,
:root[data-theme="dark"] {
  --glass: linear-gradient(155deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.05) 42%, rgba(255, 255, 255, 0.025) 100%);
  --glass-solid: linear-gradient(155deg, rgba(36, 44, 92, 0.92), rgba(18, 24, 56, 0.94));
  --glass-inner: rgba(255, 255, 255, 0.06);
  --glass-inner-2: rgba(255, 255, 255, 0.1);
  --glass-line: rgba(255, 255, 255, 0.16);
  --glass-edge: inset 0 1px 0 rgba(255, 255, 255, 0.24), inset 0 0 0 1px rgba(255, 255, 255, 0.03), inset 0 -1px 0 rgba(0, 0, 0, 0.25);
  --depth-1: 0 1px 1px rgba(0, 0, 0, 0.3), 0 6px 14px -6px rgba(2, 6, 23, 0.7);
  --depth-2: 0 1px 1px rgba(0, 0, 0, 0.28), 0 12px 24px -10px rgba(2, 6, 23, 0.75), 0 30px 60px -30px rgba(99, 102, 241, 0.55);
  --depth-3: 0 2px 2px rgba(0, 0, 0, 0.3), 0 18px 36px -12px rgba(2, 6, 23, 0.8), 0 46px 80px -34px rgba(139, 92, 246, 0.6);
  --well: inset 0 2px 6px rgba(0, 0, 0, 0.45), inset 0 -1px 0 rgba(255, 255, 255, 0.06);
  --sheen: rgba(255, 255, 255, 0.16);
  --bevel: #4c3bb8;
  --glow: rgba(139, 92, 246, 0.55);
}

:root[data-theme="light"] {
  --glass: linear-gradient(155deg, rgba(255, 255, 255, 0.92) 0%, rgba(255, 255, 255, 0.66) 55%, rgba(246, 244, 255, 0.6) 100%);
  --glass-solid: linear-gradient(155deg, #ffffff, #f4f2ff);
  --glass-inner: rgba(255, 255, 255, 0.7);
  --glass-inner-2: rgba(255, 255, 255, 0.9);
  --glass-line: rgba(255, 255, 255, 0.95);
  --glass-edge: inset 0 1px 0 #ffffff, inset 0 0 0 1px rgba(99, 102, 241, 0.06), inset 0 -1px 0 rgba(15, 23, 42, 0.05);
  --depth-1: 0 1px 1px rgba(15, 23, 42, 0.06), 0 6px 12px -6px rgba(30, 27, 75, 0.18);
  --depth-2: 0 1px 1px rgba(15, 23, 42, 0.06), 0 12px 24px -12px rgba(30, 27, 75, 0.22), 0 30px 50px -28px rgba(99, 102, 241, 0.38);
  --depth-3: 0 2px 2px rgba(15, 23, 42, 0.06), 0 18px 34px -14px rgba(30, 27, 75, 0.25), 0 44px 70px -32px rgba(139, 92, 246, 0.45);
  --well: inset 0 2px 5px rgba(30, 27, 75, 0.12), inset 0 -1px 0 #ffffff;
  --sheen: rgba(255, 255, 255, 0.75);
  --bevel: #5b45d6;
  --glow: rgba(139, 92, 246, 0.35);
}

/* ---------- Atmosphere ---------- */
body {
  background:
    radial-gradient(120% 60% at 0% 0%, color-mix(in srgb, var(--indigo) 22%, transparent), transparent 60%),
    radial-gradient(90% 50% at 100% 30%, color-mix(in srgb, var(--pink) 14%, transparent), transparent 65%),
    var(--bg);
}
.aurora span { filter: blur(70px); }
.aurora span:nth-child(1) { width: 340px; height: 340px; top: -90px; left: -110px; }
.aurora span:nth-child(2) { width: 300px; height: 300px; top: 34%; right: -140px; }
.aurora span:nth-child(3) { width: 300px; height: 300px; top: 70%; left: -60px; }

/* ---------- Shared glass + depth ---------- */
.site-header,
.dl-card, .result-card, .pl-card, .apk-card, .step, .feature, .q-item,
.table-wrap, .faq, .modal, .toast, .nav, .eyebrow, .platforms li, .notice {
  background: var(--glass);
  border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(20px) saturate(170%);
  backdrop-filter: blur(20px) saturate(170%);
}

.dl-card, .result-card, .pl-card, .apk-card, .step, .feature, .q-item, .faq {
  position: relative;
  isolation: isolate;
  box-shadow: var(--glass-edge), var(--depth-2);
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateZ(0);
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}
/* Light catching the glass; mobile.js moves it with the finger. */
.dl-card::before, .result-card::before, .pl-card::before, .apk-card::before,
.step::before, .feature::before, .q-item::before, .faq::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: -1;
  background: radial-gradient(160px 120px at var(--mx, 18%) var(--my, 0%), var(--sheen), transparent 70%);
  opacity: 0.55;
  transition: opacity 0.3s ease;
}
.is-tilting { transition: transform 0.08s linear, box-shadow 0.3s ease; box-shadow: var(--glass-edge), var(--depth-3); }
.is-tilting::before { opacity: 1; }

/* ---------- Header ---------- */
.site-header {
  border-width: 0 0 1px;
  border-radius: 0 0 22px 22px;
  box-shadow: var(--glass-edge), var(--depth-1);
}
.brand img { box-shadow: 0 6px 14px -4px var(--glow); }
.icon-btn {
  position: relative; overflow: hidden;
  width: 42px; height: 42px; border-radius: 14px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  box-shadow: var(--glass-edge), var(--depth-1);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}
.nav {
  top: calc(var(--header-h) + 6px);
  left: 10px; right: 10px;
  padding: 8px;
  /* Nested in the header's own blur, a backdrop-filter here has nothing to
     blur, so the sheet carries a near-solid glass of its own. */
  background: var(--glass-solid);
  border-radius: 20px;
  box-shadow: var(--glass-edge), var(--depth-3);
  transform-origin: top center;
}
.nav.is-open { animation: sheet-in 0.42s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(-8px) scale(0.96); } to { opacity: 1; transform: none; } }
.nav a { padding: 14px 14px; border-radius: 14px; font-weight: 600; color: var(--text); }
.nav a + a { margin-top: 2px; }
.nav a:hover, .nav a:active { background: var(--glass-inner-2); }

/* ---------- Hero ---------- */
.hero { padding: 34px 0 22px; }
.eyebrow { box-shadow: var(--glass-edge), var(--depth-1); }
.hero h1 { font-size: clamp(2rem, 9vw, 2.5rem); line-height: 1.08; letter-spacing: -0.03em; text-shadow: 0 2px 24px color-mix(in srgb, var(--violet) 35%, transparent); }
.hero .lead { font-size: 1rem; margin-top: 14px; }

.dl-card {
  margin-top: 26px;
  padding: 14px;
  border-radius: 28px;
  box-shadow: var(--glass-edge), var(--depth-3);
}

/* Segmented control with a raised puck that slides (mobile.js adds .mode-puck). */
.modes {
  position: relative;
  padding: 5px;
  border-radius: 18px;
  background: var(--glass-inner);
  box-shadow: var(--well);
  margin-bottom: 14px;
}
.mode {
  position: relative; z-index: 1; overflow: hidden;
  padding: 10px 6px;
  border-radius: 13px;
  font-weight: 650;
  transition: color 0.25s ease, transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modes.has-puck .mode.is-active { background: transparent; box-shadow: none; color: #fff; }
.mode-puck {
  position: absolute; z-index: 0; top: 5px; bottom: 5px; left: 0;
  border-radius: 13px;
  background: var(--grad);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 -2px 0 rgba(0, 0, 0, 0.15), 0 6px 16px -6px var(--glow);
  transition: transform 0.55s cubic-bezier(0.34, 1.4, 0.64, 1), width 0.55s cubic-bezier(0.34, 1.4, 0.64, 1);
  pointer-events: none;
}

/* Inset "well" for the link field. */
.url-field {
  min-height: 58px;
  padding: 0 6px 0 14px;
  border-radius: 18px;
  background: var(--glass-inner);
  border: 1px solid var(--glass-line);
  box-shadow: var(--well);
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}
.url-field:focus-within {
  border-color: color-mix(in srgb, var(--violet) 70%, transparent);
  box-shadow: var(--well), 0 0 0 4px color-mix(in srgb, var(--violet) 22%, transparent), 0 0 28px -4px var(--glow);
}
.url-field input { height: 56px; font-size: 16px; }
.paste-btn {
  position: relative; overflow: hidden;
  width: 44px; height: 44px; justify-content: center; padding: 0;
  border-radius: 13px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  box-shadow: var(--glass-edge), var(--depth-1);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.paste-btn .icon { width: 19px; height: 19px; }

/* ---------- Raised 3D buttons ---------- */
.btn {
  position: relative; overflow: hidden; isolation: isolate;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s ease, filter 0.2s ease;
}
.btn-primary {
  background: var(--grad);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.38),
    inset 0 -2px 0 rgba(0, 0, 0, 0.16),
    0 4px 0 var(--bevel),
    0 14px 26px -10px var(--glow);
}
.btn-primary::before {
  /* glossy top half, under the label */
  content: ""; position: absolute; z-index: -1; left: 1px; right: 1px; top: 1px; height: 48%;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0));
  pointer-events: none;
}
.btn-primary.is-pressed {
  transform: translateY(3px) scale(0.985);
  transition: transform 0.08s ease-out, box-shadow 0.08s ease-out;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), inset 0 2px 6px rgba(0, 0, 0, 0.2), 0 1px 0 var(--bevel), 0 6px 14px -8px var(--glow);
}
.btn-ghost {
  background: var(--glass);
  border: 1px solid var(--glass-line);
  box-shadow: var(--glass-edge), 0 3px 0 color-mix(in srgb, var(--text) 10%, transparent), var(--depth-1);
}
.btn-ghost.is-pressed, .icon-btn.is-pressed, .paste-btn.is-pressed, .chip.is-pressed {
  transform: translateY(2px) scale(0.97);
  transition: transform 0.08s ease-out;
  box-shadow: var(--well);
}
.btn-go { min-height: 58px; border-radius: 18px; font-size: 1.05rem; letter-spacing: 0.01em; }
.mode.is-pressed, .platforms li.is-pressed { transform: scale(0.95); transition: transform 0.08s ease-out; }

/* Touch ripple */
.ripple {
  position: absolute; z-index: 2;
  width: 12px; height: 12px; margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  pointer-events: none;
  animation: ripple 0.65s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}
:root[data-theme="light"] .btn-ghost .ripple,
:root[data-theme="light"] .icon-btn .ripple,
:root[data-theme="light"] .paste-btn .ripple,
:root[data-theme="light"] .mode:not(.is-active) .ripple { background: rgba(99, 102, 241, 0.25); }
@keyframes ripple { from { transform: scale(1); opacity: 1; } to { transform: scale(28); opacity: 0; } }

/* ---------- Supported sites ---------- */
.platforms { gap: 8px; margin-top: 22px; }
.platforms li {
  padding: 7px 14px;
  color: var(--text);
  box-shadow: var(--glass-edge), var(--depth-1);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- Result card + quality rows ---------- */
.result-card { gap: 16px; padding: 14px; border-radius: 26px; box-shadow: var(--glass-edge), var(--depth-3); }
.thumb {
  border-radius: 20px;
  box-shadow: 0 16px 30px -14px rgba(0, 0, 0, 0.7), inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.thumb .badge-time { -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); background: rgba(0, 0, 0, 0.5); border-radius: 8px; }
.result-title { font-size: 1.15rem; }
.chip { background: var(--glass-inner-2); border: 1px solid var(--glass-line); box-shadow: var(--glass-edge); }
.group-label { margin-top: 6px; }
.formats { gap: 10px; }
.format {
  position: relative; overflow: hidden;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  padding: 12px;
  border-radius: 18px;
  background: var(--glass-inner);
  border: 1px solid var(--glass-line);
  box-shadow: var(--glass-edge), var(--depth-1);
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}
.format.is-pressed { transform: scale(0.985); }
.format .q { font-size: 1.12rem; }
.format .q .hd { padding: 2px 7px; border-radius: 7px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 4px 10px -4px var(--glow); }
.format .meta { white-space: normal; }
.format .btn { grid-column: 1 / -1; width: 100%; min-height: 48px; margin-top: 8px; border-radius: 14px; }
.format.audio { border-style: solid; background: linear-gradient(155deg, color-mix(in srgb, var(--pink) 12%, transparent), var(--glass-inner)); }

/* ---------- Playlist ---------- */
.pl-card { padding: 14px; border-radius: 26px; box-shadow: var(--glass-edge), var(--depth-3); }
.select {
  min-height: 44px; border-radius: 14px;
  background: var(--glass-inner); border: 1px solid var(--glass-line); box-shadow: var(--well);
}
.pl-list { gap: 8px; max-height: 60vh; }
.pl-item {
  padding: 10px; border-radius: 16px;
  background: var(--glass-inner); border: 1px solid var(--glass-line);
  box-shadow: var(--glass-edge), var(--depth-1);
}
.pl-item input { width: 20px; height: 20px; }
.pl-item .mini-thumb { border-radius: 10px; box-shadow: 0 8px 14px -8px rgba(0, 0, 0, 0.6); }
.pl-foot .btn { width: 100%; min-height: 54px; border-radius: 18px; }

/* ---------- Download queue ---------- */
.queue-head h2 { font-size: 1.2rem; }
.queue-list { gap: 12px; }
.q-item {
  grid-template-columns: 52px 1fr;
  gap: 12px;
  padding: 12px;
  border-radius: 20px;
}
.q-item .mini-thumb {
  width: 52px; border-radius: 14px;
  box-shadow: 0 10px 18px -10px rgba(0, 0, 0, 0.7), inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}
.q-status { white-space: normal; }
.q-status span { white-space: normal; }
.bar { height: 8px; background: var(--glass-inner); box-shadow: var(--well); }
.bar > i {
  position: relative; overflow: hidden;
  box-shadow: 0 0 12px -2px var(--glow);
}
.bar > i::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.6s ease-in-out infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.q-actions .btn { min-height: 40px; border-radius: 12px; }

/* ---------- Sections ---------- */
.section { padding-top: 58px; }
.section-title { font-size: 1.75rem; letter-spacing: -0.03em; }
.steps { gap: 14px; margin-top: 26px; }
.step { padding: 20px; border-radius: 24px; }
.step-num {
  width: 44px; height: 44px; border-radius: 14px; font-size: 1.1rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), inset 0 -2px 0 rgba(0, 0, 0, 0.18), 0 4px 0 var(--bevel), 0 12px 20px -8px var(--glow);
  animation: bob 5s ease-in-out infinite;
}
.step:nth-child(2) .step-num { animation-delay: -1.6s; }
.step:nth-child(3) .step-num { animation-delay: -3.2s; }
@keyframes bob { 50% { transform: translateY(-4px); } }
.feature-row { gap: 12px; margin-top: 14px; }
.feature { border-style: solid; border-radius: 22px; padding: 18px; }
.feature .icon {
  width: 44px; height: 44px; padding: 11px; border-radius: 14px; margin: 0;
  background: var(--glass-inner-2); border: 1px solid var(--glass-line);
  box-shadow: var(--glass-edge), var(--depth-1);
}

/* ---------- App section ---------- */
.app-grid { gap: 26px; }
.phone {
  width: min(250px, 68vw);
  padding: 9px;
  border-radius: 40px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.05) 40%, rgba(255, 255, 255, 0.12));
  border: 1px solid var(--glass-line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 30px 50px -20px rgba(2, 6, 23, 0.8), 0 50px 90px -40px var(--glow);
  transform: perspective(900px) rotateX(var(--rx, 6deg)) rotateY(var(--ry, -12deg)) rotateZ(2deg);
  transition: transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: hover-float 6s ease-in-out infinite;
}
.phone.is-tilting { animation-play-state: paused; transition: transform 0.08s linear; }
@keyframes hover-float { 50% { translate: 0 -8px; } }
.phone img { border-radius: 32px; }
.apk-card { padding: 16px; border-radius: 26px; box-shadow: var(--glass-edge), var(--depth-3); }
.apk-head img { border-radius: 16px; box-shadow: 0 10px 20px -8px var(--glow); }
.apk-actions .btn { width: 100%; }
.apk-actions .btn-large { min-height: 58px; border-radius: 18px; }
.apk-details { border-top-color: var(--glass-line); }
.sha-row { background: var(--glass-inner); border-color: var(--glass-line); box-shadow: var(--well); }
.install-steps {
  list-style: none; counter-reset: step; padding: 0; gap: 10px; margin-top: 18px;
}
.install-steps li {
  counter-increment: step;
  position: relative;
  padding: 12px 14px 12px 52px;
  border-radius: 16px;
  background: var(--glass-inner); border: 1px solid var(--glass-line);
  box-shadow: var(--glass-edge), var(--depth-1);
}
.install-steps li::before {
  content: counter(step);
  position: absolute; left: 12px; top: 50%; translate: 0 -50%;
  width: 28px; height: 28px; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--grad); color: #fff; font-weight: 800; font-size: 0.85rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 3px 0 var(--bevel);
}
.compare-title { margin-top: 42px; }
.table-wrap { border-radius: 22px; box-shadow: var(--glass-edge), var(--depth-2); }
/* Fits the screen instead of scrolling sideways: feature names wrap, ticks centre. */
.compare { min-width: 0; table-layout: fixed; }
.compare th, .compare td { padding: 12px 10px; font-size: 0.88rem; overflow-wrap: anywhere; }
.compare thead th { background: var(--glass-inner-2); font-size: 0.68rem; letter-spacing: 0.03em; }
.compare thead th:first-child, .compare tbody th { width: 52%; }
.compare td, .compare thead th:not(:first-child) { width: 24%; text-align: center; }
.compare td .icon { margin: 0 auto; }
.compare .tag { display: block; width: fit-content; margin: 4px auto 0; }

/* ---------- Screenshots: a swipeable 3D carousel ---------- */
.shots { grid-auto-columns: 62vw; gap: 14px; padding: 8px 4px 24px; perspective: 900px; }
.shots img {
  border-radius: 26px;
  border-color: var(--glass-line);
  box-shadow: 0 24px 40px -18px rgba(2, 6, 23, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.06);
  scroll-snap-align: center;
}

/* ---------- FAQ as stacked glass tiles ---------- */
.faq, .faq:first-of-type { border: 1px solid var(--glass-line); border-radius: 20px; margin-top: 10px; }
.faq:first-of-type { margin-top: 22px; }
.faq summary { padding: 16px 18px; font-size: 1rem; }
.faq summary::after {
  content: "+";
  display: grid; place-items: center;
  width: 30px; height: 30px; flex: none;
  border-radius: 10px;
  background: var(--glass-inner-2); border: 1px solid var(--glass-line);
  box-shadow: var(--glass-edge), var(--depth-1);
  font-size: 1.2rem; line-height: 1; color: var(--text);
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.faq[open] summary::after { transform: rotate(135deg); }
.faq p { padding: 0 18px 18px; }
.faq[open] p { animation: rise 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }

/* ---------- Footer, modal, toast ---------- */
.site-footer { border-top: 1px solid var(--glass-line); background: var(--glass); border-radius: 26px 26px 0 0; }
.modal { border-radius: 26px; box-shadow: var(--glass-edge), var(--depth-3); background: var(--glass-solid); }
.modal-actions .btn { flex: 1; }
.toast { border-radius: 999px; padding: 12px 20px; box-shadow: var(--glass-edge), var(--depth-3); background: var(--glass-solid); }
.notice { border-radius: 16px; box-shadow: var(--glass-edge), var(--depth-1); }

/* ---------- Scroll reveal (classes added by mobile.js only) ---------- */
.m-reveal {
  opacity: 0;
  translate: 0 26px;
  scale: 0.97;
  transition: opacity 0.6s ease, translate 0.8s cubic-bezier(0.34, 1.4, 0.64, 1), scale 0.8s cubic-bezier(0.34, 1.4, 0.64, 1);
  transition-delay: var(--d, 0ms);
}
.m-reveal.m-in { opacity: 1; translate: 0 0; scale: 1; }

/* ---------- Comfort ---------- */
@media (prefers-reduced-motion: reduce) {
  .phone, .step-num, .bar > i::after { animation: none; }
  .dl-card, .result-card, .pl-card, .apk-card, .step, .feature, .q-item, .faq, .phone,
  .btn, .format, .mode, .mode-puck, .icon-btn, .paste-btn, .platforms li { transition: none; }
  .ripple { display: none; }
  .m-reveal { opacity: 1; translate: none; scale: none; }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-header, .dl-card, .result-card, .pl-card, .apk-card, .step, .feature, .q-item,
  .table-wrap, .faq, .nav, .modal, .toast { background: var(--glass-solid); }
}
