/* ==========================================================================
   VaultDrop — style.css
   --------------------------------------------------------------------------
   1.  Design tokens          6.  Hero & page headers
   2.  Reset & base           7.  Cards
   3.  Background layers      8.  Modal, toast, misc UI
   4.  Buttons & chips        9.  Footer & utilities
   5.  Header & navigation   10.  Responsive & motion preferences
   ========================================================================== */

/* ---------------------------------------------------------- 1. tokens ---- */
:root {
  /* surfaces (dark-blue/indigo, never pure black) */
  --bg-900: #070c1c;
  --bg-800: #0a1226;
  --bg-700: #0f1a36;
  --bg-600: #16244c;

  /* text */
  --text: #eef2fb;
  --text-soft: #b9c4e2;
  --text-muted: #8b98bb;

  /* brand */
  --brand: #6b8dff;
  --brand-2: #8b6bff;
  --brand-3: #4cc9f0;
  --brand-grad: linear-gradient(135deg, #6b8dff 0%, #8b6bff 100%);
  --brand-grad-hover: linear-gradient(135deg, #7d9bff 0%, #9a7dff 100%);

  /* semantic colors for toasts/status */
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;

  /* glass */
  --glass: rgba(255, 255, 255, 0.05);
  --glass-2: rgba(255, 255, 255, 0.078);
  --glass-3: rgba(255, 255, 255, 0.115);
  --line: rgba(255, 255, 255, 0.11);
  --line-strong: rgba(255, 255, 255, 0.2);

  /* shadows & glow */
  --shadow-sm: 0 4px 16px rgba(4, 9, 26, 0.38);
  --shadow-md: 0 16px 40px rgba(4, 9, 26, 0.46);
  --shadow-lg: 0 30px 70px rgba(4, 9, 26, 0.54);
  --glow-brand: 0 10px 30px rgba(107, 141, 255, 0.26);

  /* shape */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 28px;
  --r-pill: 999px;

  /* layout */
  --wrap: 1180px;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --header-h: 74px;

  /* motion */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-fast: 0.18s;
  --t: 0.32s;
  --t-slow: 0.5s;

  /* type */
  --font: "Plus Jakarta Sans", "Inter", system-ui, -apple-system, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* -------------------------------------------------- 2. reset & base ----- */
*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 18px);
  scrollbar-gutter: stable;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg-800);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

body.is-locked { overflow: hidden; }

img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
ul, ol { list-style: none; }

:focus-visible {
  outline: 2px solid var(--brand-3);
  outline-offset: 3px;
  border-radius: 6px;
}

::selection { background: rgba(91, 140, 255, 0.35); color: #fff; }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--bg-900); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #2b3b63, #1b2744);
  border: 2px solid var(--bg-900);
  border-radius: var(--r-pill);
  transition: background 0.2s ease;
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #3d5382, #2a3a5e); }

.skip-link {
  position: fixed;
  top: 10px;
  left: 50%;
  z-index: 200;
  transform: translate(-50%, -180%);
  padding: 0.6rem 1.1rem;
  border-radius: var(--r-pill);
  background: var(--brand-grad);
  font-weight: 700;
  transition: transform var(--t) var(--ease);
}
.skip-link:focus { transform: translate(-50%, 0); }

#main {
  scroll-margin-top: calc(var(--header-h) + 1rem);
}

/* ------------------------------------------------- 3. background -------- */
.bg {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: 100vw;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  contain: paint;
  clip-path: inset(0);
  pointer-events: none;
  background:
    radial-gradient(1100px 700px at 10% -12%, rgba(91, 140, 255, 0.3), transparent 62%),
    linear-gradient(180deg, #0e1730 0%, #0a1122 42%, #0b1730 100%);
}

.bg__orb--1 {
  position: absolute;
  width: 46vmax; height: 46vmax;
  top: -18vmax; left: -12vmax;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(91, 140, 255, 0.55), transparent 68%);
  filter: blur(70px);
  opacity: 0.4;
  animation: float 40s var(--ease) infinite;
}
/* faint grid so the glass panels have structure behind them */
.bg__grid {
  position: absolute;
  inset: 0;
  opacity: 0.15;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(1000px 700px at 50% 0%, #000 20%, transparent 78%);
  mask-image: radial-gradient(1000px 700px at 50% 0%, #000 20%, transparent 78%);
}

@keyframes float {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(2vmax, 3vmax, 0) scale(1.06); }
}

/* ------------------------------------------------- 2. layout & type ---- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: clamp(3.5rem, 8vw, 6.5rem); }
.section--tight { padding-block: clamp(2.5rem, 5vw, 4rem); }

h1, h2, h3, h4 {
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 800;
  color: var(--text);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.h2 { font-size: clamp(1.7rem, 3.6vw, 2.4rem); }
.h3 { font-size: clamp(1.2rem, 2.2vw, 1.5rem); }

.grad-text {
  background: linear-gradient(120deg, var(--brand-3) 0%, var(--brand-2) 45%, var(--brand) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.muted { color: var(--text-soft); }

.eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--brand); /* refined hierarchy color */
}

/* ------------------------------------------------- 4. buttons ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.72rem 1.25rem;
  border-radius: var(--r-md);
  border: 1px solid var(--glass-3);
  background: var(--glass);
  color: var(--text);
  font-weight: 600;
  font-size: 0.94rem;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition: transform var(--t) var(--ease), border-color var(--t) var(--ease),
    background var(--t) var(--ease), box-shadow var(--t) var(--ease), color var(--t) var(--ease);
  max-width: 100%;
  text-overflow: ellipsis;
}
.btn:focus-visible { outline-offset: 4px; }

.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { transform: translateY(-2px); border-color: var(--line-strong); background: var(--glass-2); }
.btn:active { transform: translateY(0) scale(0.985); }

.btn--primary {
  border-color: transparent;
  background: var(--brand-grad);
  color: #fff;
  box-shadow: var(--glow-brand);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.btn--primary:hover {
  background: var(--brand-grad-hover);
  box-shadow: 0 16px 40px rgba(107, 141, 255, 0.35), 0 0 0 1px rgba(107, 141, 255, 0.3);
}

/* light sweep on hover */
.btn--primary::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: -60%;
  width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transform: skewX(-18deg);
  transition: left var(--t-slow) var(--ease-out);
}
.btn--primary:hover::after { left: 130%; }

