/* ============================================================
   AETest base: design tokens, reset and shared components.
   Used by every page: /login/, /dashboard/ and /vct/.
   Surfaces are separated by shade and spacing, not border lines.
   ============================================================ */

/* Google Sans Flex (SIL OFL 1.1, see /fonts/OFL.txt), self-hosted so no third-party stylesheet blocks the page.
   Variable: weight 400–700 and optical size. */
@font-face {
  font-family: "Google Sans Flex";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/google-sans-flex-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Google Sans Flex";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/google-sans-flex-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: dark;

  /* Surfaces, darkest to lightest */
  --bg: #09090b;
  --surface-1: #131418;
  --surface-2: #191b20;
  --surface-3: #22252b;
  --surface-4: #2c3038;

  /* Text */
  --text-1: #f2f3f5;
  --text-2: #a2a7b2;
  --text-3: #80858f;

  /* Accent: dark red into dark purple */
  --red: #c4283f;
  --purple: #6d2fc4;
  --accent: linear-gradient(135deg, var(--red) 0%, var(--purple) 100%);
  --accent-red-text: #ec5a70;
  --accent-purple-text: #a98af2;
  --focus: rgba(169, 138, 242, 0.75);

  /* Meaning */
  --win: #3ecf8e;
  --loss: #ec5a70;
  --draw: #f5b544;
  --warning: #f5b544;
  --win-soft: rgba(62, 207, 142, 0.14);
  --loss-soft: rgba(236, 90, 112, 0.14);
  --draw-soft: rgba(245, 181, 68, 0.14);
  --warning-soft: color-mix(in srgb, var(--warning) 12%, transparent);
  --warning-edge: color-mix(in srgb, var(--warning) 35%, transparent);
  --loss-edge: color-mix(in srgb, var(--loss) 35%, transparent);

  /* Riot rarity tiers */
  --rarity-select: #5a9fe2;
  --rarity-deluxe: #00a891;
  --rarity-premium: #d1548d;
  --rarity-exclusive: #f5955b;
  --rarity-ultra: #fad663;

  /* Match details: teams and Riot's Performance Score tiers */
  --team-ally: #3cc8b4;
  --team-enemy: var(--loss);
  --ps-pass: #a2a7b2;
  --ps-merit: #6cb6ff;
  --ps-distinction: #f5c451;

  /* Urgent countdowns: glowing red text and its halo (RGB triplet for rgba()) */
  --urgent-text: #ff7a8e;
  --urgent-glow: 255, 92, 116;

  /* Shape and rhythm */
  --radius-xs: 6px;
  --radius-s: 8px;
  --radius-m: 12px;
  --radius-l: 16px;
  --radius-pill: 999px;
  --gap: 16px;
  --page-pad: 24px;

  /* Type */
  --font: "Google Sans Flex", "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  --text-xs: 11px;
  --text-s: 12px;
  --text-m: 14px;
  --text-l: 16px;
  --text-xl: 20px;
  --text-2xl: 26px;

  /* Motion: one curve family, three speeds. Only transform/opacity are animated. */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 0.18s;
  --motion-fast: 0.14s;
  --motion: 0.22s;
  --motion-slow: 0.42s;
  --shadow-pop: 0 24px 60px -24px rgba(0, 0, 0, 0.85);
  --app-vh: 100vh;
}

@supports (height: 100dvh) {
  :root {
    --app-vh: 100dvh;
  }
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body,
h1, h2, h3, h4, p, ul, ol, figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: var(--app-vh);
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--font);
  font-size: var(--text-m);
  line-height: 1.45;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

code {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.92em;
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  background: var(--surface-3);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

::selection {
  background: color-mix(in srgb, var(--purple) 45%, transparent);
}

/* Thin, dark scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--surface-4) transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-thumb {
  background: var(--surface-4);
  border-radius: var(--radius-pill);
}

*::-webkit-scrollbar-track {
  background: transparent;
}

/* JS toggles this everywhere */
.hidden {
  display: none !important;
}

/* Hover boxes (popovers, menus) share one quick motion: fade + slight rise/scale in, the reverse out.
   Add .pop-motion and toggle .is-open (reduced motion shortens it to nothing via the global rule). */
.pop-motion {
  opacity: 0;
  scale: 0.96;
  translate: 0 4px;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--motion-fast) var(--ease-out), scale var(--motion-fast) var(--ease-out), translate var(--motion-fast) var(--ease-out), visibility 0s linear var(--motion-fast);
}

