:root {
  color-scheme: light;
  --mint: #20c997;
  --mint-dark: #0f9f78;
  --ink: #17212b;
  --muted: #687380;
  --line: #e6eaef;
  --panel: #ffffff;
  --bg: #f5f7fa;
  --shadow: 0 10px 30px rgba(20, 32, 44, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  padding: 14px max(18px, calc((100vw - 1180px) / 2));
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--mint);
  color: #fff;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.search {
  display: flex;
  width: min(520px, 56vw);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.search input {
  min-width: 0;
  flex: 1;
  border: 0;
  padding: 11px 13px;
  outline: 0;
  font-size: 15px;
}

.search button,
.btn {
  border: 0;
  cursor: pointer;
  font-weight: 700;
}

.search button {
  padding: 0 18px;
  color: #fff;
  background: var(--mint);
}

.page-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 22px auto 60px;
}

.ad-window {
  position: relative;
  overflow: hidden;
  margin-bottom: 16px;
  height: clamp(118px, 17vw, 176px);
  border-radius: 8px;
  background: #000;
  box-shadow: var(--shadow);
}

.ad-window-track {
  position: relative;
  height: 100%;
  --ad-gap: clamp(8px, 1.4vw, 16px);
  --ad-card-width: calc((100% - var(--ad-gap)) / 2);
  padding: 0;
  background: #000;
}

.ad-window-card {
  position: absolute;
  top: 0;
  left: 0;
  display: none;
  height: 100%;
  width: var(--ad-card-width);
  overflow: hidden;
  border-radius: 8px;
  background: #000;
  transform: translate3d(calc(100% + var(--ad-gap)), 0, 0);
  opacity: 0;
  backface-visibility: hidden;
  contain: paint;
}

.ad-window-card.is-visible {
  display: block;
  opacity: 1;
}

.ad-window-card.is-left {
  transform: translate3d(0, 0, 0);
}

.ad-window-card.is-right {
  transform: translate3d(calc(100% + var(--ad-gap)), 0, 0);
}

.ad-window-card.is-leaving {
  display: block;
  animation: adLeave 1.18s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.ad-window-card.is-entering {
  display: block;
  animation: adEnter 1.18s cubic-bezier(0.22, 1, 0.36, 1) both;
  will-change: transform, opacity;
}

.ad-window-card.is-shifting {
  display: block;
  animation: adShiftLeft 1.18s cubic-bezier(0.22, 1, 0.36, 1) both;
  will-change: transform, opacity;
}

.ad-window-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(8px) brightness(0.45) saturate(1.04);
  transform: translate3d(0, 0, 0) scale(1.05);
}

.ad-window-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.42), transparent 26%, transparent 74%, rgba(0, 0, 0, 0.42));
  pointer-events: none;
}

