:root {
  color-scheme: light;
  --bg: #f6f4ee;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --ink: #211c17;
  --muted: #756d64;
  --line: #e5ded2;
  --accent: #b74932;
  --accent-dark: #7a2f23;
  --green: #23694f;
  --gold: #bd8834;
  --blue: #2d5d83;
  --shadow: 0 18px 50px rgba(45, 36, 24, .10);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(183, 73, 50, .12), transparent 32rem),
    linear-gradient(180deg, #fbf8f1 0%, var(--bg) 24rem);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid rgba(229, 222, 210, .82);
  background: rgba(255, 253, 248, .88);
  backdrop-filter: blur(18px);
}

.nav {
  min-height: 72px;
  display: grid;
  grid-template-columns: auto 1fr minmax(260px, 360px);
  gap: 28px;
  align-items: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  width: 118px;
}

.brand img {
  display: block;
  width: 110px;
  height: auto;
}

.brand-text {
  width: auto;
  min-width: 96px;
  color: var(--ink);
  font-size: 25px;
  font-weight: 900;
  letter-spacing: 0;
}

.brand-text:hover {
  color: var(--accent-dark);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link,
.text-btn,
.chip,
.icon-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
}

.nav-link {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  white-space: nowrap;
}

.nav-link:hover,
.nav-link.is-active {
  background: #efe5d7;
  color: var(--accent-dark);
}

.nav-link:focus-visible,
.chip:focus-visible,
.icon-btn:focus-visible,
.text-btn:focus-visible,
.visit:focus-visible {
  outline: 3px solid rgba(183, 73, 50, .24);
  outline-offset: 2px;
}

.search {
  position: relative;
}

.search svg {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
}

.search input {
  width: 100%;
  height: 42px;
  padding: 0 14px 0 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  outline: 0;
  color: var(--ink);
  background: var(--surface-strong);
}

.search input:focus {
  border-color: rgba(183, 73, 50, .55);
  box-shadow: 0 0 0 4px rgba(183, 73, 50, .12);
}

.hero {
  padding: 64px 0 30px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr minmax(360px, 520px);
  gap: 42px;
  align-items: end;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(40px, 6vw, 68px);
  line-height: 1.08;
  letter-spacing: 0;
}

.lead {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 18px;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.hero-stats div {
  min-height: 96px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, .78);
}

.hero-stats strong {
  display: block;
  font-size: 32px;
  line-height: 1;
}

.hero-stats span {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.controls {
  padding: 10px 0 20px;
}

.control-grid {
  display: grid;
  grid-template-columns: .8fr 1.2fr 1.7fr;
  gap: 14px;
}

.filter-panel {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, .88);
  box-shadow: 0 12px 34px rgba(45, 36, 24, .06);
  transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
  scroll-margin-top: 92px;
}

.filter-panel.is-focused {
  border-color: rgba(183, 73, 50, .62);
  background: #fffaf4;
  box-shadow: 0 18px 44px rgba(183, 73, 50, .16);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  font-weight: 800;
}

.text-btn {
  padding: 0;
  color: var(--accent);
  font-size: 13px;
}

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

.chips-scroll {
  max-height: 116px;
  overflow: auto;
  padding-right: 4px;
}

.chip {
  min-height: 30px;
  max-width: 100%;
  padding: 5px 10px;
  border: 1px solid #eadfce;
  border-radius: 999px;
  background: #fffaf2;
  color: #4c443d;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.chip:hover,
.chip.is-active {
  border-color: rgba(183, 73, 50, .42);
  background: #f3dfd4;
  color: var(--accent-dark);
}

.catalog {
  padding: 20px 0 56px;
}

.catalog-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 14px;
}

.crumb {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 13px;
}

.crumb span {
  color: var(--accent);
}

h2 {
  margin-bottom: 0;
  font-size: 28px;
}

.view-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.icon-btn:hover,
.icon-btn.is-active {
  color: var(--accent-dark);
  border-color: rgba(183, 73, 50, .42);
  background: #fff6ef;
}

.active-filters {
  min-height: 30px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.filter-token {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #ece6dc;
  color: #40362f;
  font-size: 13px;
}

.filter-token button {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: rgba(33, 28, 23, .10);
  color: #40362f;
  line-height: 1;
}

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

.cards.compact {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.site-card {
  min-width: 0;
  min-height: 292px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid rgba(229, 222, 210, .95);
  border-radius: var(--radius);
  background: var(--surface-strong);
  box-shadow: 0 10px 26px rgba(45, 36, 24, .06);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.site-card:hover {
  transform: translateY(-3px);
  border-color: rgba(183, 73, 50, .36);
  box-shadow: var(--shadow);
}

.cards.compact .site-card {
  min-height: 244px;
  padding: 10px;
  gap: 10px;
}

.site-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  overflow: hidden;
  border: 1px solid #eee5da;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(183, 73, 50, .10), rgba(35, 105, 79, .10)),
    #f5efe7;
}

.site-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: top center;
}

.site-preview::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 -42px 42px rgba(33, 28, 23, .10);
}