.btn--ghost { background: transparent; border-color: transparent; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.btn--ghost:hover { background: var(--glass); border-color: var(--glass-3); }

.btn--soft {
  background: rgba(107, 141, 255, 0.12);
  border-color: rgba(107, 141, 255, 0.25);
  color: #cfe0ff;
}
.btn--soft:hover { background: rgba(107, 141, 255, 0.22); }

.btn--lg { padding: 0.95rem 1.7rem; font-size: 1rem; border-radius: var(--r-lg); }
.btn--sm { padding: 0.5rem 0.9rem; font-size: 0.83rem; border-radius: var(--r-sm); }
.btn--block { width: 100%; }

.btn--icon {
  width: 46px;
  height: 46px;
  padding: 0;
  flex: none;
  border-radius: 50%;
  color: var(--text-soft);
}
.btn--icon:hover { color: #fff; background: var(--glass); border-color: var(--glass-3); }

.btn.is-disabled { opacity: 0.5; pointer-events: none; }

/* chips / filters */
.chip-row { display: flex; flex-wrap: wrap; gap: 0.65rem; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.15rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--glass-3);
  background: rgba(4, 9, 22, 0.4);
  color: var(--text-soft);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: color var(--t) var(--ease), background var(--t) var(--ease),
    border-color var(--t) var(--ease), transform var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.chip:focus-visible { outline-offset: 3px; }
.chip:hover { color: #fff; background: var(--glass-2); border-color: var(--line-strong); transform: translateY(-1px); }
.chip:active { transform: translateY(0); }
.chip.is-active {
  color: #fff;
  border-color: rgba(107, 141, 255, 0.5);
  background: rgba(107, 141, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(107, 141, 255, 0.25), 0 4px 12px rgba(107, 141, 255, 0.2);
  transform: translateY(-1px);
  font-weight: 700;
}
.chip__dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: 0.95; flex: none; }

/* small informational pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--glass-3);
  background: var(--glass);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-soft);
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.pill:hover { background: var(--glass-2); border-color: var(--line-strong); }
.pill svg { width: 13px; height: 13px; opacity: 0.8; }
.pill--brand { color: var(--brand); border-color: rgba(107, 141, 255, 0.25); background: rgba(107, 141, 255, 0.08); }
.pill--hot { color: #ffa280; border-color: rgba(255, 122, 89, 0.25); background: rgba(255, 122, 89, 0.08); }
.pill--new { color: #8dedca; border-color: rgba(16, 185, 129, 0.25); background: rgba(16, 185, 129, 0.08); }

/* ------------------------------------------------- min-width: 0 for flex/grid parents ---- */
.hero__stats > * { min-width: 0; }
.spec-grid > *   { min-width: 0; }
.footer__grid > * { min-width: 0; }
.section-head    { min-width: 0; }
.card__meta      { min-width: 0; flex-wrap: wrap; }
.card__head      { min-width: 0; }
.modal__head     { min-width: 0; }
.modal__foot     { min-width: 0; }
.cta-band__actions { min-width: 0; }
.toast           { min-width: 0; }
.toast__text     { min-width: 0; }

/* ------------------------------------------------- 5. header & nav ----- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 90;
  width: 100%;
  background: rgba(10, 17, 34, 0.72);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid transparent;
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease),
    box-shadow var(--t) var(--ease), backdrop-filter var(--t) var(--ease);
}

.site-header.is-stuck {
  background: rgba(10, 17, 34, 0.88);
  -webkit-backdrop-filter: blur(20px) saturate(170%);
  backdrop-filter: blur(20px) saturate(170%);
  border-bottom-color: var(--line);
  box-shadow: 0 14px 40px rgba(3, 8, 22, 0.5);
}

.header__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: var(--header-h);
}

/* brand */
.brand { display: inline-flex; align-items: center; gap: 0.65rem; flex: none; }

.brand__mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--brand-grad);
  color: #fff;
  box-shadow: 0 8px 22px rgba(91, 140, 255, 0.45);
  transition: transform var(--t) var(--ease);
}
.brand__mark svg { width: 20px; height: 20px; }
.brand:hover .brand__mark { transform: rotate(-8deg) scale(1.06); }

.brand__text { font-weight: 800; font-size: 1.12rem; letter-spacing: -0.02em; }
.brand__text strong { font-weight: 800; }

.nav { margin-left: auto; display: flex; align-items: center; gap: 0.4rem; }

.nav__list { display: flex; align-items: center; gap: 0.25rem; }

.nav__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.95rem;
  border-radius: var(--r-pill);
  color: var(--text-soft);
  font-size: 0.93rem;
  font-weight: 600;
  transition: color var(--t) var(--ease), background var(--t) var(--ease);
}
.nav__link:hover { color: #fff; background: var(--glass-2); }

.nav__link.is-active { color: #fff; background: var(--glass-2); }
.nav__link.is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 18px;
  height: 3px;
  border-radius: 3px;
  transform: translateX(-50%);
  background: var(--brand-grad);
}

.nav__item { position: relative; }
.nav__toggle .chev { width: 14px; height: 14px; transition: transform var(--t) var(--ease); }
.nav__toggle[aria-expanded="true"] { color: #fff; background: var(--glass-2); }
.nav__toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }

/* dropdown */
.dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 262px;
  /* The panel starts flush at the item's bottom edge and uses transparent
     padding as the "hover bridge", so the cursor never crosses a dead zone
     between .nav__item and .dropdown. */
  padding-top: 12px;
  border-radius: var(--r-md);
  border: 0;
  background: rgba(12, 20, 40, 0.88);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.98);
  transform-origin: top right;
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease), visibility var(--t);
}
/* The visible glass card lives on an inner wrapper, so the transparent
   padding-top above stays part of the hoverable area. */
.dropdown > * {
  position: relative;
}
.dropdown::after {
  content: "";
  position: absolute;
  inset: 12px 0 0 0;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: rgba(12, 20, 40, 0.88);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: var(--shadow-lg);
  z-index: -1;
}
.dropdown.is-open { opacity: 1; visibility: visible; transform: none; }

/* Inner list carries the card's own padding, so the glass ::after above can
   stretch across the full hoverable box (including the 12px bridge). */
.dropdown > li { padding: 0 0.5rem; }
.dropdown > li:first-child { padding-top: 0.5rem; }
.dropdown > li:last-child { padding-bottom: 0.5rem; }

.dropdown__link {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.1rem 0.7rem;
  align-items: center;
  padding: 0.62rem 0.7rem;
  border-radius: var(--r-sm);
  transition: background var(--t) var(--ease), transform var(--t) var(--ease);
}
.dropdown__link:hover { background: var(--glass-3); transform: translateX(3px); }
.dropdown__link:active { transform: translateX(1px); }
.dropdown__link strong { font-size: 0.92rem; font-weight: 700; }
.dropdown__link small { grid-column: 2; color: var(--text-muted); font-size: 0.75rem; line-height: 1.35; }

.dropdown__dot {
  grid-row: span 2;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #fff;
  background: var(--brand-grad);
}
.dropdown__dot svg { width: 16px; height: 16px; }

