:root {
  --bg: #f6f8fc;
  --panel: #ffffff;
  --line: #e3eaf5;
  --text: #111827;
  --muted: #667085;
  --soft: #eef4ff;
  --blue: #2563eb;
  --blue-2: #60a5fa;
  --green: #12b981;
  --orange: #fb923c;
  --shadow: 0 18px 48px rgba(31, 74, 160, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background: linear-gradient(180deg, #ffffff 0, var(--bg) 280px, #ffffff 100%);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 210px auto minmax(340px, 520px);
  gap: 20px;
  align-items: center;
  min-height: 72px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: block;
  border-radius: 12px;
}

.brand strong {
  display: block;
  font-size: 21px;
  line-height: 1.1;
}

.brand small {
  display: block;
  margin-top: 2px;
  color: #7b8497;
  font-size: 12px;
  letter-spacing: 0;
}

.nav {
  position: relative;
  display: flex;
  gap: 24px;
  align-items: center;
  font-weight: 600;
}

.nav a {
  position: relative;
  z-index: 1;
  padding: 25px 0 22px;
  color: #172033;
  border-bottom: 3px solid transparent;
  transition:
    color 180ms ease,
    transform 180ms ease;
}

.nav a.active,
.nav a:hover {
  color: var(--blue);
}

.nav a:hover {
  transform: translateY(-1px);
}

.nav-indicator {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--blue-2));
  opacity: 0;
  transform: translateX(0);
  transition:
    transform 260ms cubic-bezier(0.2, 0.8, 0.2, 1),
    width 260ms cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 160ms ease;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  height: 50px;
  padding: 5px 5px 5px 16px;
  border: 1px solid #dbe5f4;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition:
    border-color 180ms ease,
    background 180ms ease;
}

.search:focus-within {
  border-color: #7aa2ff;
  background: #fff;
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  font-size: 18px;
  line-height: 1.25;
  background: transparent;
}

.search input::placeholder {
  color: #8a96aa;
}

.search-icon {
  display: grid;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  color: var(--blue);
  background: #eef4ff;
  font-size: 17px;
}

.search-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  min-width: 78px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: #2563eb;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition:
    background 180ms ease,
    transform 160ms ease;
}

.search-btn:hover {
  background: #1d4ed8;
}

.search-btn:active {
  transform: scale(0.98);
}

.hero-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  padding: 0 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 700;
  white-space: nowrap;
  background: #fff;
}

.btn.primary {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #2f6df6, #1d4ed8);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.22);
}

.btn.large {
  height: 50px;
  padding: 0 24px;
}

.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 360px;
  gap: 24px;
  max-width: 1640px;
  margin: 18px auto 46px;
  padding: 0 18px;
}

.site-footer {
  display: grid;
  justify-items: center;
  max-width: 1640px;
  margin: 8px auto 0;
  padding: 32px 18px 36px;
  color: var(--muted);
  font-size: 14px;
}

.footer-brand,
.footer-meta {
  display: flex;
  flex-wrap: wrap;
}

.footer-brand {
  align-items: center;
  gap: 12px;
  justify-content: center;
  text-align: left;
}

.footer-brand img {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 10px;
}

.footer-brand strong {
  color: var(--text);
  font-size: 16px;
}

.footer-brand p {
  max-width: 460px;
  margin: 4px 0 0;
  line-height: 1.7;
}

.footer-meta {
  align-items: center;
  justify-content: center;
  gap: 8px 18px;
  padding-top: 8px;
}

.footer-meta span:last-child {
  margin-left: 0;
}

.layout:has(.rightbar:empty) {
  grid-template-columns: 260px minmax(0, 1fr);
}

.layout.no-sidebar,
.layout.no-sidebar:has(.rightbar:empty) {
  grid-template-columns: minmax(0, 1fr);
}

.rightbar:empty {
  display: none;
}

/* 左侧软件分类的位置：桌面端轻微靠左，窄屏时会自动回到正常边距。 */
.sidebar {
  margin-left: -2px;
}

