/* PocketPlay nav — no framework, no external CSS. */

:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-2: #f0f2f5;
  --line: #e3e6ec;
  --line-2: #d5d9e2;
  --fg: #16181d;
  --muted: #5c6470;
  --dim: #838b98;
  --accent: #3f68f5;
  --accent-soft: #e8edff;
  --accent-fg: #ffffff;
  --shadow: 0 1px 2px rgba(16, 20, 30, .06), 0 6px 20px rgba(16, 20, 30, .05);
  --shadow-lift: 0 4px 10px rgba(16, 20, 30, .08), 0 14px 34px rgba(16, 20, 30, .09);
  --radius: 12px;
  --sidebar-w: 232px;
  --topbar-h: 54px;
}

:root[data-theme="dark"] {
  --bg: #0e1117;
  --panel: #161a22;
  --panel-2: #1c212b;
  --line: #262c38;
  --line-2: #333b4a;
  --fg: #e7eaf0;
  --muted: #a3acbb;
  --dim: #7b8595;
  --accent: #6f92ff;
  --accent-soft: #1e2740;
  --accent-fg: #0d1017;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .28);
  --shadow-lift: 0 4px 10px rgba(0, 0, 0, .45), 0 14px 34px rgba(0, 0, 0, .4);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1117;
    --panel: #161a22;
    --panel-2: #1c212b;
    --line: #262c38;
    --line-2: #333b4a;
    --fg: #e7eaf0;
    --muted: #a3acbb;
    --dim: #7b8595;
    --accent: #6f92ff;
    --accent-soft: #1e2740;
    --accent-fg: #0d1017;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .28);
    --shadow-lift: 0 4px 10px rgba(0, 0, 0, .45), 0 14px 34px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }

/* Must beat .card/.pcard/.scrim display rules when JS filters them out. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-h) + 12px); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
        Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  padding: 10px 16px; background: var(--accent); color: var(--accent-fg);
  border-radius: 0 0 8px 0;
}
.skip:focus { left: 0; }

/* ---------- bilingual text ---------- */
:root[data-lang="zh"] .i18n { font-size: .98em; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 10px;
  height: var(--topbar-h); padding: 0 14px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
}
.topbrand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; letter-spacing: -.01em; font-size: 16px;
}
.brand-logo {
  width: 28px; height: 28px; border-radius: 8px;
  object-fit: cover; display: block; flex: 0 0 28px;
}
.spacer { flex: 1; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 38px; height: 38px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel); color: var(--fg);
  font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background .15s ease, border-color .15s ease;
}
.icon-btn:hover { background: var(--panel-2); border-color: var(--line-2); }
.menu-btn { display: none; }

.ico-moon { display: none; }
:root[data-theme="dark"] .ico-sun { display: none; }
:root[data-theme="dark"] .ico-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ico-sun { display: none; }
  :root:not([data-theme="light"]) .ico-moon { display: block; }
  :root[data-theme="light"] .ico-sun { display: block; }
  :root[data-theme="light"] .ico-moon { display: none; }
}

/* ---------- layout ---------- */
.shell { display: flex; align-items: flex-start; }

