:root {
  --theme-base: #fff;
  --text-color: #252525;
  --text-color-2: #989898;
  --text-color-light: #595959;
  --accent-color: #4ba430;
  --accent-color-dark: #3d8826;
  --bg-shade-light: #f4f4f0;
  --bd-color: #ccc;
  --font: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 62.5%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.4rem;
  line-height: 1.5;
  color: var(--text-color);
  background: var(--theme-base);
}
a { color: var(--text-color); text-decoration: none; }
a:hover { color: var(--accent-color); }
img { max-width: 100%; height: auto; }
.container { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 1.5rem; }

.page-wrap { min-height: 100vh; display: flex; flex-direction: column; }
.main-content { flex: 1; }

/* 左右布局：左侧导航 + 右侧主区（大屏）；小屏为顶栏 + 抽屉侧栏 */
.layout-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
@media (min-width: 992px) {
  .layout-shell {
    flex-direction: row;
    align-items: stretch;
  }
}

.layout-mobile-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.65rem 1rem;
  background: var(--theme-base);
  border-bottom: 1px solid var(--bd-color);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}
@media (min-width: 992px) {
  .layout-mobile-bar { display: none; }
}

.layout-sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.layout-sidebar-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
@media (min-width: 992px) {
  .layout-sidebar-backdrop { display: none; }
}

.layout-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: min(288px, 88vw);
  z-index: 200;
  background: var(--theme-base);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.layout-sidebar.is-open {
  transform: translateX(0);
}
@media (min-width: 992px) {
  .layout-sidebar {
    position: sticky;
    top: 0;
    align-self: flex-start;
    width: 268px;
    flex-shrink: 0;
    max-height: 100vh;
    transform: none !important;
    box-shadow: none;
    border-right: 1px solid var(--bd-color);
    background: var(--bg-shade-light);
  }
}

.layout-sidebar__inner {
  padding: 1.25rem 1.25rem 2rem;
}
@media (min-width: 992px) {
  .layout-sidebar__inner {
    padding: 1.75rem 1.25rem 2.5rem;
  }
}

.layout-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.sidebar-open {
  overflow: hidden;
}
@media (min-width: 992px) {
  body.sidebar-open {
    overflow: auto;
  }
}

.site-branding img { display: block; height: 36px; width: auto; }
.site-branding--toolbar { flex: 1; min-width: 0; }
.site-branding--toolbar img { height: 32px; }
.site-branding--sidebar {
  display: block;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--bd-color);
}
@media (min-width: 992px) {
  .site-branding--sidebar {
    border-bottom-color: var(--bd-color);
  }
}

.sidebar-nav__heading {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-color-2);
}

.header__menu-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.header__menu-toggle span,
.header__menu-toggle::before,
.header__menu-toggle::after {
  content: "";
  display: block;
  height: 3px;
  width: 22px;
  background: var(--text-color);
  margin: 0 auto;
  border-radius: 1px;
}
.header__menu-toggle span { margin: 5px auto; }
@media (min-width: 992px) {
  .header__menu-toggle { display: none; }
}