.panel {
  margin-bottom: 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.rightbar {
  align-self: start;
}

.panel h2,
.section-head h2 {
  margin: 0;
  font-size: 18px;
}

.category-list {
  display: grid;
  gap: 4px;
  margin-top: 18px;
}

.category-list a {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 38px;
  color: #263244;
  border-radius: 8px;
}

.category-list a:hover,
.category-list a.active {
  color: var(--blue);
  background: var(--soft);
}

.category-list a.active .mini-icon {
  color: #fff;
  background: var(--blue);
}

.category-list:empty::after {
  content: "暂无分类";
  display: block;
  padding: 12px 0;
  color: var(--muted);
  font-size: 14px;
}

.mini-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 7px;
  color: var(--blue);
  background: #eef4ff;
  font-size: 12px;
  font-weight: 800;
}

.category-count,
.muted {
  color: #8b96aa;
}

.category-count {
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #f1f5fb;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.category-list a.active .category-count {
  color: var(--blue);
  background: #fff;
}

.ranking-list {
  display: grid;
  gap: 8px;
  margin: 18px 0 20px;
  padding: 0;
  list-style: none;
}

.ranking-list li {
  display: grid;
  grid-template-columns: 30px 42px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  min-height: 58px;
  padding: 8px;
  border-radius: 10px;
  transition: background 180ms ease;
}

.ranking-list li:hover {
  background: #f5f8ff;
}

.rank-badge {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  background: #94a3b8;
}