.sidebar {
  position: sticky; top: var(--topbar-h);
  flex: 0 0 var(--sidebar-w); width: var(--sidebar-w);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 14px 10px 18px;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.brand { display: flex; gap: 10px; align-items: center; padding: 2px 8px 12px; }
.brand-mark {
  width: 34px; height: 34px; flex: 0 0 34px;
  border-radius: 10px; object-fit: cover; display: block;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 15px; letter-spacing: -.01em; }
.brand-text small { color: var(--dim); font-size: 11.5px; line-height: 1.35; }

.nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.nav-link {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 9px; border-radius: 8px; line-height: 1.5;
  color: var(--muted); font-size: 13.5px; font-weight: 500;
  transition: background .14s ease, color .14s ease;
}
.nav-link:hover { background: var(--panel-2); color: var(--fg); }
.nav-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
:root[data-theme="dark"] .nav-link.active { color: var(--fg); }
.nav-emoji { font-size: 14px; line-height: 1; width: 17px; text-align: center; }

.side-foot { margin: 12px 9px 0; font-size: 12.5px; color: var(--dim); }
.side-foot a { color: var(--accent); }
.side-foot a:hover { text-decoration: underline; }

.scrim { display: none; }

.main { flex: 1 1 auto; min-width: 0; padding: 26px clamp(16px, 3.2vw, 40px) 40px; }

/* ---------- hero + search ---------- */
.hero { max-width: 780px; margin: 0 auto 34px; text-align: center; }
.hero-logo {
  width: 72px; height: 72px; border-radius: 18px;
  display: block; margin: 0 auto 12px;
  box-shadow: var(--shadow);
}
.hero h1 {
  margin: 4px 0 18px; font-size: clamp(26px, 4vw, 36px);
  letter-spacing: -.025em; line-height: 1.2;
}
.hero-sub {
  display: block; margin-top: 6px;
  font-size: 15px; font-weight: 400; color: var(--muted); letter-spacing: 0;
}

.searchbox { display: grid; gap: 10px; }
.engines {
  display: flex; flex-wrap: wrap; gap: 4px; justify-content: center;
  padding: 4px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); width: fit-content; margin: 0 auto; max-width: 100%;
}
.engine {
  padding: 5px 13px; border: 0; border-radius: 999px;
  background: transparent; color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .14s ease, color .14s ease;
}
.engine:hover { color: var(--fg); background: var(--panel-2); }
.engine.on { background: var(--accent); color: var(--accent-fg); }

.search-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 6px 6px 14px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); box-shadow: var(--shadow);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.search-row:focus-within { border-color: var(--accent); box-shadow: var(--shadow-lift); }
.search-ico { color: var(--dim); flex: 0 0 auto; }
.search-input {
  flex: 1 1 auto; min-width: 0;
  border: 0; background: transparent; color: var(--fg);
  font: inherit; font-size: 15px; padding: 8px 0; outline: none;
}
.search-input::placeholder { color: var(--dim); }
.search-input::-webkit-search-cancel-button { cursor: pointer; }
.search-go {
  flex: 0 0 auto; padding: 9px 18px; border: 0; border-radius: 999px;
  background: var(--accent); color: var(--accent-fg);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: filter .15s ease;
}
.search-go:hover { filter: brightness(1.08); }
.search-hint { min-height: 18px; margin: 0; font-size: 12.5px; color: var(--dim); }

/* ---------- sections ---------- */
.section { margin: 0 0 34px; scroll-margin-top: calc(var(--topbar-h) + 16px); }
.section-title {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 14px; font-size: 15px; font-weight: 700;
  letter-spacing: .01em; color: var(--fg);
}
.section-title::after {
  content: ""; flex: 1 1 auto; height: 1px; background: var(--line);
}
.sec-emoji { font-size: 16px; line-height: 1; }

/* featured product cards — 6 products fill two rows of three */
.pgrid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 1140px) { .pgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pcard {
  display: flex; flex-direction: column; gap: 10px;
  padding: 18px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); box-shadow: var(--shadow);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.pcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: var(--line-2); }