/* hamburger */
.nav-toggle {
  display: none;
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--glass);
}
.nav-toggle span {
  position: absolute;
  left: 50%;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  transform: translateX(-50%);
  transition: transform var(--t) var(--ease), opacity var(--t-fast) var(--ease);
}
.nav-toggle span:nth-child(1) { top: 15px; }
.nav-toggle span:nth-child(2) { top: 21px; }
.nav-toggle span:nth-child(3) { top: 27px; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateX(-50%) translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateX(-50%) translateY(-6px) rotate(-45deg); }

/* ------------------------------------------------- 6. hero ------------- */
.hero { position: relative; padding-block: clamp(2.5rem, 7vw, 5rem) clamp(1.5rem, 4vw, 3rem); }

.hero__inner {
  display: grid;
  gap: 1.25rem;
  max-width: 860px;
}

.hero__badge {
  justify-self: start;
  animation: fadeUp 0.7s var(--ease-out) both;
}

.hero__title {
  font-size: clamp(2.1rem, 6.2vw, 4rem);
  letter-spacing: -0.035em;
  animation: fadeUp 0.7s 0.06s var(--ease-out) both;
}

.hero__lead {
  max-width: 620px;
  font-size: clamp(1rem, 1.4vw, 1.14rem);
  color: var(--text-soft);
  animation: fadeUp 0.7s 0.12s var(--ease-out) both;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.4rem;
  animation: fadeUp 0.7s 0.18s var(--ease-out) both;
}

.hero__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-top: 1.5rem;
  animation: fadeUp 0.7s 0.24s var(--ease-out) both;
}

.stat {
  padding: 1rem 1.15rem;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  transition: transform var(--t) var(--ease), border-color var(--t) var(--ease),
    background var(--t) var(--ease), box-shadow var(--t) var(--ease);
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, transparent, transparent);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity var(--t) var(--ease);
}
.stat:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
  background: var(--glass-2);
  box-shadow: var(--shadow-md);
}
.stat:hover::before {
  opacity: 1;
  background: linear-gradient(135deg, var(--brand-3), var(--brand-2), var(--brand));
}
.stat__value { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat__label { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }
.hero__trust { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: none; }
}

/* page header (apps / presets) */
.page-head { padding-block: clamp(2.5rem, 6vw, 4rem) 1rem; }
.page-head__inner { display: grid; gap: 1.1rem; max-width: 780px; }
.page-head__title { font-size: clamp(2rem, 4.8vw, 3.2rem); letter-spacing: -0.025em; line-height: 1.1; }
.page-head__lead { color: var(--text-soft); font-size: 1.05rem; line-height: 1.6; max-width: 64ch; }

/* section header */
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.section-head__text { display: grid; gap: 0.45rem; max-width: 64ch; }
.section-head__title { font-size: clamp(1.6rem, 3.4vw, 2.2rem); font-weight: 800; letter-spacing: -0.02em; color: var(--text); }
.section-head p { color: var(--text-soft); font-size: 1rem; line-height: 1.5; }

/* toolbar (search + filters) */
.toolbar {
  display: grid;
  gap: 1.15rem;
  padding: 1.15rem;
  margin-bottom: 1.8rem;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: rgba(10, 17, 36, 0.94);
}

.toolbar__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
}

.search {
  position: relative;
  flex: 1 1 260px;
  max-width: 440px;
}
.search svg {
  position: absolute;
  top: 50%;
  left: 0.95rem;
  width: 17px;
  height: 17px;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.search input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.65rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: rgba(6, 11, 24, 0.62);
  color: var(--text);
  font-size: 1rem; /* >=16px prevents iOS zoom on focus */
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease), background var(--t) var(--ease), padding-left var(--t) var(--ease);
}
.search input::placeholder { color: var(--text-muted); opacity: 0.9; }
.search:focus-within svg { color: var(--brand); transform: translateY(-50%) scale(1.1); transition: color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease-spring); }
.search input:focus { outline: none; border-color: rgba(91, 140, 255, 0.8); background: rgba(6, 11, 24, 0.85); box-shadow: 0 0 0 4px rgba(91, 140, 255, 0.2), 0 8px 24px rgba(107, 141, 255, 0.12), var(--shadow-sm); }

.result-count { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------- 7. cards ------------ */
.grid {
  display: grid;
  gap: 1.15rem;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
}
.grid--wide { grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); }

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding: 1.25rem;
  border-radius: var(--r-lg);
  border: 1px solid var(--glass-2);
  background: var(--bg-700);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  overflow: hidden;
  transition: transform var(--t) var(--ease-out), border-color var(--t) var(--ease),
    box-shadow var(--t) var(--ease), background var(--t) var(--ease);
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.card__head { display: flex; gap: 1rem; align-items: stretch; }