.preview-fallback {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  color: rgba(122, 47, 35, .78);
  font-size: 42px;
  font-weight: 900;
}

.site-preview.is-failed img {
  display: none;
}

.site-preview.is-failed .preview-fallback {
  display: grid;
}

.cards.compact .site-preview {
  aspect-ratio: 16 / 8;
}

.site-title {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.site-mark {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: #f2e6d7;
  color: var(--accent-dark);
  font-weight: 900;
}

.site-card:nth-child(3n) .site-mark {
  background: #dcebe4;
  color: var(--green);
}

.site-card:nth-child(4n) .site-mark {
  background: #e0eaf1;
  color: var(--blue);
}

.site-card:nth-child(5n) .site-mark {
  background: #f1e5c9;
  color: #805b20;
}

.site-name {
  min-width: 0;
}

.site-name a,
.site-name button {
  max-width: 100%;
  display: inline-block;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 900;
  font-size: 18px;
  line-height: 1.2;
  overflow-wrap: anywhere;
  text-align: left;
}

.cards.compact .site-name a,
.cards.compact .site-name button {
  font-size: 16px;
}

.site-name a:hover,
.site-name button:hover {
  color: var(--accent);
}

.subtitle {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  max-width: 100%;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef3f0;
  color: #315246;
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.tag.type {
  background: #f8e5df;
  color: var(--accent-dark);
}

.tag.region {
  background: #e9eef5;
  color: #244a6b;
}

.site-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.visit {
  min-height: 32px;
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid rgba(183, 73, 50, .32);
  border-radius: var(--radius);
  color: var(--accent-dark);
  background: #fff6ef;
  font-size: 13px;
  font-weight: 800;
}

.visit:hover {
  border-color: rgba(183, 73, 50, .58);
  background: #f7e2d7;
}

.more-links {
  position: relative;
}

.more-links summary {
  min-height: 32px;
  list-style: none;
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: #fffdf8;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.more-links summary::-webkit-details-marker {
  display: none;
}

.more-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 6;
  min-width: 180px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.more-menu a {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--ink);
  font-size: 13px;
}

.more-menu a:hover {
  background: #f5eee4;
}

.empty {
  padding: 36px;
  border: 1px dashed #d4c8b8;
  border-radius: var(--radius);
  text-align: center;
  color: var(--muted);
  background: rgba(255, 253, 248, .72);
}

.empty strong,
.empty span {
  display: block;
}

.empty strong {
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 18px;
}

.footer {
  padding: 24px 0 34px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 253, 248, .64);
  font-size: 13px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.seo-copy,
.seo-directory {
  margin-top: 28px;
}


.site-card.is-featured {
  border-color: rgba(183, 73, 50, .28);
  box-shadow: 0 10px 28px rgba(45, 36, 24, .075);
}

.featured-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin: 0 0 5px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #f6ece4;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 900;
}

.seo-copy {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, .78);
}

.seo-copy h2 {
  margin-bottom: 10px;
  font-size: 22px;
}

.seo-copy p {
  margin-bottom: 14px;
  color: var(--muted);
}

.seo-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.seo-keywords a,
.detail-tags span {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff6ef;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
}

.seo-directory details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, .72);
}

