:root {
  --ink: #17232d;
  --ink-soft: #53626c;
  --paper: #eef1ef;
  --paper-strong: #fbfcfa;
  --line: #c8d1cc;
  --teal: #0d7774;
  --coral: #d94b38;
  --gold: #b77a08;
  --blue: #2f5d91;
  --green: #387a49;
  --muted: #72807e;
  --shadow: 0 10px 22px rgba(23, 35, 45, 0.07);
}

* { box-sizing: border-box; }

html { background: var(--paper); }

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Aptos", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

button, input, select { font: inherit; }
button, select { cursor: pointer; }

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

.masthead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding: 6px 0 26px;
  border-bottom: 2px solid var(--ink);
}

.kicker {
  margin: 0 0 8px;
  color: var(--teal);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
}

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: "Noto Serif SC", "Songti SC", Georgia, serif; }

h1 {
  margin-bottom: 8px;
  font-size: 48px;
  line-height: 1.08;
}

h1 span {
  display: inline-block;
  margin-left: 10px;
  padding: 2px 8px;
  vertical-align: middle;
  border: 1px solid var(--coral);
  color: var(--coral);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 15px;
}

.intro {
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 16px;
}

.edition-stamp {
  display: grid;
  min-width: 150px;
  gap: 3px;
  padding: 12px 14px;
  border: 1px solid var(--ink);
  background: var(--paper-strong);
  box-shadow: 5px 5px 0 var(--gold);
  font-family: "Cascadia Mono", Consolas, monospace;
}

.edition-stamp span, .edition-stamp small {
  color: var(--ink-soft);
  font-size: 11px;
}

.edition-stamp strong { font-size: 17px; }

.control-panel {
  display: grid;
  gap: 12px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.control-main, .filter-rail, .rail-set, .group-nav, .category-nav {
  display: flex;
  align-items: center;
  gap: 7px;
}

.control-main { justify-content: space-between; }

.filter-rail {
  min-width: 0;
  overflow-x: auto;
  padding: 2px 0 7px;
  scrollbar-color: var(--line) transparent;
  scrollbar-width: thin;
}

.rail-set { flex: 0 0 auto; }

.rail-divider {
  width: 1px;
  height: 28px;
  flex: 0 0 auto;
  background: var(--line);
}

.filter-caption,
.rating-filter > span {
  color: var(--muted);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 11px;
}

.rating-filter {
  display: grid;
  grid-template-columns: auto 136px auto;
  align-items: center;
  min-width: 256px;
  gap: 9px;
}

.rating-filter input[type="range"] {
  width: 136px;
  height: 18px;
  margin: 0;
  appearance: none;
  background: transparent;
}

.rating-filter input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border: 1px solid var(--line);
  background: var(--paper-strong);
}

.rating-filter input[type="range"]::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  margin-top: -7px;
  appearance: none;
  border: 2px solid var(--paper-strong);
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 1px var(--coral);
}

.rating-filter input[type="range"]::-moz-range-track {
  height: 4px;
  border: 1px solid var(--line);
  background: var(--paper-strong);
}

.rating-filter input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 2px solid var(--paper-strong);
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 1px var(--coral);
}

.rating-filter output {
  min-width: 70px;
  color: var(--ink);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 11px;
}

.search-box {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) 30px;
  align-items: center;
  width: min(580px, 100%);
  min-height: 44px;
  border: 1px solid var(--ink);
  background: var(--paper-strong);
}

.search-box > span, .sort-control > span {
  color: var(--ink-soft);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
}

.search-box > span {
  padding: 0 12px;
  border-right: 1px solid var(--line);
}

.search-box input {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.search-box input::placeholder { color: #8a9694; }

.icon-button {
  width: 29px;
  height: 29px;
  margin-right: 5px;
  border: 0;
  color: var(--ink-soft);
  background: transparent;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 16px;
}

.icon-button:hover { color: var(--paper-strong); background: var(--ink); }

.sort-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 0 0 12px;
  border: 1px solid var(--line);
  background: var(--paper-strong);
}

.sort-control select {
  height: 42px;
  border: 0;
  border-left: 1px solid var(--line);
  padding: 0 30px 0 12px;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.group-button, .category-button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 5px 10px;
  color: var(--ink-soft);
  background: rgba(251, 252, 250, 0.8);
  font-size: 13px;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease, transform 140ms ease;
}

.group-button:hover, .category-button:hover { border-color: var(--ink); color: var(--ink); transform: translateY(-1px); }
.group-button:active, .category-button:active { transform: translateY(0); }

.group-button.is-active, .category-button.is-active {
  border-color: var(--ink);
  color: var(--paper-strong);
  background: var(--ink);
}

.group-button, .category-button { display: inline-flex; align-items: center; gap: 7px; }
.group-button small, .category-button small { font-family: "Cascadia Mono", Consolas, monospace; font-size: 11px; }

.directory { padding-top: 24px; }

.directory-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ink);
}

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

.directory-meta {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  max-width: 550px;
}

.directory-meta p {
  margin-bottom: 1px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.5;
  text-align: right;
}

.directory-meta strong {
  flex: 0 0 auto;
  padding: 6px 8px;
  border: 1px solid var(--coral);
  color: var(--coral);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
}

.method-note {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 9px;
  padding: 13px 0 16px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.6;
}

.method-note p { min-width: 0; margin-bottom: 0; overflow-wrap: anywhere; }

.note-marker {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--coral);
  color: var(--coral);
  font-family: Georgia, serif;
  font-weight: 700;
}