.pop-motion.is-open {
  opacity: 1;
  scale: 1;
  translate: 0 0;
  visibility: visible;
  pointer-events: auto;
  transition: opacity var(--motion-fast) var(--ease-out), scale var(--motion-fast) var(--ease-out), translate var(--motion-fast) var(--ease-out), visibility 0s;
}

.num {
  font-variant-numeric: tabular-nums;
}

/* ---------- Logo ---------- */
.logo-mark {
  flex-shrink: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text-1);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-m);
  background: var(--surface-3);
  color: var(--text-1);
  font-size: var(--text-m);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease), filter var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.btn:hover:not(:disabled) {
  background: var(--surface-4);
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn--primary,
.btn--danger {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 24px -12px color-mix(in srgb, var(--purple) 70%, transparent);
}

.btn--primary:hover:not(:disabled),
.btn--danger:hover:not(:disabled) {
  background: var(--accent);
  filter: brightness(1.12);
}

.btn--ghost {
  background: var(--surface-3);
  color: var(--text-1);
}

.btn--small {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: var(--radius-s);
}

.btn--full {
  width: 100%;
}

.btn--control {
  height: 40px;
}

.btn:disabled {
  background: var(--surface-3);
  color: var(--text-3);
  box-shadow: none;
  cursor: not-allowed;
  filter: none;
}

.btn-icon {
  display: inline-flex;
}

.btn-icon svg,
.btn-inline-icon {
  width: 18px;
  height: 18px;
}

.btn-loader {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}

/* ---------- Inputs and selects ---------- */
.input,
.form-input,
.mh-search {
  width: 100%;
  height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-m);
  background: var(--surface-2);
  color: var(--text-1);
  font-size: var(--text-m);
  outline: none;
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.input::placeholder,
.form-input::placeholder,
.mh-search::placeholder {
  color: var(--text-3);
}

.input:focus,
.form-input:focus,
.mh-search:focus {
  background: var(--surface-3);
  box-shadow: 0 0 0 2px var(--focus);
}

.form-input--valid {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--win) 55%, transparent);
}

.select,
.currency-dropdown {
  height: 36px;
  padding: 0 34px 0 12px;
  border: 0;
  border-radius: var(--radius-s);
  background-color: var(--surface-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a2a7b2' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  color: var(--text-1);
  font-size: 13px;
  font-weight: 500;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease);
}

.select:hover,
.currency-dropdown:hover {
  background-color: var(--surface-3);
}

.select option,
.currency-dropdown option {
  background: var(--surface-2);
  color: var(--text-1);
}

/* ---------- Surfaces ---------- */
.card {
  background: var(--surface-1);
  border-radius: var(--radius-l);
  padding: 18px;
}

/* ---------- Pills, chips, segmented control ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: var(--text-s);
  font-weight: 500;
  white-space: nowrap;
}

/* Store countdowns (daily store, bundles, accessories, Night Market): bold and a little larger.
   Near the end (.is-urgent) the text keeps a strong red glow, and a halo behind it flashes brighter.
   Only the halo's opacity animates, so the flash stays off the main thread. */
.pill.time-left {
  height: 28px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
}

.pill.time-left.is-urgent {
  position: relative;
  isolation: isolate;
  background: rgba(var(--urgent-glow), 0.2);
  color: var(--urgent-text);
  text-shadow: 0 0 6px rgba(var(--urgent-glow), 0.95), 0 0 14px rgba(var(--urgent-glow), 0.6);
  box-shadow: 0 0 10px rgba(var(--urgent-glow), 0.45);
}

.pill.time-left.is-urgent::before {
  content: "";
  position: absolute;
  inset: -3px;
  z-index: -1;
  border-radius: inherit;
  background: radial-gradient(closest-side, rgba(var(--urgent-glow), 0.5), rgba(var(--urgent-glow), 0.12) 70%, transparent);
  box-shadow: 0 0 22px 6px rgba(var(--urgent-glow), 0.55);
  opacity: 0.3;
  animation: time-left-flash 1.4s var(--ease) infinite alternate;
  pointer-events: none;
}