.seo-directory summary {
  padding: 14px 18px;
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.seo-directory ul {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 14px;
  margin: 0;
  padding: 0 18px 18px;
  list-style: none;
}

.seo-directory li {
  min-width: 0;
  padding: 10px;
  border-radius: 6px;
  background: #fffdf8;
}

.seo-directory a {
  display: block;
  color: var(--ink);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.seo-directory span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.detail-nav {
  grid-template-columns: auto 1fr;
}

.detail-page {
  padding: 34px 0 70px;
}

.detail-page .crumb {
  margin-bottom: 16px;
}

.detail-page .crumb a {
  color: var(--accent-dark);
  font-weight: 800;
}

.detail-card {
  max-width: 860px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.detail-card h1 {
  font-size: clamp(34px, 5vw, 58px);
}

.detail-card h2 {
  margin: 24px 0 8px;
  font-size: 22px;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 4px;
}

.detail-links {
  margin: 0;
  padding-left: 20px;
}

.detail-links a {
  color: var(--accent-dark);
  font-weight: 900;
  overflow-wrap: anywhere;
}

@media (max-width: 1020px) {
  .nav {
    grid-template-columns: auto 1fr;
  }

  .search {
    grid-column: 1 / -1;
    margin-bottom: 14px;
  }

  .hero-grid,
  .control-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  .shell {
    width: min(100% - 22px, 1200px);
  }

  .nav {
    min-height: auto;
    padding: 12px 0;
    gap: 12px;
  }

  .brand {
    width: 96px;
  }

  .brand img {
    width: 96px;
  }

  .nav-links {
    overflow-x: auto;
    justify-content: flex-end;
  }

  .nav-link {
    padding: 0 10px;
    font-size: 14px;
  }

  .hero {
    padding-top: 34px;
  }

  .hero-grid {
    gap: 24px;
  }

  .hero-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hero-stats div {
    min-height: 82px;
    padding: 14px 10px;
  }

  .hero-stats strong {
    font-size: 24px;
  }

  .hero-stats span {
    font-size: 12px;
  }

  .catalog-head {
    align-items: flex-start;
  }

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

@media (max-width: 480px) {
  .nav {
    grid-template-columns: 1fr;
  }

  .nav-links {
    justify-content: flex-start;
  }

  .hero-stats {
    grid-template-columns: 1fr;
  }

  .catalog-head {
    flex-direction: column;
  }

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

  .site-card,
  .cards.compact .site-card {
    min-height: 276px;
  }
}

/* Optimized directory layout */
.workspace {
  padding-bottom: 54px;
}

.masthead {
  padding: 18px 0 12px;
}

.masthead-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 12px 16px;
  border: 1px solid rgba(229, 222, 210, .78);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, .58);
}

.masthead h1 {
  margin-bottom: 3px;
  font-size: 22px;
  line-height: 1.25;
}

.masthead .lead {
  max-width: 720px;
  font-size: 14px;
}

.masthead .eyebrow {
  display: none;
}

.masthead .hero-stats {
  display: flex;
  gap: 8px;
}

.masthead .hero-stats div {
  min-width: 86px;
  min-height: 52px;
  padding: 8px 11px;
  background: #fffdf8;
}

.masthead .hero-stats strong {
  font-size: 20px;
}

.masthead .hero-stats span {
  margin-top: 2px;
  font-size: 12px;
}

.app-layout {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.controls {
  position: sticky;
  top: 90px;
  max-height: calc(100vh - 110px);
  overflow: auto;
  padding: 0;
}

.filter-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  padding: 0 2px;
  color: var(--ink);
  font-weight: 900;
}


.control-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.filter-panel {
  padding: 14px;
  box-shadow: 0 10px 26px rgba(45, 36, 24, .045);
}

.panel-head {
  margin-bottom: 10px;
}

.chips {
  gap: 7px;
}

.chips-scroll {
  max-height: 260px;
}

.chip {
  min-height: 28px;
  padding: 4px 9px;
}

.catalog {
  min-width: 0;
  padding: 0 0 34px;
}

.catalog-head {
  margin: 0 0 10px;
  padding: 12px 0;
}

.catalog-head h2 {
  font-size: 24px;
}

.active-filters {
  min-height: 28px;
  margin-bottom: 12px;
}

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

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

.site-card {
  min-height: 276px;
  gap: 12px;
  padding: 10px;
}

.cards.compact .site-card {
  min-height: 228px;
}

.site-preview {
  aspect-ratio: 16 / 8.7;
}

.cards.compact .site-preview {
  aspect-ratio: 16 / 7.5;
}

.site-title {
  gap: 9px;
}

.site-mark {
  width: 32px;
  height: 32px;
}

.site-name a,
.site-name button {
  font-size: 17px;
}

.subtitle {
  margin-top: 3px;
}

.tag-list {
  max-height: 54px;
  overflow: hidden;
}

.site-actions {
  margin-top: auto;
}

@media (min-width: 1320px) {
  .shell {
    width: min(1320px, calc(100% - 40px));
  }

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

  .cards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

@media (max-width: 1020px) {
  .masthead-inner {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .app-layout {
    grid-template-columns: 1fr;
  }

  .controls {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .control-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .chips-scroll {
    max-height: 142px;
  }

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

@media (max-width: 760px) {
  .masthead {
    padding-top: 14px;
  }

  .masthead .hero-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    display: grid;
  }

  .control-grid {
    grid-template-columns: 1fr;
  }

  .catalog-head {
    position: static;
    padding-top: 6px;
  }

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

@media (max-width: 520px) {
  .masthead .hero-stats {
    grid-template-columns: 1fr;
  }

  .masthead-inner {
    padding: 12px;
  }

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

/* Final compact masthead override */
.masthead {
  padding: 18px 0 12px;
}

.masthead-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 12px 16px;
  border: 1px solid rgba(229, 222, 210, .78);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, .58);
}

.masthead .eyebrow {
  display: none;
}

.masthead h1 {
  margin-bottom: 3px;
  font-size: 22px;
  line-height: 1.25;
}

.masthead .lead {
  max-width: 720px;
  font-size: 14px;
}

.masthead .hero-stats {
  display: flex;
  grid-template-columns: none;
  gap: 8px;
}

.masthead .hero-stats div {
  min-width: 86px;
  min-height: 52px;
  padding: 8px 11px;
  background: #fffdf8;
}

.masthead .hero-stats strong {
  font-size: 20px;
}

.masthead .hero-stats span {
  margin-top: 2px;
  font-size: 12px;
}

@media (max-width: 1020px) {
  .masthead-inner {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

@media (max-width: 760px) {
  .masthead {
    padding-top: 14px;
  }

  .masthead .hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .masthead-inner {
    padding: 12px;
  }

  .masthead .hero-stats {
    grid-template-columns: 1fr;
  }
}
