:root {
  color-scheme: dark;
  --bg: #121512;
  --surface: #1c211d;
  --border: #354038;
  --ink: #f3f6f3;
  --muted: #a6b4aa;
  --accent: #a5e7bc;
  --accent-ink: #12331d;
  font-family: Roboto, "Noto Sans", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
body { margin: 0; }

button, a, select { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button, select { font: inherit; }
button, summary, select { cursor: pointer; }
button { color: inherit; }
button:focus-visible, a:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}
h1, h2, p { margin: 0; }
a { color: inherit; text-decoration: none; }
svg, img { display: block; }
svg { flex-shrink: 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.page {
  max-width: 560px;
  margin-inline: auto;
  padding-bottom: calc(105px + env(safe-area-inset-bottom));
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  padding: calc(6px + env(safe-area-inset-top)) 22px 6px;
  background: rgba(18, 21, 18, 0.72);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  backdrop-filter: blur(18px) saturate(1.5);
  border-bottom: 1px solid rgba(53, 64, 56, 0.72);
}
.topbar-brand {
  min-width: 0;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-logo {
  justify-self: center;
  align-self: center;
  max-height: 30px;
  max-width: 150px;
  width: auto;
  height: auto;
  object-fit: contain;
}
.topbar-icon {
  flex-shrink: 0;
  justify-self: start;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--accent);
}
.topbar-icon svg { width: 22px; height: 22px; }
button.topbar-icon {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  color: var(--accent);
}

/* ---------- 顶栏右侧 ---------- */
.topbar-right {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* ---------- App 概要 ---------- */
.app-summary { padding: 28px 22px 22px; }
.app-identity { display: flex; align-items: center; gap: 18px; }
.app-logo {
  width: 82px; height: 82px;
  border-radius: 20px;
  object-fit: contain;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid #ffffff0d;
}
.app-heading { min-width: 0; }
.app-heading p { color: var(--accent); font-size: 12px; margin-bottom: 5px; }
.app-heading h1 {
  font-size: 29px;
  font-weight: 720;
  line-height: 1.18;
  letter-spacing: -0.6px;
  overflow-wrap: anywhere;
}
.app-heading .app-developer {
  color: var(--muted);
  font-size: 12px;
  margin-top: 5px;
  margin-bottom: 0;
  overflow-wrap: anywhere;
}
.rating-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.rating-stars { display: inline-flex; gap: 1px; color: #4b584e; }
.rating-stars .star { font-size: 13px; line-height: 1; }
.rating-stars .star.filled { color: #f7b500; }
.rating-score { font-size: 13px; font-weight: 650; }
.rating-count { font-size: 11px; color: var(--muted); }

.app-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.meta-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 9px;
}
.meta-badge.age-badge {
  color: #f0b34a;
  border-color: #5a4825;
  background: #2a2417;
}
.security-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
}
.security-badge.ok {
  color: #a5e7bc;
  background: rgba(165, 231, 188, 0.1);
  border: 1px solid rgba(165, 231, 188, 0.28);
}
.security-badge.warn {
  color: #f0b34a;
  background: rgba(240, 179, 74, 0.1);
  border: 1px solid rgba(240, 179, 74, 0.3);
}
.security-badge.unknown {
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
}

/* ---------- 应用信息网格 ---------- */
.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  margin-top: 14px;
}
.info-item {
  background: var(--surface);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.info-label { font-size: 11px; color: var(--muted); }
.info-value { font-size: 15px; font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; }
.info-note { font-size: 11px; font-style: normal; color: var(--muted); line-height: 1.45; overflow-wrap: anywhere; }

/* ---------- 功能特性 ---------- */
/* 所有功能条目合并到同一张卡片内，条目之间用分隔线区分 */
.feature-list {
  margin-top: 15px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 14px;
}
.feature-item { padding: 13px 0; }
.feature-item + .feature-item { border-top: 1px solid var(--border); }
.feature-item b { font-size: 14px; font-weight: 600; }
.feature-item p { font-size: 12px; color: var(--muted); line-height: 1.6; margin-top: 5px; overflow-wrap: anywhere; }

.app-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 25px 0 22px;
}
.app-facts > div {
  text-align: center;
  padding: 1px 8px;
  border-inline-end: 1px solid var(--border);
  min-width: 0;
}
.app-facts > div:first-child { padding-inline-start: 0; }
.app-facts > div:last-child { padding-inline-end: 0; border: 0; }
.app-facts b { display: block; font-size: 16px; line-height: 26px; font-weight: 650; }
.app-facts span {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-top: 4px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.app-facts .age-fact b { font-size: 24px; letter-spacing: -0.5px; }

/* ---------- 下载按钮 ---------- */
.download-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  min-height: 54px;
  padding: 14px 18px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  overflow-wrap: anywhere;
}
.download-btn svg { width: 21px; height: 21px; }
.download-btn:active { background: #8cdba8; }
.download-note { font-size: 12px; color: var(--muted); text-align: center; margin-top: 10px; }
.preview-note { font-size: 11px; color: #c0d5bc; text-align: center; margin-top: 7px; }

/* ---------- 图片预览 ---------- */
.gallery-section { padding-top: 9px; padding-bottom: 22px; border-bottom: 1px solid var(--border); }
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-inline: 22px;
}
.section-heading h2 { min-width: 0; overflow-wrap: anywhere; }
h2 { font-size: 20px; line-height: 1.3; letter-spacing: -0.35px; font-weight: 650; }
.photo-count {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  direction: ltr;
  color: var(--muted);
  white-space: nowrap;
}
.section-note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  padding-inline: 22px;
  margin-top: 7px;
}
.photo-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 22px;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 18px 22px 4px;
  touch-action: pan-x pan-y;
}
.photo-strip::-webkit-scrollbar { display: none; }
.photo-card {
  display: block;
  flex: 0 0 min(67vw, 240px);
  width: min(67vw, 240px);
  padding: 0;
  border: 1px solid #485449;
  border-radius: 16px;
  background: #090b09;
  overflow: hidden;
  scroll-snap-align: start;
  position: relative;
}
.photo-card img {
  width: 100%;
  height: calc(min(67vw, 240px) * 1.333333);
  object-fit: contain;
}
.photo-card:focus-visible { outline-offset: -4px; }
.photo-card[aria-current="true"] { border-color: var(--accent); }
.gallery-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 13px 22px 0;
}
.arrow {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
}
.arrow svg { width: 18px; height: 18px; }
.dots { display: flex; gap: 6px; align-items: center; }
.dots i {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 5px;
  background: #4b584e;
  transition: width 0.25s, background 0.25s;
}
.dots i.active { width: 17px; background: var(--accent); }