@keyframes time-left-flash {
  from { opacity: 0.3; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .pill.time-left.is-urgent::before {
    animation: none;
    opacity: 0.6;
  }
}

.seg {
  position: relative;
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--radius-m);
  background: var(--surface-2);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.seg::-webkit-scrollbar {
  display: none;
}

.seg > button {
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.seg > button:hover {
  color: var(--text-1);
}

.seg > button.is-active,
.seg > button.bundle-tab--active,
.seg > button[aria-selected="true"] {
  background: var(--surface-4);
  color: var(--text-1);
}

/* With JS, one highlight slides between buttons instead of each button lighting up */
.seg > button {
  position: relative;
  z-index: 1;
}

.seg.has-indicator > button.is-active,
.seg.has-indicator > button.bundle-tab--active,
.seg.has-indicator > button[aria-selected="true"] {
  background: transparent;
}

.seg-indicator {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 0;
  border-radius: 9px;
  background: var(--surface-4);
  pointer-events: none;
  transition: transform var(--motion) var(--ease-out), width var(--motion) var(--ease-out), opacity var(--motion-fast) ease;
}

/* ---------- Header (dashboard and VCT) ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(9, 9, 11, 0.94);
  transition: transform 0.25s var(--ease);
  padding-top: env(safe-area-inset-top);
}

.topbar.navbar--hidden {
  transform: translateY(-100%);
}

.topbar-inner {
  max-width: 1160px;
  height: 60px;
  margin: 0 auto;
  padding: 0 var(--page-pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Header link pills: VCT on the dashboard, Dashboard / Sign in on the VCT page */
.topbar-vct,
.topbar-link {
  height: 36px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-pill);
  background: var(--surface-1);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.topbar-vct:hover,
.topbar-link:hover {
  background: var(--surface-2);
  color: var(--text-1);
}

@media (max-width: 640px) {
  .topbar-inner {
    height: 56px;
  }
}

/* Text for screen readers only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Section headings ---------- */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.section-title {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

/* ---------- Status dot ---------- */
.status-dot {
  position: relative;
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--text-3);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

.status-dot--active {
  background: var(--win);
  box-shadow: none;
}

/* The pulse is a ring that scales and fades (compositor only; animating box-shadow repainted every frame). */
.status-dot--active::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--win) 18%, transparent);
  animation: dot-pulse 2s var(--ease) infinite;
}

.status-dot--waiting {
  background: var(--text-3);
}

.status-dot--danger {
  background: var(--loss);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--loss) 18%, transparent);
}

/* ---------- Toasts (ui.toast.js) ---------- */
.toast-stack {
  position: fixed;
  top: 76px;
  right: 16px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 10px 6px 10px 14px;
  border-radius: var(--radius-m);
  background: var(--surface-3);
  color: var(--text-1);
  font-size: var(--text-m);
  line-height: 1.4;
  box-shadow: var(--shadow-pop);
  pointer-events: auto;
  animation: toast-in var(--motion) var(--ease-out);
}

.toast-dot {
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--text-3);
}

.toast--error .toast-dot { background: var(--loss); }
.toast--success .toast-dot { background: var(--win); }
.toast--info .toast-dot { background: var(--purple); }

.toast-body {
  flex: 1;
  min-width: 0;
}

.toast-msg {
  margin: 0;
  padding-top: 1px;
  overflow-wrap: anywhere;
}

/* Buttons for a toast that needs an answer (sign-in ran out: Reconnect / Sign in with Riot). */
.toast-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 2px;
}

/* The toast is already --surface-3, the ghost button's own shade. */
.toast-actions .btn--ghost {
  background: var(--surface-4);
}

.toast-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: -4px 0;
  border: 0;
  border-radius: var(--radius-s);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--motion-fast) var(--ease-out), color var(--motion-fast) var(--ease-out);
}

.toast-close:hover {
  background: var(--surface-4);
  color: var(--text-1);
}

.toast-close:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 640px) {
  .toast-stack {
    top: auto;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    left: 12px;
    width: auto;
  }

  .toast-actions .btn--small {
    height: 40px;
  }

  /* Touch target ≥ 40px without growing the toast */
  .toast-close {
    width: 40px;
    height: 40px;
    margin: -10px -2px -10px 0;
  }
}

/* ---------- Loading skeletons ----------
   A placeholder block with one soft highlight sliding across (transform only). Text inside stays for screen readers
   but is invisible. Reduced motion ends the slide at once (global rule), leaving a plain block. */
.skel {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--radius-s);
  background: var(--surface-2);
  color: transparent !important;
  user-select: none;
}

.skel::after {
  content: '';
  position: absolute;
  inset: 0;
  width: 40%;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text-1) 7%, transparent), transparent);
  animation: splash-slide 1.5s var(--ease) infinite;
}

.skel-line {
  width: 100%;
  height: 12px;
}

.skel-line--short {
  width: 55%;
}

.skel-block {
  width: 70%;
  height: 64px;
}

.skel-icon {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
}

