:root {
  --bg: #070A29;
  --bg-2: #0a0e38;
  --surface: rgba(255, 255, 255, .04);
  --surface-2: rgba(255, 255, 255, .07);
  --border: rgba(173, 138, 254, .20);
  --border-strong: rgba(173, 138, 254, .34);
  --accent: #6131F9;
  --accent-2: #B694FF;
  --accent-ink: #AD8AFE;
  --accent-soft: rgba(97, 49, 249, .15);
  --grad: linear-gradient(91.99deg, #7347F5 1.68%, #FBCDFF 68.97%);
  --grad2: linear-gradient(90deg, #6131F9 0%, #B694FF 100%);
  --text: #C4C0E0;
  --strong: #ffffff;
  --muted: #8B88B8;
  --gold: #fbbf24;
  --green: #22C55E;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 2px 10px rgba(0, 0, 0, .22);
  --shadow-md: 0 20px 46px rgba(97, 49, 249, .30);
  --maxw: 1180px;
  --font: 'Inter', 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(7, 10, 41, .72);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 66px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 11px;
  background: var(--grad2); background-size: 200% 200%;
  color: #fff; font-weight: 800; font-size: 15px; letter-spacing: .5px;
  box-shadow: 0 6px 18px rgba(97, 49, 249, .45);
  animation: gradShift 5s ease infinite;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 16px; letter-spacing: .2px; color: var(--strong); }
.brand-text small { font-size: 12px; color: var(--muted); }
.header-nav { display: flex; align-items: center; gap: 22px; font-size: 14.5px; font-weight: 500; }
.header-nav a:hover { color: var(--accent-ink); }
.btn-ghost {
  border: 1px solid var(--border); padding: 8px 14px; border-radius: 10px;
  color: var(--muted) !important; transition: .18s;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-ink) !important; background: var(--accent-soft); }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  padding: 76px 0 54px;
  background:
    radial-gradient(1200px 420px at 80% -10%, rgba(97, 49, 249, .38), transparent 60%),
    radial-gradient(900px 340px at 0% 0%, rgba(183, 148, 255, .12), transparent 55%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
  border-bottom: 1px solid var(--border);
}
.eyebrow {
  display: inline-block; margin: 0 0 14px;
  font-size: 13px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase;
  color: var(--accent-ink); background: var(--accent-soft);
  border: 1px solid var(--border);
  padding: 6px 12px; border-radius: 999px;
}
.hero h1 { margin: 0 0 14px; font-size: clamp(28px, 4.4vw, 46px); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; color: var(--strong); }
.hero .lead { margin: 0 0 28px; max-width: 660px; font-size: clamp(15px, 1.6vw, 18px); color: var(--text); }

.search-wrap { position: relative; max-width: 560px; }
.search-ic { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
#search {
  width: 100%; padding: 15px 18px 15px 46px;
  font-size: 16px; font-family: inherit; color: var(--strong);
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-sm); transition: .18s;
}
#search::placeholder { color: var(--muted); }
#search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(97, 49, 249, .22); }

.hero-stats { display: flex; gap: 28px; margin-top: 26px; flex-wrap: wrap; }
.hero-stats .stat strong { display: block; font-size: 22px; font-weight: 800; color: var(--accent-ink); }
.hero-stats .stat span { font-size: 13px; color: var(--muted); }

