:root {
  --bg: #f3f6f4;
  --surface: #ffffff;
  --ink: #142824;
  --muted: #3f5651;
  --label: #245048;
  --line: #dce8e4;
  --line-strong: #c5d6d0;
  --accent: #0c7c6b;
  --accent-strong: #085e52;
  --accent-soft: #e6f5f1;
  --stat-bg: #f6faf8;
  --danger-bg: #fff6f6;
  --danger-ink: #7a2430;
  --danger-line: #e7b4b4;
  --shadow: 0 8px 24px rgba(18, 49, 44, 0.06);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  border-top: 4px solid var(--accent);
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang HK", "PingFang TC", "Noto Sans CJK HK", "Noto Sans HK", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

::selection {
  background: #c7ebe3;
}

.wrap {
  width: min(1080px, calc(100% - 24px));
  margin-inline: auto;
}

.skip {
  position: absolute;
  left: 12px;
  top: 0;
  transform: translateY(-120%);
  background: var(--accent-strong);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 30;
}

.skip:focus {
  transform: none;
  top: 8px;
}

a {
  color: var(--accent-strong);
}

.site-header {
  padding: 20px 0 8px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.site-header h1 {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 6px 0 0;
  color: var(--muted);
}

.filter-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 12px 0 10px;
  background: rgba(243, 246, 244, 0.96);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 6px 16px rgba(18, 49, 44, 0.04);
}

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

.field span {
  display: block;
  margin-bottom: 4px;
  color: var(--label);
  font-size: 0.82rem;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.field input:focus,
.field select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.hint,
.footnote,
.site-footer {
  color: var(--muted);
}

.hint {
  margin: 10px 0 0;
  font-size: 0.82rem;
}

main {
  padding-bottom: 8px;
}

.result-count {
  margin: 16px 0 12px;
  font-weight: 700;
  scroll-margin-top: 13rem;
}

#results {
  scroll-margin-top: 13rem;
}

.status {
  margin: 12px 0;
  padding: 14px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
}

.status-error {
  border-style: solid;
  border-color: var(--danger-line);
  background: var(--danger-bg);
  color: var(--danger-ink);
}

.results {
  display: grid;
  gap: 12px;
}

.card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card h2 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.meta,
.ratio {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  margin: 12px 0 0;
}

.stats div {
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--stat-bg);
}

.stats dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.stats dd {
  margin: 2px 0 0;
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-main dd {
  color: var(--accent-strong);
  font-size: 1.18rem;
}

.stats dd.is-empty {
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 500;
}

.ratio {
  margin-top: 12px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.ratio span {
  margin-right: 6px;
  color: var(--muted);
}

.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.link-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.link-label {
  color: var(--muted);
  font-size: 0.92rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: none;
}

.chip:hover {
  background: #d7efe9;
}

.chip-outline {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
}

.chip-outline:hover {
  background: var(--stat-bg);
}

.chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.site-footer {
  margin-top: 28px;
  padding: 20px 0 36px;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
}

.site-footer p {
  margin: 0 0 6px;
}

.footnote {
  margin-top: 8px;
  font-size: 0.82rem;
}

@media (min-width: 720px) {
  .wrap {
    width: min(1080px, calc(100% - 48px));
  }

  .site-header {
    padding-top: 28px;
  }

  .site-header h1 {
    font-size: 1.9rem;
  }
}

@media (min-width: 840px) {
  .filters {
    grid-template-columns: 1.15fr 0.85fr 1.45fr 1.25fr;
    align-items: end;
  }

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

@media print {
  body {
    border-top: 0;
    background: #fff;
  }

  .filter-bar,
  .skip,
  .hint {
    display: none;
  }

  .card {
    break-inside: avoid;
    box-shadow: none;
  }
}