/* icon tile (image if provided, gradient initials otherwise) */
.tile {
  flex: none;
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-md);
  background: linear-gradient(140deg, var(--c1, var(--brand)), var(--c2, var(--brand-2)));
  box-shadow: 0 8px 18px rgba(4, 9, 26, 0.45);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  color: #fff;
  overflow: hidden;
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.tile img { width: 100%; height: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.card:hover .tile { transform: scale(1.04) rotate(-2deg); box-shadow: 0 12px 24px rgba(4, 9, 26, 0.55); }

.card__title { display: grid; justify-content: center; gap: 0.2rem; min-width: 0; }
.card__name {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* package name / subtitle */
.card__pkg {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: ui-monospace, SFMono-Regular, "Cascadia Code", Menlo, monospace;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.card__pkg svg { width: 13px; height: 13px; flex: none; opacity: 0.7; }

.card__desc {
  font-size: 0.92rem;
  color: var(--text-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.5;
  overflow: hidden;
}

/* meta rows: version / size / downloads */
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.card__foot {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 0.4rem;
}
.card__foot .btn--primary { flex: 1; }

/* preset thumbnail strip */
.thumb {
  position: relative;
  height: 116px;
  margin: -1.25rem -1.25rem 0.15rem;
  background: linear-gradient(140deg, var(--c1, #5b8cff), var(--c2, #8b5cff));
  overflow: hidden;
}
.thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 22% 28%, rgba(255, 255, 255, 0.42), transparent 42%),
    repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.14) 0 2px, transparent 2px 13px);
  opacity: 0.55;
  transition: transform var(--t-slow) var(--ease), opacity var(--t) var(--ease);
}
.card:hover .thumb::after { transform: scale(1.12) rotate(2deg); opacity: 0.75; }

.thumb__play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 1;
}
.thumb__play span {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(6, 11, 24, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.35);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #fff;
  transition: transform var(--t) var(--ease), background var(--t) var(--ease);
}
.thumb__play svg { width: 20px; height: 20px; }
.card:hover .thumb__play span { transform: scale(1.12); background: rgba(6, 11, 24, 0.6); }

.thumb__format {
  position: absolute;
  left: 1.05rem;
  bottom: 0.85rem;
  z-index: 1;
}

/* empty state */
.empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: clamp(3rem, 8vw, 5rem) 1.5rem;
  text-align: center;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--glass), transparent);
  box-shadow: inset 0 2px 20px rgba(0, 0, 0, 0.1);
}
.empty svg {
  width: 42px;
  height: 42px;
  color: var(--text-soft);
  opacity: 0.7;
  margin-bottom: 0.25rem;
  flex: none;
  animation: emptyPulse 3s var(--ease) infinite;
}
@keyframes emptyPulse {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.05); opacity: 1; }
}
.empty h3 { margin: 0; font-size: 1.25rem; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.empty p { margin: 0 auto; color: var(--text-muted); font-size: 0.95rem; max-width: 26rem; line-height: 1.6; }

@media (max-width: 640px) {
  .empty { padding: 3rem 1.25rem; border-radius: var(--r-md); }
  .empty svg { width: 36px; height: 36px; }
  .empty h3 { font-size: 1.15rem; }
  .empty p { font-size: 0.9rem; }
}

/* ------------------------------------------------- 8. modal & toast ---- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: grid;
  place-items: center;
  padding: var(--gutter);
  background: rgba(2, 5, 14, 0.75);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t) var(--ease), visibility var(--t);
}
.modal.is-open { opacity: 1; visibility: visible; }

.modal__panel {
  position: relative;
  width: min(620px, 100%);
  max-height: min(86vh, 760px);
  overflow-y: auto;
  padding: 1.8rem;
  border-radius: var(--r-xl);
  border: 1px solid var(--glass-3);
  background: linear-gradient(165deg, rgba(18, 25, 48, 0.98), rgba(9, 14, 28, 0.98));
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transform: translateY(18px) scale(0.97);
  transition: transform var(--t) var(--ease-out);
}
.modal__panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, var(--brand-3), var(--brand-2), var(--brand));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.6;
  pointer-events: none;
}
.modal.is-open .modal__panel { transform: none; }

/* ---- Part 5: Smartlink professional waiting UI ------------------------
   Subtle, non-flashing animation; layout is width-safe at 320px so the
   countdown can never introduce horizontal overflow. */
.gate__count {
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  text-align: center;
}
.gate__dial {
  position: relative;
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
}
.gate__ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.gate__ring circle { fill: none; stroke-width: 4; stroke-linecap: round; }
.gate__ring-bg { stroke: rgba(255, 255, 255, 0.1); }
.gate__ring-fg {
  stroke: url(#none);
  stroke: var(--brand-grad, #8b5cff);
  transition: stroke-dasharray 0.25s linear;
}
.gate__ring-full { opacity: 1; }
.gate__num {
  position: relative;
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.gate__status {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}
.gate__hint {
  margin: 0;
  text-align: center;
  font-size: 0.86rem;
  color: var(--text-muted);
}
.gate__progress {
  width: 100%;
  height: 5px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.gate__bar {
  display: block;
  height: 100%;
  border-radius: 9999px;
  background: var(--brand-grad);
  transition: width 0.25s linear;
}
.modal__foot .btn.is-disabled,
.modal__foot .btn[disabled] { opacity: 0.6; cursor: not-allowed; }

.modal__close {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--glass-3);
  background: var(--glass-2);
  color: var(--text-soft);
  font-size: 1.25rem;
  line-height: 1;
  transition: color var(--t) var(--ease), background var(--t) var(--ease), transform var(--t) var(--ease), border-color var(--t) var(--ease);
}
.modal__close:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.modal__close:hover { color: var(--text); background: var(--glass-3); border-color: var(--line-strong); transform: rotate(90deg); }

.modal__head { display: flex; gap: 1.1rem; align-items: center; padding-right: 3rem; }
.modal__title { font-size: 1.4rem; font-weight: 700; color: var(--text); }
.modal__sub {
  margin-top: 0.1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.modal__body { display: grid; gap: 1.2rem; margin-top: 1.4rem; }
.modal__body p { color: var(--text-soft); font-size: 0.96rem; line-height: 1.6; }

.spec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
  gap: 0.75rem;
}
.spec {
  display: grid;
  gap: 0.35rem;
  padding: 0.85rem 1rem;
  border-radius: var(--r-md);
  border: 1px solid var(--glass-2);
  background: var(--glass);
}
.spec__label {
  font-size: 0.75rem;
  line-height: 1.35;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  font-weight: 700;
}
.spec__value { font-size: 0.92rem; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }

.feature-list { display: grid; gap: 0.6rem; }
.feature-list li {
  position: relative;
  padding-left: 1.6rem;
  font-size: 0.94rem;
  color: var(--text-soft);
  line-height: 1.5;
}
.feature-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.52em;
  width: 6.5px;
  height: 6.5px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 5px rgba(107, 141, 255, 0.15);
}
.modal__foot { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 0.4rem; }

/* ---- Part 2B: preset preview state ---------------------------------- */
.preview-stage {
  display: grid;
  gap: 1.1rem;
  width: 100%;
  min-width: 0; /* never let media force horizontal overflow */
}
/* Responsive ~16:9 embed that can never overflow its container. */
.preview-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--glass-1);
  border: 1px solid var(--glass-3);
  box-shadow: var(--shadow-sm);
}
.preview-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.preview-video {
  width: 100%;
  height: auto;
  max-height: 60vh;
  border-radius: var(--r-md);
  background: var(--glass-1);
  border: 1px solid var(--glass-3);
  box-shadow: var(--shadow-sm);
}
.preview-image {
  width: 100%;
  height: auto;
  max-height: 60vh;
  object-fit: contain;
  border-radius: var(--r-md);
  border: 1px solid var(--glass-3);
  background: var(--glass-1);
  box-shadow: var(--shadow-sm);
}
.preview-empty {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--txt-mute);
  font-size: 0.95rem;
  background: var(--glass-1);
  border: 1px dashed var(--glass-3);
  border-radius: var(--r-md);
  font-style: italic;
}
.modal__foot .btn svg { width: 16px; height: 16px; margin-right: 0.1rem; flex: none; }