.ad-window-fg {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ad-window-copy {
  position: absolute;
  left: 10px;
  bottom: 9px;
  display: inline-grid;
  width: fit-content;
  max-width: calc(100% - 24px);
  gap: 2px;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
  z-index: 2;
}

.ad-window-copy strong {
  font-size: clamp(14px, 1.7vw, 20px);
}

.ad-window-copy small {
  font-style: normal;
  font-size: 12px;
}

@keyframes adEnter {
  from {
    opacity: 0.18;
    transform: translate3d(calc(108% + var(--ad-gap)), 0, 0);
  }
  42% {
    opacity: 0.34;
    transform: translate3d(calc(104% + var(--ad-gap)), 0, 0);
  }
  72% {
    opacity: 0.72;
    transform: translate3d(calc(101% + var(--ad-gap)), 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(calc(100% + var(--ad-gap)), 0, 0);
  }
}

@keyframes adShiftLeft {
  from {
    opacity: 1;
    transform: translate3d(calc(100% + var(--ad-gap)), 0, 0);
  }
  42% {
    opacity: 0.34;
  }
  68% {
    opacity: 0.72;
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes adLeave {
  from {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
  to {
    opacity: 0;
    transform: translate3d(calc(-100% - var(--ad-gap)), 0, 0);
  }
}

.hero-carousel {
  position: relative;
  overflow: hidden;
  min-height: 0;
  aspect-ratio: 2.4 / 1;
  border-radius: 8px;
  background: #dbe5ec;
  box-shadow: var(--shadow);
}

.hero-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-copy {
  position: absolute;
  left: 24px;
  bottom: 22px;
  display: grid;
  gap: 5px;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.hero-copy strong {
  font-size: 28px;
}

.hero-copy em,
.hero-copy small {
  font-style: normal;
}

.dots {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: flex;
  gap: 8px;
}

.dots button {
  width: 10px;
  height: 10px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.68);
}

.dots button.active {
  width: 22px;
  border-radius: 999px;
  background: #fff;
}

.category-tabs {
  position: sticky;
  top: 63px;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 1fr);
  align-items: center;
  gap: 22px;
  overflow-x: auto;
  margin: 18px 0;
  padding: 12px 4px;
  background: var(--bg);
}

.app-nav-links {
  display: flex;
  gap: 22px;
  min-width: 0;
}

.post-nav-links {
  display: flex;
  gap: 22px;
  justify-self: start;
}

.category-tabs a {
  position: relative;
  flex: 0 0 auto;
  padding: 8px 0;
  color: var(--muted);
  font-weight: 700;
}

.category-tabs a.active {
  color: var(--ink);
}

.category-tabs a.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  border-radius: 999px;
  background: var(--mint);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 22px;
  align-items: start;
}

.content-grid.is-sidebar-closed {
  grid-template-columns: 1fr;
}

.post-search {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.post-search input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.post-search button {
  min-width: 96px;
  padding: 0 16px;
  border-radius: 8px;
  color: #fff;
  background: var(--mint);
}

.feed,
.detail-content,
.related-list,
.post-list {
  display: grid;
  gap: 12px;
}

.app-card {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.app-icon,
.detail-icon {
  width: 68px;
  height: 68px;
  border-radius: 16px;
  object-fit: cover;
  background: #eef3f7;
}

.app-main h3,
.app-main p {
  margin: 0;
}

.app-main {
  min-width: 0;
  overflow: hidden;
}

.app-main h3 a {
  color: inherit;
}

.app-main p {
  margin-top: 5px;
  color: var(--muted);
}

.app-tagline,
.detail-tagline,
.post-summary {
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  max-width: 100%;
  word-break: break-word;
  white-space: pre-line;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.app-meta,
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.app-actions {
  display: flex;
  gap: 8px;
}

.btn {
  display: inline-flex;
  min-width: 66px;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: 8px;
}

.btn-primary {
  color: #fff;
  background: var(--mint);
}

.btn-primary:hover {
  background: var(--mint-dark);
}

.btn-secondary {
  color: var(--ink);
  background: #eef3f7;
}

.sidebar-ads {
  position: sticky;
  top: 126px;
  display: grid;
  gap: 12px;
}

.detail-sidebar-ads {
  position: relative;
  top: auto;
  align-self: start;
  gap: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}

.sidebar-ad-close {
  position: absolute;
  top: 4px;
  right: 10px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  color: #111827;
  background: transparent;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  z-index: 3;
}

.detail-sidebar-ads .ad-card {
  border: 1px solid var(--line);
  padding: 34px 10px 10px;
  box-shadow: none;
}

.ad-card {
  position: relative;
  display: grid;
  gap: 8px;
  overflow: hidden;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.ad-card img {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 6px;
  object-fit: cover;
  background: #edf2f5;
}

.ad-label {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 12px;
}

.ad-title {
  font-weight: 800;
}

.ad-desc {
  color: var(--muted);
  font-size: 13px;
}

.result-head,
.section-head,
.empty-state,
.detail-hero,
.detail-content {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.section-head,
.result-head {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
}

.section-head strong {
  color: var(--ink);
}

.post-card {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.post-cover img {
  width: 168px;
  aspect-ratio: 16 / 10;
  border-radius: 6px;
  object-fit: cover;
  background: #eef3f7;
}

.post-main {
  display: grid;
  align-content: center;
  gap: 8px;
  min-width: 0;
}

.post-title {
  font-size: 20px;
  font-weight: 800;
}

.post-title:hover {
  color: var(--mint-dark);
}

.post-main p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.detail-hero .detail-tagline {
  display: block;
  overflow: visible;
  margin: 0;
  white-space: pre-line;
  -webkit-line-clamp: unset;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.article-detail {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.article-cover {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  background: #eef3f7;
}

.article-head,
.article-body {
  padding: 22px;
}

.article-head h1 {
  margin: 8px 0;
  font-size: 32px;
}

.article-head p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.8;
}

.article-body {
  padding-top: 0;
  color: #2d3742;
  font-size: 16px;
  line-height: 1.9;
}

.article-inline-image {
  margin: 22px 0;
}

.article-inline-image img {
  width: 100%;
  max-height: 520px;
  border-radius: 8px;
  object-fit: contain;
  background: #eef3f7;
}

.article-inline-image figcaption {
  margin-top: 8px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.article-inline-video {
  margin: 24px 0;
}

.article-inline-video video {
  width: 100%;
  max-height: 560px;
  border-radius: 8px;
  background: #111820;
}

.article-inline-video figcaption {
  margin-top: 8px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.detail-hero {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
}

.detail-icon {
  width: 92px;
  height: 92px;
}

.crumb {
  color: var(--mint-dark);
  font-weight: 800;
}

.detail-hero h1 {
  margin: 5px 0;
  font-size: 30px;
}

.detail-hero p,
.detail-content p {
  color: var(--muted);
  line-height: 1.7;
}

.mobile-ad-trigger,
.mobile-ad-drawer {
  display: none;
}

@media (max-width: 900px) {
  .category-tabs {
    display: flex;
    grid-template-columns: none;
    gap: 28px;
    overflow-x: auto;
    overflow-y: hidden;
    margin: 14px -18px;
    padding: 10px 18px 12px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .category-tabs::-webkit-scrollbar {
    display: none;
  }

  .app-nav-links,
  .post-nav-links {
    flex: 0 0 auto;
    gap: 18px;
    min-width: max-content;
  }

  .category-tabs a {
    min-height: 38px;
    padding: 9px 0;
  }

  .site-header {
    display: grid;
    gap: 12px;
  }

  .search {
    width: 100%;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .sidebar-ads {
    display: none;
  }

  .app-card {
    grid-template-columns: 56px minmax(0, 1fr);
    align-items: start;
  }

  .app-main h3,
  .app-tagline,
  .detail-tagline,
  .app-meta {
    min-width: 0;
  }

  .app-tagline,
  .detail-tagline {
    word-break: break-all;
  }

  .post-card {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
  }

  .post-cover img {
    width: 100%;
  }

  .post-title {
    font-size: 17px;
  }

  .post-main {
    gap: 6px;
  }

  .post-summary {
    line-height: 1.55;
  }

  .app-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
  }

  .app-actions {
    grid-column: 1 / -1;
  }

  .app-actions .btn {
    flex: 1;
  }

  .detail-hero {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .detail-icon {
    width: 72px;
    height: 72px;
  }

  .detail-download {
    grid-column: 1 / -1;
  }

  .mobile-ad-trigger,
  .mobile-ad-drawer {
    display: none;
  }
}