.home-btn { margin-bottom: 1.25rem; }
.home-btn a {
  display: inline-flex;
  align-items: center;
  font-weight: 500;
  color: var(--accent-color);
}
.home-btn__icon {
  width: 20px;
  height: 20px;
  margin-right: 0.8rem;
  border-radius: 4px;
  background: linear-gradient(135deg, var(--accent-color), #2ae2dd);
}

.header__category-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sidebar-nav__list li {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.sidebar-nav__list a {
  display: block;
  padding: 0.75rem 0;
  font-weight: 500;
  font-size: 1.4rem;
}
@media (min-width: 992px) {
  .sidebar-nav__list li {
    border-bottom-color: rgba(0, 0, 0, 0.05);
  }
  .sidebar-nav__list a {
    padding: 0.55rem 0;
    font-size: 1.35rem;
  }
}

.d-md-none { display: inline; }
.d-none { display: none; }
.d-md-inline { display: none; }
@media (min-width: 768px) {
  .d-md-none { display: none; }
  .d-md-inline { display: inline; }
}

/* Sections */
.layout-section { padding: 2rem 0 3rem; }
.h1 { font-size: 3.2rem; font-weight: 700; margin: 0 0 0.8rem; line-height: 1.15; }
.h3 { font-size: 2rem; font-weight: 500; margin: 0 0 2rem; }
.text-normal { font-weight: 400; }
.opacity-8 { opacity: 0.85; }

.separator {
  height: 1px;
  background: var(--bd-color);
  margin: 2rem 0;
}

/* AdSense 版位：居中留白，避免挤压正文 */
.layout-section--ad { padding-top: 1rem; padding-bottom: 1rem; }
.ad-slot-wrap { margin: 1.5rem 0; text-align: center; }
.ad-slot-wrap--below-nav { margin-top: 0.75rem; margin-bottom: 1.25rem; }
.ad-slot-wrap--above-footer { margin-top: 2rem; margin-bottom: 0.5rem; }
.ad-slot-wrap--tight-top { margin-top: 1rem; }
.ad-slot-wrap--in-feed,
.ad-slot-wrap--before-popular,
.ad-slot-wrap--category-mid,
.ad-slot-wrap--listing { margin: 2rem 0; }
.ad-slot {
  margin: 0 auto;
  max-width: 100%;
  overflow: hidden;
  min-height: 1px;
}
.ad-slot--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  padding: 1.2rem 1rem;
  background: var(--bg-shade-light);
  border: 1px dashed var(--bd-color);
  border-radius: 8px;
  color: var(--text-color-2);
  font-size: 1.3rem;
  font-weight: 500;
  letter-spacing: 0.06em;
}
.ad-slot__placeholder-text { user-select: none; }

/* 版位 DOM 与 category_mid 一致：section > .container > .ad-slot-wrap > .ad-slot；内部 iframe 常窄于容器，flex 水平居中 */
.layout-main .layout-section .container .ad-slot-wrap > .ad-slot {
  width: 100%;
  max-width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}
.layout-main .layout-section .container .ad-slot-wrap .ad-slot iframe {
  max-width: 100%;
}

/* 导航下 / 页脚上广告条：略收紧 section 默认上下留白 */
.layout-section.layout-section--slot-below-nav {
  padding: 0.75rem 0 1rem;
}
.layout-section.layout-section--slot-above-footer {
  padding: 1rem 0 0.75rem;
}

/* 应用详情：正文 900px 居中；below_nav / app_article_top / app_article_bottom 与正文列同宽居中 */
article.prose.page-article {
  margin-left: auto;
  margin-right: auto;
}
.layout-main .main-content:has(article.prose.page-article) .layout-section--slot-below-nav .ad-slot-wrap--below-nav > .ad-slot,
.layout-main .layout-section:has(article.prose.page-article) .ad-slot-wrap > .ad-slot {
  max-width: 900px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

/* Review cards */
.row { display: flex; flex-wrap: wrap; margin: 0 -0.75rem; }
.col-sm-4 { width: 100%; padding: 0 0.75rem; margin-bottom: 1.5rem; }
@media (min-width: 576px) {
  .col-sm-4 { width: 33.333%; }
}

.card--review {
  display: block;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  min-height: 120px;
  background: var(--bg-shade-light);
  border: 1px solid var(--bd-color);
  transition: box-shadow 0.2s, transform 0.2s;
}
.card--review:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}
.card--review .card-body { position: relative; z-index: 2; padding: 1.5rem; }
.card--review .d-flex { display: flex; align-items: center; }
.flex-shrink-0 { flex-shrink: 0; }
.pl-4 { padding-left: 1.5rem; }
.app-mask {
  border-radius: 18px;
  object-fit: cover;
}
.layout-section__hd--light { color: var(--text-color); }
.layout-section__text { color: var(--text-color-light); font-size: 1.3rem; margin: 0; }
.card-bg {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0.15;
  pointer-events: none;
}
.card-bg > div {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  filter: blur(20px);
}

/* Category pills */
.ratings--scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ratings--scroll .d-flex { display: flex; flex-wrap: nowrap; gap: 0.8rem; padding-bottom: 0.5rem; }
.btn--sm {
  display: inline-flex;
  align-items: center;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  font-size: 1.3rem;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid var(--bd-color);
  background: var(--bg-shade-light);
}
.btn--sm:hover { border-color: var(--accent-color); color: var(--accent-color); }
.btn--soft_palette-1 { background: #e7f1fd; border-color: #c5d9f5; }
.btn--soft_palette-2 { background: #cdf0d3; border-color: #a8dfb4; }
.btn--soft_palette-3 { background: #f3f6c4; border-color: #e4e89a; }
.btn--soft_palette-4 { background: #f4e8ff; border-color: #dcc4f5; }
.btn--soft_palette-5 { background: #ffe8e0; border-color: #f5c4b3; }

/* App grid */
.app-grid .grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 480px) {
  .app-grid .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 768px) {
  .app-grid .grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 992px) {
  .app-grid .grid { grid-template-columns: repeat(4, 1fr); }
}

.thumbnail-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--bd-color);
  border-radius: 10px;
  background: #fafafa;
  transition: border-color 0.2s, background 0.2s;
}
.thumbnail-wrap:hover {
  border-color: var(--accent-color);
  background: #fff;
}
.thumbnail--sm {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(145deg, #d9d9d9, #f6f6f6);
}
.thumbnail__img { width: 64px; height: 64px; object-fit: cover; display: block; }
.layout-section__sub-hd { display: block; font-size: 1.4rem; margin-bottom: 0.3rem; }

/* App detail */
.app-hero {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: flex-start;
  padding: 2rem 0;
}
.app-hero__icon img { width: 120px; height: 120px; border-radius: 22px; }
.meta-table { width: 100%; max-width: 480px; border-collapse: collapse; }
.meta-table th, .meta-table td {
  text-align: left;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--bd-color);
  font-size: 1.4rem;
}
.meta-table th { color: var(--text-color-2); width: 38%; font-weight: 500; }
.prose { max-width: 800px; }
.prose h2 { font-size: 2.2rem; margin-top: 2.5rem; }
.prose h3 { font-size: 1.8rem; }
.prose ul { padding-left: 2rem; }
.install-btns { display: flex; flex-wrap: wrap; gap: 1rem; margin: 2rem 0; }
.btn-install {
  display: inline-block;
  padding: 0.8rem 1.6rem;
  background: var(--accent-color);
  color: #fff !important;
  border-radius: 8px;
  font-weight: 600;
}
.btn-install:hover { background: var(--accent-color-dark); color: #fff !important; }
.btn-install--secondary { background: #252525; }
.btn-install--secondary:hover { background: #444; }

/* Category page */
.sub-hd { font-size: 2rem; margin: 2rem 0 1rem; }

/* Static pages & forms */
.page-article h1 { font-size: 2.8rem; margin-top: 0; }
.page-article { padding: 2rem 0 4rem; max-width: 900px; }

.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; font-weight: 500; margin-bottom: 0.4rem; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  max-width: 520px;
  padding: 0.8rem 1rem;
  border: 1px solid var(--bd-color);
  border-radius: 6px;
  font-family: inherit;
  font-size: 1.4rem;
}
.form-group textarea { min-height: 140px; resize: vertical; }
.btn-submit {
  padding: 1rem 2rem;
  background: var(--accent-color);
  color: #fff;
  border: 0;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 1.4rem;
}
.btn-submit:hover { background: var(--accent-color-dark); }
.alert { padding: 1rem 1.2rem; border-radius: 8px; margin-bottom: 1.5rem; max-width: 520px; }
.alert--ok { background: #e8f8e4; border: 1px solid #a8dfb4; }
.alert--err { background: #ffe8e8; border: 1px solid #f5b3b3; }

/* Pagination */
.pagination { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 2rem 0; }
.pagination a, .pagination span {
  padding: 0.5rem 1rem;
  border: 1px solid var(--bd-color);
  border-radius: 6px;
}
.pagination .current { background: var(--accent-color); color: #fff; border-color: var(--accent-color); }

/* Footer */
.footer {
  background: var(--bg-shade-light);
  padding: 3rem 0 2rem;
  margin-top: 3rem;
  border-top: 1px solid var(--bd-color);
}
.footer__cols { display: flex; flex-wrap: wrap; gap: 2rem 4rem; }
.footer__col { flex: 1; min-width: 240px; }
.footer__col h4 { margin: 0 0 1rem; font-size: 1.6rem; }
.footer__col ul { list-style: none; margin: 0; padding: 0; }
.footer__col li { margin-bottom: 0.6rem; }
.footer__separator { height: 1px; background: var(--bd-color); margin: 2rem 0 1rem; }
.footer__legals { display: block; color: var(--text-color-light); font-size: 1.2rem; margin-bottom: 0.8rem; }
.footer__legals--links a { margin-right: 1rem; }
.footer__x { margin-left: 0.5rem; font-weight: 700; }
.footer__disclaimer, .footer__copy { display: block; color: var(--text-color-2); font-size: 1.2rem; line-height: 1.5; margin-top: 0.8rem; }

.notfound { text-align: center; padding: 4rem 1rem; }
