:root {
  --bg: #f6f7fb;
  --bg-2: #eef1f8;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --ink: #0f1626;
  --ink-2: #4b5670;
  --ink-3: #7a849b;
  --rule: #e3e7f0;
  --brand: #4a6cf7;
  --brand-ink: #ffffff;
  --brand-soft: #e9eeff;
  --brand-text: #3653d6;
  --ok: #12a37a;
  --ok-soft: #e3f6ef;
  --warn-soft: #fff4dc;
  --warn-ink: #8a5a00;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 8px 24px -8px rgba(16, 24, 40, .14), 0 2px 6px rgba(16, 24, 40, .05);
  --shadow-lg: 0 24px 64px -16px rgba(16, 24, 40, .28);
  --radius: 20px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f1a;
    --bg-2: #0f1524;
    --surface: #131a2b;
    --surface-2: #182136;
    --ink: #eef1f8;
    --ink-2: #b4bdd2;
    --ink-3: #8590aa;
    --rule: #242e46;
    --brand: #6f8bff;
    --brand-ink: #0b0f1a;
    --brand-soft: #1c2747;
    --brand-text: #9db0ff;
    --ok: #3fd3a6;
    --ok-soft: #10302a;
    --warn-soft: #33290f;
    --warn-ink: #f2c46b;
    --shadow-md: 0 8px 24px -8px rgba(0, 0, 0, .5);
    --shadow-lg: 0 24px 64px -16px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
body.locked { overflow: hidden; }
img { display: block; max-width: 100%; }
a { color: var(--brand-text); }
h1, h2, h3 { line-height: 1.15; letter-spacing: -.02em; margin: 0; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .wrap { padding: 0 24px; } }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 12px; z-index: 50; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 10px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--rule) 70%, transparent);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 18px; letter-spacing: -.02em; }
.topnav { display: flex; gap: 4px; }
.topnav a { color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 15px; padding: 8px 12px; border-radius: 10px; }
.topnav a:hover { background: var(--bg-2); color: var(--ink); }

/* Hero */
.hero {
  position: relative; overflow: hidden;
  padding: 72px 0 56px;
  background:
    radial-gradient(60% 80% at 15% 0%, color-mix(in srgb, var(--brand) 16%, transparent), transparent 70%),
    radial-gradient(50% 70% at 95% 10%, color-mix(in srgb, #22b8cf 14%, transparent), transparent 70%);
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(var(--rule) 1px, transparent 1px), linear-gradient(90deg, var(--rule) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(70% 60% at 50% 0%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(70% 60% at 50% 0%, #000 20%, transparent 75%);
  opacity: .5;
}
.hero .wrap { position: relative; z-index: 1; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 0 0 20px; padding: 6px 12px 6px 10px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 999px;
  font-size: 13px; font-weight: 600; color: var(--ink-2); box-shadow: var(--shadow-sm);
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.hero h1 { font-size: clamp(36px, 7vw, 64px); font-weight: 800; max-width: 16ch; }
.lede { font-size: clamp(17px, 2.2vw, 20px); color: var(--ink-2); max-width: 54ch; margin: 18px 0 28px; }
.br-wide { display: none; }
@media (min-width: 720px) { .br-wide { display: inline; } .hero { padding: 104px 0 80px; } }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px;
  font: 600 15px/1.2 var(--font); text-decoration: none; white-space: nowrap;
  border-radius: 12px; border: 1px solid transparent; cursor: pointer;
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-lg { min-height: 52px; padding: 14px 24px; font-size: 16px; border-radius: 14px; }
.btn-primary { background: var(--brand); color: var(--brand-ink); box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--brand) 70%, transparent); }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 88%, #000); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--rule); }
.btn-ghost:hover { border-color: color-mix(in srgb, var(--ink-3) 60%, var(--rule)); background: var(--surface-2); }
.btn svg { width: 18px; height: 18px; flex: none; }

/* Apps grid */
.apps-section { padding: 16px 0 88px; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.section-head h2 { font-size: 24px; font-weight: 800; }
.filters { display: flex; gap: 6px; padding: 4px; background: var(--bg-2); border-radius: 12px; }
.chip { font: 600 14px/1 var(--font); color: var(--ink-2); background: transparent; border: 0; padding: 9px 14px; border-radius: 9px; cursor: pointer; }
.chip.is-on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 20px; } }
.grid > li[hidden] { display: none; }

.card {
  position: relative; height: 100%;
  display: flex; flex-direction: column; gap: 16px;
  padding: 22px; background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  animation: rise .5s both;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--accent) 35%, var(--rule)); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.card-top { display: flex; gap: 16px; align-items: flex-start; }
.app-icon {
  width: 64px; height: 64px; flex: none; border-radius: 16px; overflow: hidden;
  box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--accent) 60%, transparent), inset 0 0 0 1px rgba(0,0,0,.06);
  background: var(--surface-2);
}
.app-icon img { width: 100%; height: 100%; object-fit: cover; }
.card h3 { font-size: 19px; font-weight: 700; }
.card .tagline { margin: 6px 0 0; color: var(--ink-2); font-size: 15px; line-height: 1.5; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; line-height: 1;
  padding: 5px 8px; border-radius: 999px;
  background: var(--bg-2); color: var(--ink-2);
}
.badge svg { width: 12px; height: 12px; }
.badge-beta { background: var(--ok-soft); color: var(--ok); }
.badge-soon { background: var(--warn-soft); color: var(--warn-ink); }
.card-actions { margin-top: auto; display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }

/* Detail sheet */
.sheet {
  padding: 0; border: 0; color: var(--ink); background: var(--surface);
  width: min(680px, 100% - 32px); max-height: min(88vh, 900px);
  border-radius: 24px; box-shadow: var(--shadow-lg); overflow: hidden;
}
.sheet::backdrop { background: rgba(8, 12, 22, .55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.sheet[open] { animation: pop .22s cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column; }
.sheet[open]::backdrop { animation: fade .22s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes fade { from { opacity: 0; } }
@media (max-width: 639px) {
  .sheet { width: 100%; max-width: 100%; max-height: 92dvh; margin: auto 0 0; border-radius: 24px 24px 0 0; }
  .sheet[open] { animation: slide .28s cubic-bezier(.2,.8,.2,1); }
  @keyframes slide { from { transform: translateY(40px); opacity: .6; } }
}
.sheet-body { display: flex; flex-direction: column; min-height: 0; flex: 1; }

.sheet-head {
  position: relative; padding: 28px 24px 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 14%, var(--surface)), var(--surface));
}
.grabber { display: none; width: 40px; height: 4px; border-radius: 4px; background: var(--rule); margin: -14px auto 14px; }
@media (max-width: 639px) { .grabber { display: block; } }
.close {
  position: absolute; top: 14px; right: 14px;
  width: 40px; height: 40px; display: grid; place-items: center;
  border: 0; border-radius: 12px; cursor: pointer;
  background: color-mix(in srgb, var(--surface) 70%, transparent); color: var(--ink-2);
}
.close:hover { background: var(--bg-2); color: var(--ink); }
.close svg { width: 20px; height: 20px; }
.sheet-id { display: flex; gap: 16px; align-items: center; padding-right: 40px; }
.sheet-id .app-icon { width: 72px; height: 72px; border-radius: 18px; }
.sheet-id h2 { font-size: 24px; font-weight: 800; }
.sheet-id p { margin: 4px 0 0; color: var(--ink-2); font-size: 15px; }

.tabs { display: flex; gap: 4px; margin: 20px 0 0; border-bottom: 1px solid var(--rule); }
.tab {
  position: relative; font: 600 15px/1 var(--font); color: var(--ink-3);
  background: none; border: 0; padding: 14px 4px; margin-right: 18px; cursor: pointer;
}
.tab[aria-selected="true"] { color: var(--ink); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }

.sheet-scroll { overflow-y: auto; overscroll-behavior: contain; padding: 22px 24px 28px; flex: 1; min-height: 0; }
.panel[hidden] { display: none; }
.panel > p { margin: 0 0 16px; color: var(--ink-2); }
.panel h4 { margin: 22px 0 10px; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }

.features { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
@media (min-width: 560px) { .features { grid-template-columns: 1fr 1fr; } }
.features li { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--rule); border-radius: 14px; font-size: 14.5px; line-height: 1.45; }
.features svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--accent); }

.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; font-size: 14.5px; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }

.note { margin: 18px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--bg-2); color: var(--ink-2); font-size: 14px; line-height: 1.5; }
.note strong { color: var(--ink); }

.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li { position: relative; padding: 0 0 22px 52px; counter-increment: step; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 50%; font-weight: 700; font-size: 15px;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--rule));
}
.steps li:not(:last-child)::after { content: ""; position: absolute; left: 17px; top: 40px; bottom: 6px; width: 1px; background: var(--rule); }
.steps h5 { margin: 5px 0 4px; font-size: 16px; font-weight: 700; }
.steps p { margin: 0 0 12px; color: var(--ink-2); font-size: 14.5px; }
.steps .btn { min-height: 40px; padding: 8px 14px; font-size: 14px; }

.sheet-foot {
  display: flex; gap: 10px; padding: 14px 24px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--rule); background: var(--surface);
}
.sheet-foot .btn { flex: 1; }
.sheet-foot[hidden] { display: none; }
#sheet-title:focus { outline: none; }

/* Footer */
.footer { border-top: 1px solid var(--rule); padding: 28px 0 40px; color: var(--ink-3); font-size: 14px; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
.footer a { color: var(--ink-2); }