/* toast stack */
.toast-stack {
  position: fixed;
  right: clamp(0.8rem, 3vw, 1.5rem);
  bottom: clamp(4.4rem, 9vw, 5.6rem);
  z-index: 160;
  display: grid;
  gap: 0.6rem;
  width: min(360px, calc(100vw - 1.5rem));
  left: 50%;
  right: auto;
  transform: translateX(-50%);
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.85rem 1rem;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: rgba(14, 23, 48, 0.94);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-md);
  animation: toastIn 0.4s var(--ease-out) both;
  border-left-width: 4px;
  min-width: 0;
}
.toast__text { overflow-wrap: anywhere; word-break: break-word; min-width: 0; }
.toast.is-out { animation: toastOut 0.3s var(--ease) both; }
.toast__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--brand-grad);
  color: #fff;
}
.toast__icon svg { width: 16px; height: 16px; }
.toast--info .toast__icon { background: linear-gradient(135deg, #22d3ee, #3b82f6); }
.toast--success { border-left-color: var(--success); }
.toast--error { border-left-color: var(--danger); }
.toast--warning { border-left-color: #f59e0b; }
.toast__text strong { display: block; font-size: 0.9rem; }
.toast__text span { font-size: 0.82rem; color: var(--text-soft); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(10px) scale(0.98); }
}

/* ---------------------------------------------- 9. footer & misc ------- */
.cta-band {
  position: relative;
  display: grid;
  gap: 1.15rem;
  justify-items: center;
  text-align: center;
  padding: clamp(2.4rem, 6vw, 3.8rem);
  border-radius: var(--r-lg);
  border: 1px solid var(--glass-2);
  background:
    radial-gradient(700px 320px at 50% 0%, rgba(107, 141, 255, 0.16), transparent 70%),
    linear-gradient(160deg, var(--glass-3), var(--glass));
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  overflow: hidden;
}
.cta-band h2 { font-size: clamp(1.6rem, 3.8vw, 2.4rem); color: var(--text); }
.cta-band p { max-width: 580px; color: var(--text-soft); font-size: 1.05rem; line-height: 1.6; }
.cta-band__actions { display: flex; flex-wrap: wrap; gap: 0.8rem; justify-content: center; margin-top: 0.2rem; }

/* download tutorial embed (hidden until the settings API provides a video) */
.tutorial {
  position: relative;
  display: grid;
  gap: 0.9rem;
  justify-items: center;
  text-align: center;
  padding: clamp(2rem, 5vw, 3.2rem);
  border-radius: var(--r-lg);
  border: 1px solid var(--glass-2);
  background: linear-gradient(160deg, var(--glass-3), var(--glass));
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  overflow: hidden;
}
.tutorial h2 { font-size: clamp(1.5rem, 3.6vw, 2.2rem); color: var(--text); }
.tutorial p { max-width: 580px; color: var(--text-soft); font-size: 1.05rem; line-height: 1.6; }
.tutorial__frame {
  position: relative;
  width: min(100%, 860px);
  margin-top: 0.5rem;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #050a17;
  box-shadow: var(--shadow-md);
}
.tutorial__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
@supports not (aspect-ratio: 16 / 9) {
  .tutorial__frame { height: 0; padding-bottom: 56.25%; }
}

.site-footer {
  margin-top: clamp(3rem, 7vw, 5rem);
  border-top: 1px solid var(--glass-3);
  background: linear-gradient(180deg, var(--glass), rgba(7, 12, 28, 0.45));
}

.footer__grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  padding-block: clamp(2.5rem, 6vw, 4rem);
}
.footer__about p { margin-top: 0.8rem; color: var(--text-soft); font-size: 0.9rem; max-width: 320px; line-height: 1.6; }
.footer__col h4 {
  font-size: 0.8rem;
  line-height: 1.35;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.footer__col ul { display: grid; gap: 0.65rem; }
.footer__col a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.92rem;
  color: var(--text-soft);
  transition: color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
  border-bottom: 1px solid transparent;
}
.footer__col a svg { width: 14px; height: 14px; flex: none; opacity: 0.8; transition: opacity var(--t-fast) var(--ease); }
.footer__col a:hover { color: var(--text); transform: translateX(3px); border-bottom-color: var(--brand); }
.footer__col a:hover svg { opacity: 1; }
.footer__col a:active { transform: translateX(1px); }
.footer__col a:focus-visible { outline-offset: 4px; border-radius: 4px; }

.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.4rem;
  border-top: 1px solid var(--glass-2);
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* developer credit: "Developed by <name>" - the name links out only when a
   developer URL is configured, so it never renders as a broken link. */
.footer__credit a {
  color: var(--text-soft);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px solid var(--glass-3);
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.footer__credit a:hover {
  color: var(--text);
  border-bottom-color: var(--brand);
}

/* Part 4: developer social links (Facebook / Telegram / WhatsApp). Only links
   with a configured https URL are rendered; the group hides itself otherwise. */
.footer__dev-social {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.footer__dev-social a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-soft);
  text-decoration: none;
  border: 1px solid var(--glass-3);
  border-radius: var(--r-sm);
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  line-height: 1.35;
  font-weight: 600;
  background: var(--glass);
  transition: color var(--t) var(--ease), background var(--t) var(--ease), border-color var(--t) var(--ease);
}
.footer__dev-social a svg { width: 14px; height: 14px; flex: none; opacity: 0.9; }
.footer__dev-social a:hover {
  color: var(--text);
  background: var(--glass-2);
  border-color: var(--line-strong);
}
.footer__dev-social a:focus-visible { outline: 2px solid var(--brand-3); outline-offset: 2px; border-radius: var(--r-sm); }

/* back to top */
.to-top {
  position: fixed;
  right: clamp(0.8rem, 3vw, 1.5rem);
  bottom: clamp(0.8rem, 3vw, 1.5rem);
  z-index: 120;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: rgba(14, 23, 48, 0.85);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: var(--text);
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease), visibility var(--t),
    background var(--t) var(--ease), border-color var(--t) var(--ease), color var(--t-fast) var(--ease);
}
.to-top svg { width: 18px; height: 18px; transition: transform var(--t-fast) var(--ease-spring); }
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { background: var(--brand-grad); border-color: transparent; color: #fff; transform: translateY(-3px); }
.to-top:hover svg { transform: translateY(-2px); }
.to-top:active { transform: translateY(-1px); }
.to-top:focus-visible { outline: 2px solid var(--brand-3); outline-offset: 3px; }

/* mobile bottom navigation - hidden on desktop */
.mobile-bottom-nav {
  display: none;
}

/* reveal on scroll */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}
.reveal.is-in { opacity: 1; transform: none; }

/* ================================================ 10. responsive (mobile-first) ===== */
/* ========================================== Smooth wrap transition (901px–1180px) ====== */
@media (max-width: 1180px) and (min-width: 901px) {
  .wrap { max-width: 100%; padding-inline: var(--gutter); }
}

/* ========================================== Tablet & Medium Screens (≤ 900px) ====== */

/* ========================================== Tablet & Medium Screens (≤ 900px) ====== */
@media (max-width: 900px) {
  /* Navigation transforms to mobile drawer */
  .nav-toggle { display: block; margin-left: auto; }

  .nav {
    position: fixed;
    top: var(--header-h);
    right: 0;
    left: 0;
    display: block;
    margin: 0;
    padding: 1.25rem var(--gutter) 2rem;
    max-height: calc(100dvh - var(--header-h));
    overflow-y: auto;
    border-bottom: 1px solid var(--line);
    background: rgba(9, 15, 32, 0.97);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-14px);
    transition: opacity var(--t) var(--ease), transform var(--t) var(--ease), visibility var(--t);
  }
  .nav.is-open { opacity: 1; visibility: visible; transform: none; }

  .nav__list { flex-direction: column; align-items: stretch; gap: 0.4rem; }
  .nav__item { width: 100%; }
  .nav__link {
    width: 100%;
    justify-content: space-between;
    padding: 0.85rem 1.15rem;
    border-radius: var(--r-sm);
    font-size: 1.05rem;
  }
  .nav__link.is-active { box-shadow: inset 0 0 0 1px var(--line); }
  .nav__link.is-active::after { display: none; }