/* ---------- 通用区块 ---------- */
.section { padding: 26px 22px 0; }
.section > p {
  font-size: 14px;
  line-height: 1.75;
  color: var(--muted);
  margin-top: 12px;
  overflow-wrap: anywhere;
}

/* ---------- 折叠项 ---------- */
.steps { margin-top: 15px; }
.steps, .help > details:first-of-type { border-top: 1px solid var(--border); }
details { border-bottom: 1px solid var(--border); }
summary {
  display: flex;
  align-items: center;
  gap: 12px;
  list-style: none;
  font-size: 14px;
  font-weight: 550;
  min-height: 60px;
  line-height: 1.5;
  padding: 16px 0;
  overflow-wrap: anywhere;
}
summary::-webkit-details-marker { display: none; }
.step-number {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: #263e2e;
  color: var(--accent);
  font-size: 12px;
}
.plus {
  flex-shrink: 0;
  margin-inline-start: auto;
  font-size: 21px;
  font-weight: 400;
  color: var(--muted);
  transition: transform 0.15s;
}
details[open] .plus { transform: rotate(45deg); }
details > p {
  padding: 0 0 18px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.75;
  overflow-wrap: anywhere;
}
.section > .small-note { font-size: 12px; line-height: 1.7; margin-top: 13px; }
.help h2 { margin-bottom: 16px; }