/* ---------- Filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin: 36px 0 8px; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 9px 16px; border-radius: 999px; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: .16s; font-family: inherit;
}
.chip:hover { border-color: var(--accent); color: var(--accent-ink); }
.chip.active { background: var(--grad2); border-color: transparent; color: #fff; box-shadow: 0 8px 20px rgba(97, 49, 249, .35); }

/* ---------- Catalog ---------- */
.catalog { padding: 14px 0 10px; }
.group { margin: 30px 0 8px; }
.group-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.group-head h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.01em; color: var(--strong); }
.group-head p { margin: 0; font-size: 14px; color: var(--muted); }
.group-count { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.card {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-sm);
  transition: transform .28s cubic-bezier(.2, .7, .2, 1), box-shadow .28s ease, border-color .28s ease;
}
.card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: var(--grad2); border-radius: var(--radius) var(--radius) 0 0;
  transform: scaleX(0); transform-origin: center; opacity: 0;
  transition: transform .3s ease, opacity .3s ease;
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); border-color: var(--accent); }
.card:hover::before { transform: scaleX(1); opacity: 1; }
.card-ic {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent-ink); border: 1px solid var(--border);
  margin-bottom: 14px;
}
.card-ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.card h3 { margin: 0 0 7px; font-size: 16.5px; font-weight: 700; letter-spacing: -.01em; color: var(--strong); }
.card p { margin: 0 0 18px; font-size: 13.6px; color: var(--muted); flex: 1; }
.card-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  cursor: pointer; transition: .16s; font-family: inherit;
}
.btn:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: var(--grad2); border-color: transparent; color: #fff; }
.btn-primary:hover { filter: brightness(1.08); background: var(--grad2); border-color: transparent; color: #fff; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-icon { padding: 9px; }
.btn-preview { flex: 1; justify-content: center; }

.empty { text-align: center; color: var(--muted); padding: 50px 0; font-size: 15px; }

/* ---------- CTA ---------- */
.cta { margin: 56px 0 0; padding: 16px 0 64px; }
.cta-inner {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 28px; flex-wrap: wrap;
  background:
    radial-gradient(120% 160% at 85% -30%, rgba(183, 148, 255, .45), transparent 60%),
    linear-gradient(135deg, #4f27cf, #6131F9 55%, #7c52ff);
  color: #fff; border: 1px solid var(--border-strong);
  border-radius: 22px; padding: 38px 40px; box-shadow: var(--shadow-md);
}
.cta-text h2 { margin: 0 0 8px; font-size: clamp(20px, 2.6vw, 27px); font-weight: 800; }
.cta-text p { margin: 0; max-width: 520px; color: rgba(255, 255, 255, .86); font-size: 15px; }
.cta-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.cta-actions a {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 20px; border-radius: 12px; font-weight: 600; font-size: 15px;
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .28); color: #fff;
  backdrop-filter: blur(4px); transition: .16s;
}
.cta-actions a:hover { background: #fff; color: var(--accent); border-color: #fff; }
.cta-actions a.primary { background: var(--gold); border-color: var(--gold); color: #20160a; }
.cta-actions a.primary:hover { filter: brightness(1.06); color: #20160a; }
.cta-actions svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Footer ---------- */
.site-footer { background: #05071d; color: var(--text); padding: 44px 0; font-size: 14px; border-top: 1px solid var(--border); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 24px 60px; justify-content: space-between; }
.footer-inner strong { color: #fff; }
.foot-col { max-width: 360px; }
.foot-col h4 { margin: 0 0 10px; color: #fff; font-size: 15px; }
.foot-col p { margin: 4px 0; color: var(--muted); }
.foot-col a:hover { color: var(--accent-ink); }
.foot-meta { width: 100%; border-top: 1px solid var(--border); padding-top: 16px; margin-top: 6px; font-size: 12.5px; color: var(--muted); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(4, 6, 22, .72); backdrop-filter: blur(4px); animation: fade .2s ease; }
.modal-card {
  position: relative; width: min(920px, 100%); height: min(88vh, 1000px);
  background: var(--bg-2); border: 1px solid var(--border-strong);
  border-radius: 16px; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55); animation: pop .22s ease;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 700; color: var(--strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-head-actions { display: flex; align-items: center; gap: 8px; }
.modal-close { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; transition: .16s; }
.modal-close:hover { background: rgba(192, 57, 43, .18); border-color: rgba(240, 130, 130, .5); color: #ff8585; }
.modal-body { flex: 1; background: #525659; }
#modal-frame { width: 100%; height: 100%; border: 0; display: block; }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } }
@keyframes gradShift { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: #161a40; color: #fff; border: 1px solid var(--border-strong);
  padding: 12px 20px; border-radius: 12px;
  font-size: 14px; font-weight: 500; box-shadow: var(--shadow-md);
  opacity: 0; pointer-events: none; transition: .25s; z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 680px) {
  .header-nav a:not(.btn-ghost) { display: none; }
  .hero { padding: 48px 0 36px; }
  .cta-inner { padding: 28px 24px; }
  .grid { grid-template-columns: 1fr; }
  .modal { padding: 0; }
  .modal-card { width: 100%; height: 100%; border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .brand-mark { animation: none; }
  .card { transition: border-color .2s ease; }
  .card:hover { transform: none; }
}