.nav__link { min-height: 44px; }

  /* Dropdown becomes accordion inside mobile drawer */
  .dropdown {
    position: static;
    display: none;
    min-width: 0;
    margin: 0.2rem 0 0.5rem 0.5rem;
    padding: 0 0 0 0.5rem;
    border: 0;
    border-left: 1px solid var(--line);
    background: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
  }
  .dropdown::after { display: none; }
  .dropdown > li, .dropdown > li:first-child, .dropdown > li:last-child { padding: 0; }
  .dropdown.is-open { display: block; transform: none; }
  .dropdown__link { padding: 0.7rem 0.85rem; }
  .dropdown__link:hover { transform: none; background: var(--glass-2); }
  .dropdown__link strong { font-size: 0.94rem; }
  .dropdown__link small { font-size: 0.78rem; }
  
  /* Improve grid responsiveness */
  .grid { 
    gap: 1rem; 
    grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); 
  }
  .grid--wide { 
    grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); 
  }
  
  /* Better stats layout */
  .hero__stats { 
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); 
    gap: 0.85rem; 
  }
  
  /* Modal improvements */
  .modal__panel { 
    width: min(580px, 100%); 
    padding: 1.5rem; 
  }
  
  /* Toolbar stacking */
  .toolbar__row { 
    flex-direction: column; 
    flex-wrap: nowrap;
    align-items: stretch; 
  }
  .search { 
    max-width: none; 
    flex: none;
    width: 100%; 
  }
  .result-count { 
    align-self: flex-start; 
  }
  
  /* Section improvements */
  .section { 
    padding-block: clamp(2.5rem, 6vw, 5rem); 
  }
  .section--tight { 
    padding-block: clamp(2rem, 4vw, 3.5rem); 
  }
}

/* ========================================== Mobile Phones (≤ 640px) ================ */
@media (max-width: 640px) {
  /* Root adjustments for mobile */
  :root { 
    --header-h: 66px; 
    --gutter: clamp(1rem, 3.5vw, 1.5rem); 
  }
  
  /* Compact header for mobile */
  .site-header .header__inner {
    justify-content: center;
    position: relative;
  }
  .site-header .brand {
    margin: 0 auto;
  }
  .site-header .brand__mark {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
    border-radius: 0;
  }
  .site-header #navToggle {
    display: none;
  }
  .brand__text { font-size: 1.05rem; }
  .brand__mark { width: 34px; height: 34px; border-radius: 10px; }
  .brand__mark svg { width: 18px; height: 18px; }

  /* Hero section mobile optimization */
  .hero { padding-block: clamp(2rem, 6vw, 3.5rem) clamp(1.5rem, 4vw, 2.5rem); }
  .hero__title { 
    font-size: clamp(1.85rem, 7.5vw, 2.5rem); 
    line-height: 1.2; 
  }
  .hero__lead { 
    font-size: clamp(0.95rem, 1.2vw, 1.05rem); 
    line-height: 1.65; 
  }
  .hero__actions { 
    flex-direction: column; 
    flex-wrap: nowrap;
    gap: 0.7rem; 
    width: 100%; 
  }
  .hero__actions .btn { 
    flex: none; 
    width: 100%; 
    justify-content: center; 
    padding: 0.85rem 1.5rem; 
    font-size: 0.96rem; 
  }
  .hero__stats { 
    grid-template-columns: 1fr; 
    gap: 0.7rem; 
  }
  .stat { 
    padding: 0.95rem 1rem; 
    text-align: center; 
  }
  
.page-head__title {
    font-size: clamp(1.75rem, 6.5vw, 2.4rem);
    line-height: 1.2;
  }

  /* Touch targets - ensure 44px minimum */
  .btn { min-height: 44px; padding: 0.75rem 1.25rem; }
  .chip { min-height: 40px; padding: 0.55rem 1rem; }
  input[type="search"], input[type="text"], input[type="url"],
  input[type="email"], input[type="password"], select, textarea
  { min-height: 44px; padding: 0.7rem 1rem; font-size: 1rem; /* >=16px prevents iOS zoom on focus */ }
  .modal__close { width: 44px; height: 44px; }
  .page-head__lead { 
    font-size: 0.96rem; 
    line-height: 1.7; 
  }

  /* Section headers stack better */
  .section-head { 
    align-items: flex-start; 
    flex-direction: column; 
    flex-wrap: nowrap;
    gap: 1rem; 
  }
  .section-head__text { gap: 0.35rem; }
  .section-head__title { 
    font-size: clamp(1.5rem, 5.5vw, 2rem); 
  }
  
  /* Toolbar mobile optimization */
  .toolbar { 
    padding: 1rem; 
    gap: 1rem; 
    margin-bottom: 1.5rem; 
  }
  .toolbar__row { 
    gap: 0.85rem; 
    flex-direction: column; 
    flex-wrap: nowrap;
  }
  .search { 
    flex: none;
    width: 100%;
    max-width: none; 
  }
  .search input { 
    padding: 0.8rem 1rem 0.8rem 2.7rem; 
    font-size: 0.95rem; 
  }
  .search svg { 
    width: 16px; 
    height: 16px; 
    left: 0.95rem; 
  }
  .result-count { 
    font-size: 0.85rem; 
    width: 100%; 
  }
  
  /* Chips/filters mobile friendly */
  .chip { 
    max-width: 100%; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    white-space: nowrap; 
    padding: 0.55rem 1.1rem; 
    font-size: 0.89rem; 
    justify-content: center; 
  }
  .chip-row { 
    gap: 0.65rem; 
    justify-content: center; 
  }