.skel-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-s);
}

/* ---------- Splash ---------- */
.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: grid;
  place-items: center;
  background: var(--bg);
  transition: opacity 0.3s var(--ease), visibility 0.3s;
}

.splash-screen.fade-out {
  opacity: 0;
  visibility: hidden;
}

.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.splash-logo {
  width: 56px;
  height: 56px;
  animation: splash-breathe 1.6s var(--ease) infinite;
}

.splash-loader {
  width: 120px;
  height: 3px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  overflow: hidden;
  position: relative;
}

.splash-loader::after {
  content: '';
  position: absolute;
  inset: 0;
  width: 40%;
  border-radius: inherit;
  background: var(--accent);
  animation: splash-slide 1.1s var(--ease) infinite;
}

/* ---------- Background outline art ----------
   Two fixed layers of thin strokes. Each layer is rasterised once and only moved with transform
   (time-based drift on the inner element, scroll-linked parallax on the outer one), so the GPU
   just slides two textures around. No filters, no blur, no per-frame JavaScript. */
.bg-art {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  contain: strict;
}

.bg-par,
.bg-drift {
  position: absolute;
  inset: -14% -6%;
}

.bg-drift svg {
  width: 100%;
  height: 100%;
  display: block;
}

.bg-drift path {
  fill: none;
  stroke: url(#ae-line);
  stroke-width: 1.2;
  stroke-linecap: square;
  stroke-linejoin: miter;
  vector-effect: non-scaling-stroke;
}

.bg-drift--far {
  opacity: 0.16;
  animation: bg-drift-far 120s ease-in-out infinite alternate;
}

.bg-drift--near {
  opacity: 0.32;
  animation: bg-drift-near 80s ease-in-out infinite alternate;
}

/* Under a popup (match details blurs what's behind it) the background holds still, so the GPU doesn't re-blur it
   every frame; the parallax is scroll-driven and stops on its own. */
body.match-deep-open .bg-drift,
body.match-deep-open .bg-streak,
body.vct-modal-open .bg-drift,
body.vct-modal-open .bg-streak {
  animation-play-state: paused;
}

/* Short red→purple streaks that glide along a diagonal, fade, and come back later.
   Each is a small composited layer moved with transform/opacity only. */
.bg-streak {
  position: absolute;
  width: 180px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, #e0344e 40%, #8b46e6 70%, transparent);
  opacity: 0;
  animation: bg-streak var(--t) linear var(--d) infinite;
}

@keyframes bg-streak {
  0% { opacity: 0; transform: translate3d(0, 0, 0) rotate(var(--r)); }
  12% { opacity: 0.85; }
  70% { opacity: 0.85; }
  100% { opacity: 0; transform: translate3d(var(--dx), var(--dy), 0) rotate(var(--r)); }
}

@keyframes bg-drift-far {
  from { transform: translate3d(-1.5%, 1%, 0); }
  to { transform: translate3d(1.5%, -1.5%, 0); }
}

@keyframes bg-drift-near {
  from { transform: translate3d(2%, 1.5%, 0); }
  to { transform: translate3d(-2%, -1.5%, 0); }
}

/* Parallax tied to page scroll; runs off the main thread (Chrome/Edge 115+, Safari 26+). Others: drift only. */
@supports (animation-timeline: scroll()) {
  .bg-par--far {
    animation: bg-par-far linear both;
    animation-timeline: scroll(root);
  }

  .bg-par--near {
    animation: bg-par-near linear both;
    animation-timeline: scroll(root);
  }

  @keyframes bg-par-far {
    to { transform: translate3d(0, -5%, 0); }
  }

  @keyframes bg-par-near {
    to { transform: translate3d(0, -12%, 0); }
  }
}

/* Phones: one layer is enough */
@media (max-width: 640px) {
  .bg-par--far {
    display: none;
  }

  .bg-drift--near {
    opacity: 0.26;
  }

  .bg-streak:nth-of-type(n + 4) {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bg-par,
  .bg-drift {
    animation: none !important;
  }

  .bg-streak {
    display: none;
  }
}

/* ---------- Animations ---------- */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes dot-pulse {
  0%, 100% { scale: 1; opacity: 1; }
  50% { scale: 1.43; opacity: 0.28; }
}

@keyframes splash-breathe {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.94); opacity: 0.75; }
}

@keyframes splash-slide {
  from { transform: translateX(-110%); }
  to { transform: translateX(260%); }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 640px) {
  :root {
    --page-pad: 16px;
    --gap: 12px;
  }
}
