/* ─── shell ─────────────────────────────────────────────── */
.shell { display: flex; flex-direction: column; height: 100dvh; }

/* ── top bar ───────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  height: 58px; padding: 0 18px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.nav__brand { display: flex; align-items: center; gap: 9px; font-weight: 700;
  font-size: 14.5px; letter-spacing: -.03em; flex: none; }
.nav__brand i {
  width: 24px; height: 24px; border-radius: 8px; display: block;
  background: linear-gradient(140deg, var(--accent), #9b6bff);
}
.nav__tabs { display: flex; gap: 2px; flex: none; }
.nav__tabs button {
  height: 32px; padding: 0 12px; border-radius: 8px;
  font-size: 13.5px; font-weight: 550; color: var(--fg-faint);
  transition: color .15s var(--ease), background .15s var(--ease);
}
.nav__tabs button:hover { color: var(--fg); }
.nav__tabs button[aria-selected="true"] { color: var(--fg); background: var(--surface-2); }

.nav__search { flex: 1; max-width: 520px; margin: 0 auto; position: relative; }
.nav__search input {
  width: 100%; height: 36px; padding: 0 64px 0 36px;
  background: var(--surface-2); border: 1px solid transparent;
  border-radius: var(--r-full); font-size: 13.5px;
}
.nav__search input:focus {
  outline: none; border-color: var(--line); background: var(--bg-elev);
  box-shadow: var(--shadow-1);
}
.nav__search > svg { position: absolute; left: 13px; top: 10px; color: var(--fg-faint); }
.nav__kbd { position: absolute; right: 8px; top: 8px; display: flex; gap: 3px; pointer-events: none; }
.nav__kbd span {
  min-width: 19px; height: 20px; padding: 0 5px; display: grid; place-items: center;
  background: var(--bg); border: 1px solid var(--line); border-radius: 5px;
  font-size: 10.5px; color: var(--fg-faint);
}
.nav__right { display: flex; align-items: center; gap: 4px; flex: none; margin-left: auto; }

/* ── discover strip ────────────────────────────────────── */
.discover {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px 24px;
  padding: 26px 0 30px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 22px;
}
.discover h4 {
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--fg-faint); margin-bottom: 12px;
}
.discover a, .discover button {
  display: block; width: 100%; text-align: left;
  font-size: 17px; font-weight: 600; letter-spacing: -.02em;
  color: var(--fg); padding: 3px 0;
  transition: color .15s var(--ease);
}
.discover button:hover { color: var(--accent); }
@media (max-width: 1100px) { .discover { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px)  { .discover { display: none; } }

/* ── filter row ────────────────────────────────────────── */
.filters {
  position: sticky; top: 58px; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 0 14px;
  background: linear-gradient(var(--bg) 70%, transparent);
  flex-wrap: wrap;
}
.filters__tabs { display: flex; gap: 18px; }
.filters__tabs button {
  position: relative; padding: 4px 0; font-size: 13.5px; font-weight: 550;
  color: var(--fg-faint);
}
.filters__tabs button:hover { color: var(--fg); }
.filters__tabs button[aria-selected="true"] { color: var(--fg); }
.filters__tabs button[aria-selected="true"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 2px;
  background: var(--fg); border-radius: 2px;
}
.filters__right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* category sheet */
.catsheet {
  display: none; gap: 8px; flex-wrap: wrap;
  padding: 4px 0 18px;
}
.catsheet.open { display: flex; }

/* ── main ──────────────────────────────────────────────── */
.main { flex: 1; overflow-y: auto; }
.wrap { max-width: 1560px; margin: 0 auto; padding: 0 26px 70px; }

.pagehead { display: flex; align-items: flex-end; gap: 18px; padding: 24px 0 4px; flex-wrap: wrap; }
.pagehead h1 { font-size: 27px; }
.pagehead__meta { color: var(--fg-muted); font-size: 13px; margin-top: 5px; }
.pagehead__tools { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ─── app cards ─────────────────────────────────────────── */
.apps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(226px, 1fr));
  gap: 30px 20px;
}
.appcard { display: block; }
.appcard__panel {
  position: relative;
  aspect-ratio: 5 / 6;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  display: grid; place-items: end center;
  overflow: hidden;
  padding-top: 26px;
  transition: transform .28s var(--ease), box-shadow .28s var(--ease),
              border-color .28s var(--ease);
}
.appcard:hover .appcard__panel {
  transform: translateY(-4px);
  box-shadow: var(--shadow-2);
  border-color: var(--line);
}
.appcard__panel img {
  width: 66%;
  border-radius: 14px 14px 0 0;
  box-shadow: 0 10px 30px -12px rgba(0,0,0,.55);
  opacity: 0;
  transition: opacity .45s var(--ease), transform .45s var(--ease);
}
.appcard__panel img.in { opacity: 1; }
.appcard:hover .appcard__panel img { transform: translateY(-6px) scale(1.02); }
.appcard__badge {
  position: absolute; top: 12px; left: 12px;
  padding: 4px 10px; border-radius: var(--r-full);
  background: var(--bg-elev); border: 1px solid var(--line);
  font-size: 10.5px; font-weight: 650; letter-spacing: .02em;
  color: var(--fg-muted);
}
.appcard__foot { display: flex; gap: 11px; align-items: flex-start; padding: 13px 3px 0; }
.appcard__name { font-size: 13.5px; font-weight: 600; letter-spacing: -.01em; }
.appcard__sub {
  font-size: 12px; color: var(--fg-muted); margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}