.chip-row { min-width: 0; }
  /* Allow chips to wrap on mobile */
  .chip { white-space: normal; word-break: break-word; max-width: 100%; }

  /* Cards mobile optimization */
  .grid { 
    gap: 1rem; 
    grid-template-columns: 1fr; 
  }
  .grid--wide { 
    grid-template-columns: 1fr; 
  }
  
  .card { 
    padding: 1.15rem; 
    border-radius: var(--r-md); 
  }
  .card__head { 
    gap: 0.9rem; 
  }
  .card__title { 
    min-width: 0; 
  }
  .card__name { 
    font-size: 1.05rem; 
    word-break: break-word; 
  }
  .card__meta { 
    font-size: 0.82rem; 
  }
  .card__desc { 
    font-size: 0.88rem; 
    line-height: 1.6; 
    -webkit-line-clamp: 4; 
    line-clamp: 4; 
  }
  .card__foot {
    flex-wrap: nowrap;
    gap: 0.5rem;
    align-items: center;
  }
  .card__foot .btn--primary {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    justify-content: center;
  }
  .card__foot .btn--icon {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    min-width: 44px;
    padding: 0;
    border-radius: 50%;
    justify-content: center;
    align-items: center;
  }
  
  /* Thumbnails & tiles mobile sizing */
  .thumb { 
    height: 110px; 
    margin: -1.15rem -1.15rem 0.2rem; 
    border-radius: var(--r-md) var(--r-md) 0 0; 
  }
  .tile { 
    width: 50px; 
    height: 50px; 
    border-radius: 14px; 
    font-size: 0.96rem; 
  }

  /* Pills mobile sizing */
  .pill { 
    font-size: 0.72rem; 
    padding: 0.32rem 0.7rem; 
  }
  .pill svg { 
    width: 12px; 
    height: 12px; 
  }

  /* Modal mobile optimization */
  .modal { 
    padding: 1rem; 
  }
  .modal__panel { 
    padding: 1.3rem; 
    border-radius: var(--r-lg); 
    max-height: 92vh; 
    width: 100%; 
  }
  .modal__head { 
    flex-direction: column; 
    align-items: flex-start; 
    gap: 0.7rem; 
  }
  .modal__title { 
    font-size: 1.3rem; 
  }
  .modal__body { 
    padding: 1rem 0; 
  }
  .modal__foot { 
    flex-wrap: wrap; 
    gap: 0.65rem; 
  }
  .modal__foot .btn { 
    flex: 1 1 100%; 
    width: 100%; 
    justify-content: center; 
  }
  
  /* Detail modal improvements */
  .detail__meta { 
    flex-wrap: wrap; 
    gap: 0.6rem; 
  }
  .detail__info { 
    grid-template-columns: 1fr; 
    gap: 0.85rem; 
  }
  
  /* Footer mobile optimization */
  .footer { 
    padding-block: 3rem 2rem; 
  }
  .footer__grid { 
    gap: 2rem; 
    grid-template-columns: 1fr; 
  }
  .footer__col { 
    text-align: left; 
  }
  .footer__bottom { 
    flex-direction: column; 
    flex-wrap: nowrap;
    align-items: flex-start; 
    gap: 0.85rem; 
    text-align: left; 
  }
  .footer__links { 
    flex-wrap: wrap; 
    gap: 1rem; 
  }
  
  /* Bottom spacing for fixed navigation bar */
  body {
    padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
  }

  /* Scroll to top button - positioned safely above mobile bottom nav */
  .to-top { 
    width: 44px; 
    height: 44px; 
    right: 1rem; 
    bottom: calc(64px + env(safe-area-inset-bottom, 0px) + 0.65rem); 
  }

  /* Fixed Mobile Bottom Navigation Bar */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 85;
    align-items: stretch;
    justify-content: space-around;
    height: calc(58px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(8, 14, 30, 0.94);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border-top: 1px solid var(--line);
    box-shadow: 0 -6px 20px rgba(3, 8, 22, 0.45);
  }

  .mobile-bottom-nav__item {
    flex: 1 1 0;
    min-width: 0;
    min-height: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 2px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
  }

  .mobile-bottom-nav__item svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    opacity: 0.82;
    transition: transform var(--t-fast) var(--ease-spring), opacity var(--t-fast) var(--ease), stroke var(--t-fast) var(--ease);
  }

  .mobile-bottom-nav__item span {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .mobile-bottom-nav__item:hover,
  .mobile-bottom-nav__item:focus-visible {
    color: var(--text);
  }

  .mobile-bottom-nav__item:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: -2px;
    border-radius: var(--r-sm);
  }

  .mobile-bottom-nav__item.is-active,
  .mobile-bottom-nav__item[aria-current="page"] {
    color: var(--brand);
    font-weight: 600;
  }

  .mobile-bottom-nav__item.is-active svg,
  .mobile-bottom-nav__item[aria-current="page"] svg {
    opacity: 1;
    stroke: var(--brand);
    transform: scale(1.08);
  }

  body.has-modal-open .mobile-bottom-nav,
  body.modal-is-open .mobile-bottom-nav {
    display: none !important;
  }

  /* Ad slots mobile sizing */
  .ad-slot-wrap { 
    padding-block: 0.85rem; 
  }
  
  /* CTA band mobile */
  .cta-band { 
    padding: 2rem 1.5rem; 
    text-align: center; 
  }
  .cta-band__inner { 
    gap: 1.2rem; 
  }
  .cta-band__title { 
    font-size: clamp(1.4rem, 5vw, 1.8rem); 
  }
  .cta-band .btn { 
    width: 100%; 
    justify-content: center; 
  }
  
  /* Tutorial section mobile */
  .tutorial { 
    padding: 1.5rem; 
  }
  .tutorial__title { 
    font-size: 1.15rem; 
  }
}

/* ========================================== Small Mobile (≤ 480px) ================= */
@media (max-width: 480px) {
  /* Extra compact spacing */
  :root { 
    --header-h: 62px; 
    --gutter: 1rem; 
  }
  
  /* Ultra-compact header */
  .brand__text { 
    font-size: 1rem; 
  }
  .brand__mark { 
    width: 32px; 
    height: 32px; 
  }
  
  /* Hero ultra-compact */
  .hero__title { 
    font-size: clamp(1.65rem, 7vw, 2.2rem); 
  }
  .hero__badge { 
    font-size: 0.7rem; 
    padding: 0.28rem 0.65rem; 
  }
  
  /* Page titles smaller */
  .page-head__title { 
    font-size: clamp(1.6rem, 6vw, 2.1rem); 
  }
  
  /* Section headers ultra-compact */
  .section-head__title { 
    font-size: clamp(1.35rem, 5vw, 1.75rem); 
  }
  
  /* Cards ultra-compact */
  .card { 
    padding: 1rem; 
  }
  .card__name { 
    font-size: 1rem; 
  }
  .card__desc { 
    -webkit-line-clamp: 3; 
    line-clamp: 3; 
    font-size: 0.86rem; 
  }
  .tile { 
    width: 46px; 
    height: 46px; 
    font-size: 0.9rem; 
  }
  
  /* Buttons ultra-compact - maintain 44px min-height */
  .btn {
    padding: 0.7rem 1.15rem;
    font-size: 0.88rem;
    min-height: 44px;
  }
  .btn svg { 
    width: 16px; 
    height: 16px; 
  }
  
  /* Chips ultra-compact */
  .chip { 
    padding: 0.48rem 0.95rem; 
    font-size: 0.84rem; 
  }
  .chip-row { 
    gap: 0.55rem; 
  }

  /* Search ultra-compact - keep font-size >=16px to prevent iOS zoom */
  .search input { 
    padding: 0.7rem 0.9rem 0.7rem 2.5rem; 
    font-size: 1rem; 
  }
  .search svg { 
    width: 15px; 
    height: 15px; 
    left: 0.85rem; 
  }
  .result-count { 
    font-size: 0.82rem; 
  }
  
  /* Form inputs - keep font-size >=16px to prevent iOS zoom on focus */
  input[type="search"], input[type="text"], input[type="url"],
  input[type="email"], input[type="password"], select, textarea {
    font-size: 1rem;
  }
  
  /* Modal ultra-compact */
  .modal__panel { 
    padding: 1.15rem; 
  }
  .modal__title { 
    font-size: 1.2rem; 
  }
  
  /* Stats single column */
  .hero__stats { 
    grid-template-columns: 1fr; 
  }
}