/* ---------- 页脚 ---------- */
footer { margin: 30px 22px 0; padding-top: 23px; border-top: 1px solid var(--border); }
footer b { font-weight: 550; font-size: 14px; overflow-wrap: anywhere; }
footer p { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ---------- 底部固定下载栏 ---------- */
.install-dock {
  position: fixed;
  bottom: 0;
  inset-inline: 0;
  z-index: 10;
  max-width: 560px;
  width: 100%;
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px max(18px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background: #1c211dfc;
  border-top: 1px solid var(--border);
}
.dock-logo { width: 42px; height: 42px; border-radius: 11px; }
.dock-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dock-brand {
  font-size: 13px;
  font-weight: 550;
  line-height: 1.35;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.dock-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  font-size: 11px;
  line-height: 1.3;
  color: var(--muted);
}
.dock-rating { flex-shrink: 0; color: #f7b500; font-weight: 600; }
.dock-dot { flex-shrink: 0; color: var(--muted); }
.dock-category {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.dock-cta {
  flex: 0 0 auto;
  margin-inline-start: auto;
  max-width: 52%;
  min-width: 95px;
  font-size: 14px;
  min-height: 46px;
  padding: 11px 15px;
  border-radius: 10px;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  clip: rect(0, 0, 0, 0);
  overflow: hidden;
  white-space: nowrap;
}

/* ---------- 全屏图片查看 ---------- */
#photo-viewer {
  padding: 0;
  margin: auto;
  border: 1px solid #354038;
  border-radius: 0;
  width: 100vw;
  max-width: 620px;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  background: #070a08;
  color: var(--ink);
  overflow: hidden;
}
#photo-viewer::backdrop { background: #000d; }
.viewer-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.viewer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  flex-shrink: 0;
}
.viewer-top > span { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.viewer-close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  background: #222a24;
}
.viewer-close svg { width: 20px; height: 20px; }
.viewer-image {
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  touch-action: pan-y;
}
.viewer-image img { width: 100%; height: 100%; object-fit: contain; }
.viewer-controls {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 24px 20px;
}
.viewer-arrow {
  display: grid;
  place-items: center;
  min-width: 80px;
  min-height: 48px;
  background: #222a24;
  border: 1px solid #3a483f;
  border-radius: 12px;
}
.viewer-arrow svg { width: 22px; height: 22px; }

/* ---------- 搜索浮层 ---------- */
.search-dialog {
  padding: 0;
  margin: 0 auto;
  border: 0;
  width: 100%;
  max-width: 560px;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
}
.search-dialog::backdrop { background: #000c; }
.search-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: calc(12px + env(safe-area-inset-top)) 0 env(safe-area-inset-bottom);
}
.search-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.search-input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  font-family: inherit;
}
.search-input::placeholder { color: #6d7a70; }
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(165, 231, 188, 0.12);
}
.search-close {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}
.search-close:hover { color: var(--ink); }
.search-results {
  flex: 1;
  overflow-y: auto;
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.search-result:hover { border-color: var(--accent); }
.search-result img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: contain;
  background: var(--surface-2, #222923);
  flex-shrink: 0;
}
.search-result-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.search-result-body strong {
  font-size: 14px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result-body span {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result-rating {
  flex-shrink: 0;
  font-style: normal;
  font-size: 12px;
  color: #f7b500;
}
.search-empty {
  padding: 40px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- 窄屏适配 ---------- */
@media (max-width: 359px) {
  .topbar { padding-inline: 16px; gap: 8px; }
  .topbar-right { gap: 8px; }
  .app-summary, .section { padding-inline: 17px; }
  .app-identity { gap: 13px; }
  .app-logo { width: 70px; height: 70px; border-radius: 17px; }
  .app-heading h1 { font-size: 26px; }
  .app-facts { margin-block: 22px 19px; }
  .app-facts > div { padding-inline: 6px; }
  .photo-strip { padding-inline: 17px; gap: 10px; scroll-padding-inline: 17px; }
  .section-heading, .section-note { padding-inline: 17px; }
  .install-dock { gap: 8px; padding-inline: 12px; }
  .dock-logo { width: 36px; height: 36px; border-radius: 9px; }
  .dock-cta { font-size: 13px; padding-inline: 12px; }
  .dock-brand { font-size: 12px; }
  .dock-meta { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- 关联 App 信息条（Banner 风格，无卡片容器） ---------- */
.app-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.app-strip-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.app-strip-logo {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  object-fit: contain;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.08);
}
.app-strip-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.app-strip-name {
  font-size: 13.5px;
  font-weight: 650;
  color: #fff;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-strip-rating { display: flex; align-items: center; gap: 5px; }
.app-strip-stars {
  display: inline-flex;
  gap: 1px;
  font-size: 10px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.32);
}
.app-strip-stars .on { color: #f7b500; }
.app-strip-score {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.72);
  font-variant-numeric: tabular-nums;
}
.app-strip-meta {
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-strip-install {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.app-strip-install.disabled {
  background: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}
