:root {
  --bg: #f4f5f6;
  --surface: #ffffff;
  --ink: #16191d;
  --ink-2: #4a5059;
  --ink-3: #868c95;
  --line: #e2e5e9;
  --chip: #eceef1;
  --radius: 20px;
  --shadow: 0 1px 2px rgba(16,20,26,.04), 0 6px 24px rgba(16,20,26,.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1113;
    --surface: #181b1f;
    --ink: #f1f3f5;
    --ink-2: #b4bac2;
    --ink-3: #7c838c;
    --line: #262a30;
    --chip: #20242a;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 24px rgba(0,0,0,.25);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }

/* Header */
header { padding: calc(40px + env(safe-area-inset-top)) 0 8px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.mark { width: 44px; height: 44px; flex: none; }
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: -.3px; }
.brand-sub { color: var(--ink-3); font-size: 13px; }
h1 {
  font-size: clamp(32px, 6vw, 48px);
  line-height: 1.08; letter-spacing: -1.2px;
  margin: 36px 0 12px; font-weight: 700;
}
.lede { color: var(--ink-2); font-size: 18px; max-width: 560px; margin: 0; }
.hero-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 15px; margin-top: 28px; }
.back svg { width: 18px; height: 18px; }

/* Buttons */
.btn {
  appearance: none; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 999px;
  font: inherit; font-size: 15px; font-weight: 600;
  text-decoration: none; transition: transform .12s ease, opacity .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-ghost { background: var(--chip); color: var(--ink); }
.btn svg { width: 18px; height: 18px; }
.btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }

/* Filters */
.filters {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  margin-top: 36px; padding: 12px 0;
  border-bottom: 1px solid transparent;
}
.filters.stuck { border-bottom-color: var(--line); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  appearance: none; border: 0; cursor: pointer; flex: none;
  height: 36px; padding: 0 16px; border-radius: 999px;
  background: var(--chip); color: var(--ink-2);
  font: inherit; font-size: 14px; font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.chip .n { opacity: .55; margin-left: 4px; font-weight: 500; }

/* App grid */
#list { margin-top: 20px; }
.grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px;
  display: flex; flex-direction: column; gap: 14px;
  border: 1px solid var(--line);
}
.card-top { display: flex; gap: 14px; align-items: center; text-decoration: none; color: inherit; border-radius: 14px; }
.card-top .chev { margin-left: auto; color: var(--ink-3); width: 18px; height: 18px; flex: none; }
.meta { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.cat-tag { font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--ink-3); }
.ver { font-size: 11px; font-weight: 600; color: var(--ink-3); background: var(--chip); padding: 1px 7px; border-radius: 999px; }
.ver:empty { display: none; }
.card h3 { margin: 0; font-size: 18px; letter-spacing: -.3px; }
.tagline { margin: 2px 0 0; color: var(--ink-3); font-size: 14px; }
.desc { margin: 0; color: var(--ink-2); font-size: 15px; }
.card-actions { display: flex; gap: 8px; margin-top: auto; }
.card-actions .btn { flex: 1; height: 42px; font-size: 14.5px; }
.empty { color: var(--ink-3); padding: 40px 0; text-align: center; }

.icon {
  width: 60px; height: 60px; border-radius: 14px; flex: none;
  overflow: hidden; position: relative;
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 26px; letter-spacing: -.5px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
}
.icon img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }

/* Steps */
ol.steps { margin: 0; padding-left: 20px; color: var(--ink-2); font-size: 14.5px; }
ol.steps li { margin: 4px 0; }
.kbd { display: inline-flex; vertical-align: -3px; }
.kbd svg { width: 16px; height: 16px; }

/* Install page */
.install-intro { margin: 0 0 14px; }
.data-note { margin: 0 0 28px; }
.data-note strong { color: var(--ink); }
.install-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .install-grid { grid-template-columns: 1fr 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: var(--radius); padding: 20px; }
.panel h3 { margin: 0 0 10px; font-size: 17px; }
.install-grid ol.steps { font-size: 15.5px; }
.install-grid ol.steps li { margin: 8px 0; }