/* ========================================== Tiny Screens (≤ 360px) ================= */
@media (max-width: 360px) {
  /* Absolute minimum spacing */
  :root { 
    --gutter: 0.85rem; 
  }
  
  .hero__title { 
    font-size: 1.55rem; 
  }
  .page-head__title { 
    font-size: 1.5rem; 
  }
  .section-head__title { 
    font-size: 1.3rem; 
  }
  
  .card { 
    padding: 0.9rem; 
  }
/* Buttons ultra-compact - maintain 44px min-height */
  .btn {
    padding: 0.65rem 1rem;
    font-size: 0.86rem;
    min-height: 44px;
  }
  .card__name { 
    font-size: 0.96rem; 
  }
  .tile { 
    width: 42px; 
    height: 42px; 
  }
  
  /* Form inputs - keep font-size >=16px to prevent iOS zoom on focus */
  input[type="search"], input[type="text"], input[type="url"],
  input[type="email"], input[type="password"], select, textarea {
    font-size: 1rem;
  }
  
  .chip { 
    padding: 0.45rem 0.85rem; 
    font-size: 0.82rem; 
  }
  .spec-grid {
    grid-template-columns: 1fr;
  }
  .mobile-bottom-nav__item span {
    font-size: 0.75rem;
    line-height: 1.3;
  }
}


/* --------------------------------------- motion & contrast preferences -- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .reveal { opacity: 1; transform: none; }
}

/* fall back to solid-ish panels when backdrop blur is unsupported */
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .card, .toolbar, .stat, .cta-band, .tutorial, .dropdown, .modal__panel, .toast, .to-top, .site-header, .site-header.is-stuck, .mobile-bottom-nav {
    background-color: rgba(14, 23, 48, 0.94);
  }
}









/* ------------------------------------------------ ad placements (public) --
   Containers are declared hidden in the markup and are only unhidden by
   js/ads.js when it actually injects a configured advertisement, so an empty
   or disabled placement never reserves space. Banners are constrained to the
   container width so 728x90 / 970x250 can never force horizontal scrolling. */
.ad-slot-wrap {
  padding-block: 1rem;
  text-align: center;
}

.ad-slot-wrap[hidden] { display: none !important; }

/* API stats: hide completely until JS reveals them (approval: TRUST-01). */
#heroApiStats[hidden] { display: none !important; }

.ad-slot__item {
  display: block;
  max-width: 100%;
  margin-inline: auto;
  overflow: hidden;
}

/* Provider iframes / images must never overflow the viewport. */
.ad-slot__item iframe,
.ad-slot__item img,
.ad-slot__item ins,
.ad-slot__item canvas,
.ad-slot__item video,
.ad-slot__item > div {
  max-width: 100%;
}

.ad-slot__item img {
  height: auto;
  display: block;
  margin-inline: auto;
}

/* ==========================================================================
   More Page — Category Management System
   Preset-like chip filter row + enhanced item cards
   ========================================================================== */

/* ------------------------------------------------ More category chips ----- */
.chip.is-active[style*="--chip-active-color"] {
  border-color: rgba(107, 141, 255, 0.5);
  background: rgba(107, 141, 255, 0.12);
}

/* ------------------------------------------------ More card design --------- */
.more-card {
  position: relative;
  overflow: hidden;
  border-top: none;
}

.more-card__accent-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--more-cat-color, var(--brand));
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  opacity: 0.85;
  transition: opacity var(--t) var(--ease), height var(--t) var(--ease);
}
.more-card:hover .more-card__accent-bar { opacity: 1; height: 4px; }

.more-card::before {
  background: radial-gradient(circle, var(--more-cat-color, var(--brand)) 0%, transparent 68%);
}

.more-card__head {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: nowrap;
}

.more-card__icon-wrap {
  flex: none;
  width: 54px; height: 54px;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(4,9,26,0.42);
}

.more-card__icon {
  width: 100%; height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover; display: block;
}

.more-card__icon-fallback {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  font-size: 1.2rem; font-weight: 800;
  letter-spacing: -0.02em; color: #fff;
  background: linear-gradient(135deg,
    var(--more-cat-color, var(--brand)) 0%,
    var(--brand-2) 100%);
}

/* Category badge — colored dot + label */
.more-cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.3rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--r-pill);
  font-size: 0.75rem;
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--more-cat-color, var(--brand));
  background: rgba(107, 141, 255, 0.1);
  border: 1px solid rgba(107, 141, 255, 0.25);
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.more-card:hover .more-cat-badge {
  background: rgba(107, 141, 255, 0.16);
  border-color: rgba(107, 141, 255, 0.38);
}

.more-cat-badge__dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none; opacity: 0.9;
}

.more-card__feat {
  margin-left: auto;
  flex: none;
  align-self: flex-start;
}

.more-card__cta {
  flex: 1 1 auto;
  justify-content: center;
  text-align: center;
  max-width: 160px;
}

/* ------------------------------------------------ More hero meta ----------- */
.more-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.1rem;
}

.more-hero-meta__tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.38rem 0.85rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--glass-3);
  background: var(--glass);
  font-size: 0.8rem; font-weight: 700;
  color: var(--text-soft);
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
  cursor: pointer;
}
.more-hero-meta__tag:hover {
  background: var(--glass-2);
  border-color: var(--line-strong);
  color: #fff;
}

.more-hero-meta__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex: none;
}

/* ------------------------------------------------ Responsive -------------- */
@media (max-width: 640px) {
  .more-card__icon-wrap { width: 46px; height: 46px; }
  .more-cat-badge { font-size: 0.75rem; line-height: 1.35; padding: 0.2rem 0.5rem; }
  .more-card__cta { max-width: 100%; }
}

@media (max-width: 390px) {
  .more-card__head { flex-wrap: wrap; }
  .more-card__feat { margin-left: 0; margin-top: 0.4rem; }
}