.site-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(244px, 1fr));
  align-items: start;
  gap: 14px;
}

.site-card {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  padding: 12px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--teal);
  background: var(--paper-strong);
  box-shadow: 0 0 0 rgba(23, 35, 45, 0);
  animation: reveal 360ms ease both;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.site-card:hover {
  border-color: var(--ink);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.site-card.is-conditional { border-top-color: var(--gold); }
.site-card.is-closed { border-top-color: var(--coral); background: #f5f6f4; }

.card-topline, .site-identity, .rating-row, .card-footer { display: flex; align-items: center; }

.card-topline { justify-content: space-between; gap: 12px; }
.site-identity { min-width: 0; gap: 10px; }

.site-logo {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 34px;
  height: 34px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--paper);
}

.site-logo img { width: 23px; height: 23px; object-fit: contain; }

.site-logo span {
  color: var(--teal);
  font-family: Georgia, serif;
  font-size: 17px;
  font-weight: 700;
}

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

.site-name h3 {
  margin: 0 0 3px;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: 18px;
  line-height: 1.2;
  display: -webkit-box;
  min-height: 22px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.domain {
  overflow: hidden;
  color: var(--ink-soft);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status {
  flex: 0 0 auto;
  padding: 3px 6px;
  border: 1px solid currentColor;
  font-size: 10px;
  font-weight: 700;
}

.status.direct { color: var(--green); }
.status.conditional { color: var(--gold); }
.status.closed { color: var(--coral); }

.rating-row {
  justify-content: space-between;
  gap: 10px;
  margin: 9px 0 7px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
}

.rating-stars {
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: 17px;
  letter-spacing: 1px;
}

.offer-badge {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  padding: 2px 6px;
  border: 1px solid currentColor;
  color: var(--muted);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 10px;
  white-space: nowrap;
}

.offer-badge.free {
  border-color: var(--coral);
  color: var(--coral);
  animation: offer-pulse 1800ms ease-in-out infinite;
}

.offer-badge.paid { color: var(--blue); }
.offer-badge.affiliate {
  border-color: var(--teal);
  color: var(--teal);
  background: transparent;
}

.card-classification {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}

.card-fields { display: grid; gap: 6px; }

.card-field {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 9px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.42;
}

.card-field dt, .card-field dd { margin: 0; }

.card-field dt {
  color: var(--muted);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 10px;
}

.card-field dd {
  min-width: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.quota-value { color: var(--ink); font-weight: 700; }
.quota-value.unknown { color: var(--ink-soft); font-weight: 400; }

.card-footer { justify-content: flex-end; margin-top: 9px; }

.card-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tag {
  display: inline-block;
  width: fit-content;
  padding: 3px 6px;
  border: 1px solid currentColor;
  color: var(--blue);
  font-size: 10px;
}

.tag.image { color: var(--gold); }
.tag.search { color: var(--teal); }
.tag.service { color: var(--coral); }

.group-tag.public { color: var(--green); }
.group-tag.premium { color: var(--blue); }
.group-tag.wealthy { color: #855a97; }
.group-tag.welfare { color: var(--gold); }
.group-tag.review { color: var(--coral); }
.group-tag.featured { color: var(--teal); }

.report-detail {
  margin-top: 7px;
  border-top: 1px dashed var(--line);
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.55;
}

.report-detail summary {
  padding-top: 7px;
  color: var(--teal);
  cursor: pointer;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 10px;
}

.report-detail p {
  margin: 8px 0 0;
}

.report-detail p:last-child { margin-bottom: 0; }

.report-detail p span {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 10px;
}

.report-detail .topic-links {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 0;
}

.topic-links a,
.post-link {
  color: var(--teal);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 10px;
  text-decoration: none;
}

.topic-links a:hover,
.post-link:hover { color: var(--paper-strong); background: var(--teal); }

.topic-links a {
  padding: 2px 4px;
  border: 1px solid var(--teal);
}

.post-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--teal);
}

.open-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  min-height: 30px;
  border: 1px solid var(--ink);
  color: var(--ink);
  background: transparent;
  text-decoration: none;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 11px;
}

.open-link:hover { color: var(--paper-strong); background: var(--ink); }

.empty-state {
  grid-column: 1 / -1;
  padding: 36px 0;
  color: var(--ink-soft);
  text-align: center;
}

.footer-note {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 26px;
  padding-top: 14px;
  border-top: 1px solid var(--ink);
  color: var(--ink-soft);
  font-size: 12px;
}

@keyframes reveal {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes offer-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217, 75, 56, 0); }
  50% { box-shadow: 0 0 0 4px rgba(217, 75, 56, 0.12); }
}

@media (prefers-reduced-motion: reduce) {
  .site-card,
  .offer-badge.free,
  .group-button,
  .category-button { animation: none; transition: none; }
}

@media (max-width: 760px) {
  .control-main, .directory-head, .directory-meta {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box { width: 100%; }
  .sort-control { width: fit-content; }
  .filter-rail { margin-right: -12px; padding-right: 12px; }
  .directory-meta p { text-align: left; }
  .directory-meta strong { width: fit-content; }
}

@media (max-width: 620px) {
  body { overflow-x: hidden; }
  .shell { width: calc(100vw - 24px); max-width: calc(100vw - 24px); padding-top: 20px; }
  .masthead { align-items: flex-start; flex-direction: column; gap: 18px; }
  h1 { font-size: 38px; }
  .edition-stamp { width: 100%; }
  .site-list { grid-template-columns: 1fr; }
  .site-card { min-height: 0; }
  .footer-note { flex-direction: column; }
}