/* App page */
.app-hero { display: grid; gap: 28px; margin-top: 32px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 860px) { .app-hero { grid-template-columns: 1fr 280px; } }
.app-id { display: flex; gap: 20px; align-items: center; }
.app-id .icon { width: 96px; height: 96px; border-radius: 22px; font-size: 40px; }
.app-id h1 { margin: 2px 0 2px; font-size: clamp(30px, 5vw, 42px); }
.app-id .tagline { font-size: 17px; margin: 0; }
.app-hero .lede { margin-top: 20px; max-width: 620px; }
.qr-card { text-align: center; padding: 18px; }
.qr-card img { width: 100%; max-width: 200px; display: block; margin: 0 auto 10px; border-radius: 10px; background: #fff; padding: 8px; }
.qr-card p { margin: 0; color: var(--ink-3); font-size: 13.5px; }
.qr-card strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 2px; }
@media (max-width: 859px) { .qr-card { display: none; } }

.shots { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 2px 14px; margin-top: 36px; scrollbar-width: thin; }
.shots img { height: 520px; max-height: 70vh; width: auto; border-radius: 28px; border: 1px solid var(--line); box-shadow: var(--shadow); scroll-snap-align: start; flex: none; background: var(--surface); }

.sections { display: grid; gap: 16px; margin-top: 36px; grid-template-columns: 1fr; }
@media (min-width: 860px) { .sections { grid-template-columns: 1fr 1fr; } }
.panel h2 { font-size: 18px; letter-spacing: -.3px; margin: 0 0 12px; }
.panel p { margin: 0; color: var(--ink-2); }
.panel p + p { margin-top: 10px; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.checks li { display: flex; gap: 10px; color: var(--ink-2); }
.checks li svg { width: 20px; height: 20px; flex: none; margin-top: 2px; color: var(--accent, #2a7fb8); }
.notes { margin: 0; padding-left: 20px; color: var(--ink-2); }
.notes li { margin: 4px 0; }
.callout { border-left: 4px solid var(--accent, #2a7fb8); }
.panel.wide { grid-column: 1 / -1; }
.two-col { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 860px) { .two-col { grid-template-columns: 1fr 1fr; gap: 40px; } }
@media (max-width: 600px) {
  .app-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .app-actions .btn-primary { grid-column: 1 / -1; }
}
.panel a.mail { font-weight: 600; text-decoration: none; border-bottom: 1px solid var(--line); }
.hidden { display: none !important; }

footer { color: var(--ink-3); font-size: 13px; padding: 40px 0 calc(40px + env(safe-area-inset-bottom)); text-align: center; }

/* Sheet */
.scrim {
  position: fixed; inset: 0; background: rgba(10,12,15,.45); z-index: 50;
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.scrim.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 50%; bottom: 0; z-index: 51;
  width: min(520px, 100%); transform: translate(-50%, 105%);
  background: var(--surface); border-radius: 24px 24px 0 0;
  padding: 10px 22px calc(22px + env(safe-area-inset-bottom));
  transition: transform .28s cubic-bezier(.2,.8,.2,1);
  box-shadow: 0 -10px 40px rgba(0,0,0,.2);
  max-height: 92vh; overflow-y: auto;
}
.sheet.open { transform: translate(-50%, 0); }
.sheet:not(.open) { visibility: hidden; }
@media (min-width: 700px) {
  .sheet { bottom: auto; top: 50%; border-radius: 24px; transform: translate(-50%, -40%) scale(.98); opacity: 0; pointer-events: none; transition: all .2s ease; padding-bottom: 22px; }
  .sheet.open { transform: translate(-50%, -50%); opacity: 1; pointer-events: auto; }
}
.grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
.sheet-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.sheet-head .icon { width: 52px; height: 52px; border-radius: 12px; font-size: 22px; }
.sheet h3 { margin: 0; font-size: 19px; }
.sheet .sub { color: var(--ink-3); font-size: 14px; margin: 0; }
.sheet ol.steps { font-size: 15.5px; margin-bottom: 18px; }
.sheet ol.steps li { margin: 8px 0; }
.sheet-qr { display: flex; gap: 16px; align-items: center; background: var(--bg); border-radius: 14px; padding: 12px; margin: 0 0 16px; }
.sheet-qr img { width: 110px; height: 110px; background: #fff; border-radius: 8px; padding: 6px; flex: none; }
.sheet-qr p { margin: 0; color: var(--ink-2); font-size: 14px; }
.sheet-qr strong { display: block; color: var(--ink); }
.note { font-size: 13px; color: var(--ink-3); background: var(--bg); border-radius: 12px; padding: 10px 12px; margin: 0 0 16px; }
.sheet .btn { width: 100%; }
.sheet .row { display: flex; gap: 8px; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 60;
  transform: translate(-50%, 20px); opacity: 0;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px;
  font-size: 14px; font-weight: 600; transition: all .2s ease; pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