.pcard.featured { border-color: color-mix(in srgb, var(--accent) 42%, var(--line)); }
.pcard-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.pemoji { font-size: 22px; line-height: 1; }
.plogo {
  width: 28px; height: 28px; border-radius: 8px;
  object-fit: cover; background: var(--panel-2); flex: 0 0 28px;
}
.pcard-title { margin: 0; font-size: 16.5px; font-weight: 700; letter-spacing: -.01em; }
.tag {
  padding: 2px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
}
:root[data-theme="dark"] .tag { color: var(--fg); }
.pcard-desc { margin: 0; flex: 1 1 auto; color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.btn {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 9px;
  background: var(--accent); color: var(--accent-fg);
  font-size: 13.5px; font-weight: 600;
  transition: filter .15s ease, transform .15s ease;
}
.btn:hover { filter: brightness(1.08); transform: translateX(2px); }

/* link cards */
.grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.card {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 12px 13px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); box-shadow: var(--shadow);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: var(--line-2); }
.fav {
  width: 24px; height: 24px; flex: 0 0 24px; margin-top: 2px;
  border-radius: 6px; object-fit: contain; background: var(--panel-2);
}
.fav-letter {
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
  font-size: 12px; font-weight: 700;
}
:root[data-theme="dark"] .fav-letter { color: var(--fg); }
.card-body { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.card-title { font-size: 14px; font-weight: 600; letter-spacing: -.005em; }
.card-desc {
  color: var(--muted); font-size: 12.5px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}

.noresults { margin: 30px 0; text-align: center; color: var(--dim); font-size: 14px; }

/* ---------- ad slots ----------
   Two containers, both shipped with the `hidden` attribute. ads.js unhides a
   slot only when window.ADS is enabled AND that slot has a real unit id, so
   while ads are off they occupy no space and reserve no height. */
.ad-slot { margin: 26px auto; min-height: 0; text-align: center; }
.ad-slot[hidden] { display: none; }
.ad-slot ins { display: block; }

/* ---------- footer ---------- */
.footer {
  margin-top: 34px; padding-top: 18px; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px;
  color: var(--dim); font-size: 13px;
}
.copy { margin: 0; }
.foot-links { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.foot-links a { color: var(--muted); }
.foot-links a:hover { color: var(--accent); text-decoration: underline; }

/* ---------- mobile ---------- */
@media (max-width: 860px) {
  .menu-btn { display: inline-flex; }
  .sidebar {
    position: fixed; top: var(--topbar-h); left: 0; z-index: 70;
    height: calc(100vh - var(--topbar-h));
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: var(--shadow-lift);
  }
  .sidebar.open { transform: translateX(0); }
  .scrim {
    display: block; position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 65;
    background: rgba(8, 11, 18, .45);
  }
  .scrim[hidden] { display: none; }
  .main { padding: 20px 16px 32px; }
  .hero { margin-bottom: 26px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
  .pgrid { grid-template-columns: 1fr; }
}

@media (max-width: 460px) {
  .grid { grid-template-columns: 1fr; }
  .search-go { padding: 9px 14px; }
  .brand-text small { display: none; }
}

/* ---------- legal pages (privacy, terms) ---------- */
/* Both languages are pre-rendered; the swap is pure CSS so it works with JS off. */
.lang-zh { display: none; }
:root[data-lang="zh"] .lang-en { display: none; }
:root[data-lang="zh"] .lang-zh { display: block; }
/* inline variant, for bilingual text inside a heading or paragraph */
:root[data-lang="zh"] span.lang-zh { display: inline; }

body.legal .page {
  max-width: 760px; margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 28px) 44px;
}
.prose h1 {
  margin: 0 0 6px; font-size: clamp(24px, 3.4vw, 30px);
  letter-spacing: -.02em; line-height: 1.25;
}
.prose .updated { margin: 0 0 26px; color: var(--dim); font-size: 13px; }
.prose h2 {
  margin: 30px 0 8px; font-size: 16px; font-weight: 700;
  letter-spacing: -.005em; color: var(--fg);
}
.prose p, .prose li { margin: 0 0 12px; color: var(--muted); font-size: 14.5px; line-height: 1.72; }
.prose .lede {
  margin-bottom: 22px; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); color: var(--fg); font-size: 14.5px;
}
.prose ul { margin: 0 0 12px; padding-left: 22px; }
.prose li { margin-bottom: 6px; }
.prose strong { color: var(--fg); font-weight: 700; }
.prose code {
  padding: 1px 5px; border-radius: 5px;
  background: var(--panel-2); border: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .88em; color: var(--fg);
}
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.prose a:hover { text-decoration-thickness: 2px; }
body.legal .footer { margin-top: 40px; }
