:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #1d2a32;
  --muted: #65737e;
  --line: #dfe6ea;
  --blue: #1769aa;
  --blue-dark: #0d4f84;
  --green: #1f8a70;
  --gold: #a86f16;
  --red: #b42318;
  --shadow: 0 16px 40px rgba(29, 42, 50, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(23, 105, 170, 0.1), transparent 320px),
    var(--bg);
  color: var(--ink);
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    "Segoe UI",
    Arial,
    sans-serif;
}

a {
  color: inherit;
}

.app {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 56px;
}

.search-panel,
.quick-section,
.results-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.search-panel {
  padding: 28px;
}

.brand-row,
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.subtitle {
  max-width: 620px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.admin-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--blue-dark);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 5vw, 48px);
  line-height: 1.08;
}

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

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.stat-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
  color: var(--muted);
}

.stat-item span {
  display: block;
  color: var(--blue-dark);
  font-size: 26px;
  font-weight: 800;
}

.stat-item p {
  margin-bottom: 0;
}

.search-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 26px;
}

input[type="search"] {
  width: 100%;
  min-height: 52px;
  border: 1px solid #c8d5dc;
  border-radius: 8px;
  padding: 0 16px;
  color: var(--ink);
  font-size: 16px;
  outline: none;
}

input[type="search"]:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(23, 105, 170, 0.14);
}

button,
.visit-link,
.quick-link {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
}

#clearButton {
  padding: 0 18px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.filter-grid {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 18px;
  align-items: end;
  margin-top: 18px;
}

.filter-label {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.district-filter {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

select {
  width: 100%;
  min-height: 40px;
  border: 1px solid #c8d5dc;
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.chip {
  padding: 0 16px;
  border: 1px solid var(--line);
  background: #f8fafb;
  color: var(--ink);
}

.chip.is-active {
  border-color: var(--blue);
  background: #e9f3fb;
  color: var(--blue-dark);
  font-weight: 700;
}

.quick-section,
.results-section {
  margin-top: 18px;
  padding: 24px;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.quick-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 12px 14px;
  background: #eef6f4;
  color: #155f4d;
  font-weight: 700;
  text-decoration: none;
}

.quick-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-link small {
  color: var(--green);
  font-size: 18px;
}

.section-head p {
  margin-bottom: 0;
  color: var(--muted);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.site-card {
  display: flex;
  flex-direction: column;
  min-height: 218px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.site-card.is-station {
  min-height: 196px;
  border-left: 4px solid var(--green);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.category {
  padding: 4px 8px;
  border-radius: 6px;
  background: #fff4df;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.is-station .category {
  background: #eaf6f2;
  color: var(--green);
}

.site-card h3 {
  margin-bottom: 8px;
  font-size: 18px;
}

.site-card p {
  color: var(--muted);
  line-height: 1.65;
  word-break: break-word;
}

.url-line {
  margin-top: auto;
  color: var(--blue-dark);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

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

.tags span {
  padding: 4px 8px;
  border-radius: 6px;
  background: #f1f5f7;
  color: #4c5b66;
  font-size: 12px;
}

.visit-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  padding: 0 14px;
  background: var(--blue-dark);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.empty-state {
  margin-top: 16px;
  padding: 28px;
  border: 1px dashed #b7c6cf;
  border-radius: 8px;
  text-align: center;
}

.empty-state p {
  margin-bottom: 0;
  color: var(--muted);
}

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

@media (max-width: 860px) {
  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .brand-row,
  .section-head {
    flex-direction: column;
  }

  .site-count {
    text-align: left;
  }

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

@media (max-width: 560px) {
  .app {
    width: min(100% - 20px, 1160px);
    padding-top: 18px;
  }

  .search-panel,
  .quick-section,
  .results-section {
    padding: 18px;
  }

  .search-box {
    grid-template-columns: 1fr;
  }

  #clearButton {
    width: 100%;
  }

  .card-actions {
    align-items: stretch;
    flex-direction: column;
  }
}