.ranking-list li:nth-child(1) .rank-badge {
  background: linear-gradient(135deg, #ff9f1c, #f97316);
}

.ranking-list li:nth-child(2) .rank-badge {
  background: linear-gradient(135deg, #60a5fa, #2563eb);
}

.ranking-list li:nth-child(3) .rank-badge {
  background: linear-gradient(135deg, #34d399, #059669);
}

.rank-logo,
.rank-logo-link {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
}

.rank-logo {
  overflow: hidden;
  border-radius: 9px;
  color: #fff;
  background: var(--logo-color);
  font-weight: 900;
}

.rank-logo img {
  width: 70%;
  height: 70%;
  object-fit: contain;
}

.rank-info {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.ranking-list a {
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-list small {
  color: var(--muted);
  font-size: 13px;
}

.wide-link,
.text-link {
  display: block;
  color: var(--blue);
  font-weight: 700;
}

.wide-link {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
  transition:
    background 180ms ease,
    border-color 180ms ease;
}

.wide-link:hover {
  border-color: #c7d7f7;
  background: #f5f8ff;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  min-height: 310px;
  overflow: hidden;
  padding: 50px 44px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    radial-gradient(circle at 72% 35%, #dbeafe, transparent 32%),
    linear-gradient(135deg, #edf4ff, #f9fbff 62%, #e5f0ff);
}

.hero h1 {
  margin: 0 0 12px;
  font-size: 38px;
  line-height: 1.15;
}

.subtitle {
  margin: 0 0 28px;
  color: #12223b;
  font-size: 22px;
  font-weight: 700;
}

.hero p:not(.subtitle) {
  color: var(--muted);
  line-height: 1.8;
}

.hero-art {
  position: relative;
  min-height: 230px;
}

.box {
  position: absolute;
  right: 80px;
  bottom: 0;
  width: 250px;
  height: 150px;
  border-radius: 12px 12px 26px 26px;
  background: linear-gradient(160deg, #3467ec, #dce8ff);
  box-shadow: 0 32px 48px rgba(37, 99, 235, 0.22);
}

.box::before {
  content: "";
  position: absolute;
  inset: -42px 24px auto;
  height: 70px;
  border-radius: 18px;
  background: linear-gradient(135deg, #2f65f4, #8bb5ff);
}

.floating-card {
  position: absolute;
  display: grid;
  width: 66px;
  height: 66px;
  place-items: center;
  border-radius: 16px;
  color: white;
  font-weight: 900;
  background: #111827;
  box-shadow: 0 18px 34px rgba(31, 41, 55, 0.18);
}

.floating-card:has(.has-favicon) {
  background: transparent;
  box-shadow: none;
}

.hero-logo {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  border-radius: inherit;
  color: #fff;
  background: var(--logo-color);
  font-weight: 900;
}

.hero-logo img {
  width: 72%;
  height: 72%;
  object-fit: contain;
}

.hero-logo span {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
}

.card-1 {
  right: 240px;
  top: 10px;
  color: #2f80ed;
  transform: rotate(-15deg);
}

.card-2 {
  right: 50px;
  top: -22px;
}

.card-3 {
  right: 150px;
  top: 22px;
  color: #2496ed;
  transform: rotate(8deg);
}

.card-4 {
  right: 132px;
  top: 108px;
  transform: rotate(-8deg);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 24px 0 12px;
}

.section-head h2 {
  letter-spacing: 0;
}

.section-head.result-head {
  align-items: flex-end;
}

.section-head.result-head p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.section-head a,
.panel-title-row a {
  color: var(--blue);
  font-weight: 700;
}

.category-cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
}

/* 热门分类卡片：默认状态保持干净，交互时只改变背景色。 */
.category-card {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 4px 12px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  transition:
    background 180ms ease,
    border-color 180ms ease;
}

/* 前台 hover 统一不使用外阴影，也不上浮，只用浅蓝背景提示可点击。 */
.category-card:hover,
.site-row:hover,
.rank-table article:hover {
  border-color: #c7d7f7;
  background: #f5f8ff;
}

.category-card small {
  color: var(--muted);
}

.round-icon {
  display: grid;
  grid-row: span 2;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 50%;
  color: var(--blue);
  font-weight: 900;
  background: #eaf2ff;
}

.round-icon.pale {
  color: #6d5dfc;
  background: #f1ecff;
}

.site-list {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.search-summary {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(135deg, #f8fbff, #eef5ff);
}

.search-summary span {
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
}

.search-summary h1 {
  margin: 7px 0;
  font-size: 30px;
}

.search-summary p {
  margin: 0;
  color: var(--muted);
}

.search-result-list {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.search-result-list .site-row {
  padding: 16px 18px;
}

.search-result-list .site-row:last-child {
  border-bottom: 0;
}

/* 软件列表行：背景色变化即可，避免 hover 时产生跳动感。 */
.site-row {
  display: grid;
  grid-template-columns: 58px minmax(220px, 1fr) auto 86px 72px 78px;
  gap: 14px;
  align-items: center;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition:
    background 180ms ease,
    border-color 180ms ease;
}

.site-row:last-child {
  border-bottom: 0;
}

.site-row:hover {
  border-radius: 0;
}

.site-logo,
.recommend-logo {
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--logo-color);
  font-weight: 900;
}

.site-logo-link {
  display: inline-grid;
  width: 54px;
  height: 54px;
}

.auto-logo {
  overflow: hidden;
}

.auto-logo img {
  width: 72%;
  height: 72%;
  object-fit: contain;
}

.auto-logo span {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
}

.auto-logo img:not([hidden]) + span {
  display: none;
}

.auto-logo.has-favicon {
  background: transparent;
}

.auto-logo.has-favicon img {
  width: 100%;
  height: 100%;
}

.auto-logo.has-favicon img[hidden] + span {
  display: grid;
}

.auto-logo.has-favicon:has(img[hidden]) {
  background: var(--logo-color);
}

.site-logo {
  width: 54px;
  height: 54px;
  border-radius: 10px;
}

.site-heading {
  display: flex;
  gap: 12px;
  align-items: baseline;
}

.site-heading a {
  font-size: 17px;
  font-weight: 800;
}

.site-heading a:hover,
.ranking-list a:hover,
.recommend-list strong:hover {
  color: var(--blue);
}

.site-heading span,
.site-main p,
.panel-copy {
  color: var(--muted);
}

.site-main p {
  margin: 6px 0 0;
  font-size: 14px;
}

.site-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.site-tags a,
.tag-cloud a {
  padding: 6px 12px;
  border-radius: 8px;
  color: #4f6693;
  background: #f1f5fb;
  font-size: 13px;
}

/* 访问按钮：hover 和按下时只换背景色，不加阴影。 */
.download-btn {
  display: inline-flex;
  justify-content: center;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--blue);
  font-weight: 800;
  background: #fff;
  transition:
    color 180ms ease,
    background 180ms ease;
}

.download-btn:hover {
  color: #fff;
  background: var(--blue);
}

.panel-title-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.recommend-list {
  display: grid;
  gap: 4px;
  margin-top: 14px;
}

.recommend-list a {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 60px;
  padding: 6px 8px;
  border-radius: 8px;
  transition: background 180ms ease;
}

.recommend-list a:hover {
  background: #f5f8ff;
}

.recommend-logo {
  width: 42px;
  height: 42px;
  border-radius: 8px;
}

.recommend-list small,
.recommend-list em {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-style: normal;
}

.recommend-list em {
  color: #f59e0b;
}

.compact-site-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.compact-site-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.compact-site {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 70px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  transition:
    background 180ms ease,
    border-color 180ms ease;
}

.compact-site:hover {
  border-color: #c7d7f7;
  background: #f5f8ff;
}

.compact-site span {
  min-width: 0;
}

.compact-site strong,
.compact-site small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-site small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.tag-cloud {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 18px 0 24px;
}

.page-heading {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.page-heading h1 {
  margin: 0 0 6px;
}

.page-heading p {
  margin: 0;
  color: var(--muted);
}

.rank-table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

/* 排行榜行：与软件列表保持一致，只做背景色反馈。 */
.rank-table article {
  display: grid;
  grid-template-columns: 54px 52px minmax(0, 1fr) 90px 78px;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  cursor: pointer;
  transition: background 180ms ease;
}

.rank-table article + article {
  border-top: 1px solid var(--line);
}

.rank-number {
  color: var(--blue);
  font-size: 20px;
  font-weight: 900;
}

.rank-table a {
  font-weight: 800;
}

.rank-table p {
  margin: 5px 0 0;
  color: var(--muted);
}

.empty-state,
.empty-page {
  padding: 48px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: #fff;
  text-align: center;
}

.rightbar .panel:last-child,
.sidebar .panel:last-child {
  margin-bottom: 0;
}

.search-empty h2 {
  margin: 0 0 8px;
  color: var(--text);
}

.search-empty p {
  margin: 0 0 18px;
}

/* 滚动淡入：只影响页面首次进入视口的透明度和位置。 */
.reveal-item {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity 520ms ease,
    transform 520ms ease;
}

.reveal-item.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* 点击反馈：按下时用更深一点的背景色，不做缩放。 */
.is-pressing {
  background: #eaf2ff !important;
}

.admin-hero,
.admin-title-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}

.admin-hero h1,
.admin-title-row h1 {
  margin: 0 0 8px;
}

.admin-hero p,
.admin-title-row p {
  margin: 0;
  color: var(--muted);
}

.admin-actions,
.form-actions,
.row-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}

.admin-stats article,
.admin-grid a {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}

.admin-stats span {
  display: block;
  margin-bottom: 8px;
  color: var(--blue);
  font-size: 30px;
  font-weight: 900;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.admin-grid strong {
  font-size: 18px;
}

.admin-grid p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.flash-list {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.flash-list p {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  color: #166534;
  background: #f0fdf4;
}

.admin-table {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}

.admin-table article {
  display: grid;
  grid-template-columns: 54px minmax(220px, 1fr) 120px 88px 128px;
  gap: 14px;
  align-items: center;
  padding: 15px 18px;
}

.admin-table.compact-table article {
  grid-template-columns: 58px minmax(220px, 1fr) 100px 128px;
}

.admin-table article + article {
  border-top: 1px solid var(--line);
}

.admin-table p {
  margin: 5px 0 0;
  color: var(--muted);
}

.small-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--blue);
  font: inherit;
  font-weight: 800;
  background: #fff;
  cursor: pointer;
}

.small-btn.danger {
  color: #dc2626;
}

.admin-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}

.admin-form.narrow-form {
  max-width: 720px;
}

.admin-form label {
  display: grid;
  gap: 8px;
  color: #263244;
  font-weight: 800;
}

.admin-form input,
.admin-form textarea,
.admin-form select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  color: var(--text);
  font: inherit;
  background: #fff;
}

.admin-form textarea {
  resize: vertical;
}

.wide-field,
.form-actions {
  grid-column: 1 / -1;
}

.check-field {
  display: flex !important;
  grid-template-columns: auto 1fr;
  flex-direction: row;
  gap: 10px !important;
  align-items: center;
  min-height: 44px;
}

.check-field input {
  width: 18px;
  min-height: 18px;
}

@media (max-width: 1280px) {
  .topbar {
    grid-template-columns: 200px 1fr;
  }

  .nav {
    order: 3;
    grid-column: 1 / -1;
    justify-content: center;
  }

  .search {
    justify-self: end;
  }

  .layout {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .layout:has(.rightbar:empty) {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .rightbar {
    position: static;
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
  }

  .category-cards {
    grid-template-columns: repeat(3, 1fr);
  }

  .compact-site-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .layout,
  .layout:has(.rightbar:empty),
  .rightbar {
    grid-template-columns: 1fr;
  }

  .content {
    order: 2;
  }

  .sidebar {
    order: 1;
    margin-left: 0;
  }

  .rightbar {
    order: 3;
  }

  .layout:has(.content [data-page="home"]) .content {
    order: 1;
  }

  .layout:has(.content [data-page="home"]) .sidebar {
    order: 2;
  }

  .layout:has(.content [data-page="home"]) {
    display: flex;
    flex-direction: column;
  }

  .layout:has(.content [data-page="home"]) .content,
  .layout:has(.content [data-page="home"]) [data-page="home"] {
    display: contents;
  }

  .layout:has(.content [data-page="home"]) .hero {
    order: 1;
  }

  .layout:has(.content [data-page="home"]) .sidebar {
    order: 2;
  }

  .layout:has(.content [data-page="home"]) .section-head,
  .layout:has(.content [data-page="home"]) .site-list,
  .layout:has(.content [data-page="home"]) .search-summary,
  .layout:has(.content [data-page="home"]) .search-result-list {
    order: 3;
  }

  .site-row {
    grid-template-columns: 56px minmax(0, 1fr) 82px;
    gap: 12px;
    padding: 14px;
  }

  .site-tags,
  .site-row .muted {
    grid-column: 2 / -1;
  }

  .download-btn {
    grid-column: 3;
    grid-row: 1;
  }

  .rank-table article {
    grid-template-columns: 36px 50px minmax(0, 1fr) 82px;
    gap: 12px;
    padding: 14px;
  }

  .rank-table strong {
    grid-column: 3;
  }

  .rank-table .download-btn {
    grid-column: 4;
    grid-row: 1;
  }

  .compact-site-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .topbar,
  .hero,
  .rightbar {
    grid-template-columns: 1fr;
  }

  .sidebar > :not(:first-child),
  .rightbar {
    display: none;
  }

  .layout:has(.content [data-page="rankings"]) .sidebar {
    display: none;
  }

  .topbar {
    position: static;
    gap: 14px;
    padding: 14px;
  }

  .brand {
    justify-content: center;
  }

  .nav {
    grid-column: auto;
    justify-content: center;
    overflow-x: auto;
  }

  .nav a {
    padding: 6px 0 10px;
  }

  .search {
    width: 100%;
    justify-self: stretch;
  }

  .search {
    height: 50px;
    max-width: 560px;
    justify-self: center;
  }

  .search-btn {
    min-width: 68px;
    padding: 0 14px;
  }

  .hero {
    padding: 34px 24px;
    border-radius: 14px;
    overflow: hidden;
  }

  .hero h1 {
    font-size: 34px;
  }

  .hero-art {
    min-height: 170px;
  }

  .box {
    right: 36px;
    width: 200px;
    height: 132px;
  }

  .category-cards {
    grid-template-columns: 1fr;
  }

  .search-summary,
  .section-head.result-head {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-hero,
  .admin-title-row {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-actions,
  .form-actions {
    flex-wrap: wrap;
  }

  .admin-stats,
  .admin-grid,
  .admin-form {
    grid-template-columns: 1fr;
  }

  .admin-table article,
  .admin-table.compact-table article {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .admin-table article > span:not(.recommend-logo):not(.round-icon),
  .row-actions {
    grid-column: 2;
  }

  .site-row {
    grid-template-columns: 56px minmax(0, 1fr) 72px;
    padding: 14px;
  }

  .site-tags,
  .site-row .muted {
    grid-column: 2 / -1;
  }

  .download-btn {
    grid-column: 3;
    grid-row: 1;
  }

  .rank-table article {
    grid-template-columns: 32px 46px minmax(0, 1fr) 72px;
  }

  .rank-table strong {
    grid-column: 3;
  }

  .rank-table .download-btn {
    grid-column: 4;
    grid-row: 1;
  }
}

@media (max-width: 640px) {
  .layout {
    gap: 14px;
    margin: 14px auto 34px;
    padding: 0 12px;
  }

  .hero {
    gap: 8px;
    min-height: auto;
    padding: 26px 20px 22px;
  }

  .hero h1 {
    font-size: 30px;
  }

  .subtitle {
    margin-bottom: 18px;
    font-size: 20px;
  }

  .hero p:not(.subtitle) {
    margin-bottom: 0;
    line-height: 1.7;
  }

  .hero-art {
    min-height: 150px;
  }

  .box {
    right: 22px;
    width: 190px;
    height: 118px;
  }

  .box::before {
    inset: -30px 20px auto;
    height: 54px;
  }

  .floating-card {
    width: 54px;
    height: 54px;
    border-radius: 13px;
  }

  .card-1 {
    right: 205px;
    top: 18px;
  }

  .card-2 {
    right: 28px;
    top: -4px;
  }

  .card-3 {
    right: 122px;
    top: 34px;
  }

  .card-4 {
    right: 112px;
    top: 100px;
  }

  .panel {
    padding: 14px;
    border-radius: 10px;
  }

  .sidebar .panel h2 {
    margin-bottom: 12px;
  }

  .page-heading {
    gap: 12px;
    padding: 18px;
  }

  .page-heading h1 {
    font-size: 28px;
    line-height: 1.18;
  }

  .category-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 8px;
    margin-top: 0;
  }

  .category-list a {
    grid-template-columns: 28px minmax(0, 1fr) auto;
    min-height: 42px;
    padding: 4px 8px 4px 0;
  }

  .site-row,
  .search-result-list .site-row {
    grid-template-columns: 48px minmax(0, 1fr) 72px;
    gap: 10px 12px;
    align-items: start;
    padding: 14px;
  }

  .site-logo-link {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .site-logo-link,
  .site-logo {
    width: 48px;
    height: 48px;
  }

  .site-main {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }

  .site-heading {
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
  }

  .site-heading a {
    font-size: 16px;
  }

  .site-heading span {
    font-size: 13px;
  }

  .site-main p {
    margin-top: 4px;
    line-height: 1.55;
  }

  .site-tags {
    display: none;
  }

  .site-row .muted {
    grid-row: 2;
    font-size: 13px;
  }

  .site-row > .muted:nth-child(4) {
    grid-column: 2;
  }

  .site-row > .muted:nth-child(5) {
    grid-column: 3;
    justify-self: center;
  }

  .download-btn {
    grid-column: 3;
    grid-row: 1;
    min-height: 36px;
    padding: 7px 12px;
  }

  .rank-table article {
    grid-template-columns: 28px 44px minmax(0, 1fr) 72px;
    gap: 10px;
    align-items: start;
    padding: 14px;
  }

  .rank-number {
    font-size: 18px;
  }

  .rank-table p {
    line-height: 1.55;
  }

  .rank-table strong {
    grid-column: 3;
    align-self: center;
  }

  .rank-table .download-btn {
    grid-column: 4;
    grid-row: 1;
  }
}