/* infinite-scroll footer */
.loadmore { display: grid; place-items: center; padding: 42px 0 10px; }

/* ─── app detail ────────────────────────────────────────── */
.apphero {
  display: flex; gap: 18px; align-items: center;
  padding: 30px 0 4px;
}
.apphero__t h1 { font-size: 27px; }
.apphero__t p { color: var(--fg-muted); font-size: 13.5px; margin-top: 4px; }

.flowsec { margin-bottom: 34px; }
.flowsec__head {
  display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px;
  position: sticky; left: 0;
}
.flowsec__head h3 { font-size: 15.5px; }
.flowsec__head span { color: var(--fg-faint); font-size: 12px; }

.strip {
  display: flex; gap: 12px; overflow-x: auto;
  padding-bottom: 10px; scroll-snap-type: x proximity;
}

/* ─── screen tiles ──────────────────────────────────────── */
.shot {
  position: relative; flex: none; width: 176px;
  aspect-ratio: 9 / 19.5;
  border-radius: 14px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line-soft);
  scroll-snap-align: start;
  transition: transform .2s var(--ease), border-color .2s var(--ease),
              box-shadow .2s var(--ease);
}
.shot:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: var(--line); }
.shot img { width: 100%; height: 100%; object-fit: cover; object-position: top;
  opacity: 0; transition: opacity .35s var(--ease); }
.shot img.in { opacity: 1; }
.shot__fav {
  position: absolute; top: 8px; right: 8px;
  width: 28px; height: 28px; border-radius: var(--r-full);
  display: grid; place-items: center;
  background: rgba(10,10,12,.62); color: #fff;
  opacity: 0; transition: opacity .18s var(--ease);
  backdrop-filter: blur(8px);
}
.shot:hover .shot__fav, .shot__fav[aria-pressed="true"] { opacity: 1; }
.shot__fav[aria-pressed="true"] { color: #ff5d7d; }

.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 18px; }
.shots .shot { width: auto; }
.shots__cap { margin-top: 8px; font-size: 11.5px; color: var(--fg-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ─── lightbox ──────────────────────────────────────────── */
.lb {
  position: fixed; inset: 0; z-index: 120;
  background: var(--scrim); backdrop-filter: blur(18px);
  display: grid; grid-template-rows: auto 1fr auto;
  animation: fade .18s var(--ease);
}
@keyframes fade { from { opacity: 0; } }
.lb__bar { display: flex; align-items: center; gap: 12px; padding: 14px 18px; color: #fff; }
.lb__bar .t { font-size: 13.5px; font-weight: 650; }
.lb__bar .s { font-size: 12px; opacity: .58; }
.lb__bar .sp { margin-left: auto; display: flex; gap: 8px; }
.lb__bar .btn { background: rgba(255,255,255,.13); color: #fff; }
.lb__bar .btn:hover { background: rgba(255,255,255,.24); }
.lb__stage { display: grid; place-items: center; padding: 0 70px; min-height: 0; }
.lb__stage img { max-height: 100%; max-width: 100%; border-radius: 14px; box-shadow: var(--shadow-3); }
.lb__rail { display: flex; gap: 8px; overflow-x: auto; padding: 14px 18px 18px; justify-content: safe center; }
.lb__rail img {
  height: 78px; flex: none; border-radius: 7px; opacity: .4; cursor: pointer;
  border: 2px solid transparent; transition: opacity .15s var(--ease);
}
.lb__rail img:hover { opacity: .8; }
.lb__rail img[aria-current="true"] { opacity: 1; border-color: #fff; }
.lb__nav {
  position: fixed; top: 50%; translate: 0 -50%;
  width: 46px; height: 46px; border-radius: var(--r-full);
  display: grid; place-items: center; font-size: 22px;
  background: rgba(255,255,255,.13); color: #fff; backdrop-filter: blur(8px);
}
.lb__nav:hover { background: rgba(255,255,255,.26); }
.lb__nav--prev { left: 16px; } .lb__nav--next { right: 16px; }

/* ─── command palette ───────────────────────────────────── */
.pal {
  position: fixed; inset: 0; z-index: 150; background: var(--scrim);
  display: grid; justify-items: center; align-items: start;
  padding-top: 11vh; animation: fade .14s var(--ease);
}
.pal__box {
  width: min(580px, 92vw); background: var(--bg-elev);
  border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow-3); overflow: hidden;
}
.pal__box input { width: 100%; height: 54px; padding: 0 22px; font-size: 15px;
  border-bottom: 1px solid var(--line); }
.pal__box input:focus { outline: none; }
.pal__list { max-height: 56vh; overflow-y: auto; padding: 8px; }
.pal__row {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 10px; text-align: left; color: var(--fg-muted);
}
.pal__row[aria-selected="true"] { background: var(--surface-2); color: var(--fg); }
.pal__row b { font-weight: 600; color: var(--fg); }
.pal__row em { margin-left: auto; font-style: normal; font-size: 11.5px; color: var(--fg-faint); }

/* ─── responsive ────────────────────────────────────────── */
@media (max-width: 860px) {
  .nav { gap: 8px; padding: 0 12px; }
  .nav__tabs { display: none; }
  .nav__kbd { display: none; }
  .wrap { padding: 0 14px 60px; }
  .apps { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 22px 12px; }
  .lb__stage { padding: 0 12px; }
  .lb__rail { display: none; }
  .lb__nav { width: 40px; height: 40px; }
}
