:root {
  color-scheme: light;
  --ink: #18221f;
  --muted: #64706b;
  --line: #d8ded9;
  --paper: #f7f5ee;
  --surface: #ffffff;
  --jade: #1f7a5d;
  --jade-dark: #14523f;
  --cinnabar: #b83a2e;
  --gold: #c28b24;
  --blue: #2d5b7c;
  --shadow: 0 16px 40px rgba(24, 34, 31, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(31, 122, 93, 0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(184, 58, 46, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 34px 34px;
  color: var(--ink);
  font-family: "Songti SC", "Noto Serif SC", "STSong", Georgia, serif;
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(247, 245, 238, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 2px solid var(--ink);
  background: var(--surface);
  color: var(--cinnabar);
  font-size: 24px;
  font-weight: 700;
  box-shadow: 4px 4px 0 var(--gold);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 19px;
  line-height: 1.1;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-family: "Avenir Next", "Gill Sans", sans-serif;
  font-size: 12px;
  letter-spacing: 0;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.language-switcher {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-family: "Avenir Next", "Gill Sans", sans-serif;
  font-size: 12px;
  font-weight: 800;
}

.language-switcher select {
  width: auto;
  min-width: 104px;
  min-height: 40px;
  padding: 0 30px 0 10px;
  font-size: 14px;
}

.ghost-button,
.solid-button,
.panel-link {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 0 14px;
  font-family: "Avenir Next", "Gill Sans", sans-serif;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.ghost-button {
  border: 1px solid var(--line);
  background: var(--surface);
}

.solid-button,
.panel-link {
  border: 1px solid var(--jade-dark);
  background: var(--jade);
  color: #fff;
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  width: min(1440px, calc(100% - 32px));
  margin: 28px auto 48px;
}

.workspace,
.side-panel {
  min-width: 0;
}

.workspace-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--cinnabar);
  font-family: "Avenir Next", "Gill Sans", sans-serif;
  font-size: 13px;
  font-weight: 800;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 54px);
  line-height: 1.05;
}

.stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: end;
  font-family: "Avenir Next", "Gill Sans", sans-serif;
}

.stats span {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 13px;
}

.stats strong {
  color: var(--ink);
  font-size: 20px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(130px, 0.55fr) minmax(130px, 0.55fr) minmax(130px, 0.55fr) auto;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-family: "Avenir Next", "Gill Sans", sans-serif;
  font-size: 12px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: 15px "Avenir Next", "Gill Sans", sans-serif;
}

input {
  padding: 0 12px;
}

select {
  padding: 0 10px;
}

.reset-button {
  align-self: end;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: #f5f1e5;
  color: var(--ink);
  cursor: pointer;
  font-family: "Avenir Next", "Gill Sans", sans-serif;
  font-size: 14px;
  font-weight: 800;
}

.quick-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}

.quick-tabs button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  cursor: pointer;
  font-family: "Avenir Next", "Gill Sans", sans-serif;
  font-weight: 700;
}

.quick-tabs button.active {
  border-color: var(--jade-dark);
  background: var(--jade-dark);
  color: #fff;
}

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

.resource-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 292px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 24px rgba(24, 34, 31, 0.06);
  overflow: hidden;
}

.card-top {
  display: flex;
  gap: 12px;
  padding: 14px 14px 10px;
}

.favicon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f7f3;
  color: var(--jade-dark);
  font-family: "Avenir Next", "Gill Sans", sans-serif;
  font-size: 13px;
  font-weight: 900;
  overflow: hidden;
}

.favicon img {
  width: 24px;
  height: 24px;
}

.favicon.fallback-icon::before {
  content: attr(data-fallback);
}

.resource-card h2 {
  margin: 0 0 5px;
  font-size: 20px;
  line-height: 1.2;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-family: "Avenir Next", "Gill Sans", sans-serif;
  font-size: 12px;
}

.badge {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  border-radius: 999px;
  padding: 0 8px;
  background: #eef3ee;
  color: var(--jade-dark);
  font-weight: 800;
}

.badge.hot {
  background: #fff0de;
  color: #8b4d00;
}

.card-body {
  padding: 0 14px 12px;
}

.description {
  margin-bottom: 12px;
  color: #39453f;
  font-size: 15px;
  line-height: 1.62;
}

.audience {
  margin-bottom: 12px;
  color: var(--muted);
  font-family: "Avenir Next", "Gill Sans", sans-serif;
  font-size: 13px;
  line-height: 1.45;
}

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

.tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  font-family: "Avenir Next", "Gill Sans", sans-serif;
  font-size: 12px;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: #fbfaf5;
  font-family: "Avenir Next", "Gill Sans", sans-serif;
}

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

.visit-link {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border-radius: 8px;
  padding: 0 10px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.side-panel {
  position: sticky;
  top: 88px;
  align-self: start;
  display: grid;
  gap: 12px;
}

.panel-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 24px rgba(24, 34, 31, 0.06);
}

.panel-section h2 {
  margin-bottom: 8px;
  font-size: 20px;
}

.panel-section p,
.plain-list {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.panel-link {
  margin-top: 12px;
  width: 100%;
}

.price-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  font-family: "Avenir Next", "Gill Sans", sans-serif;
  font-size: 13px;
  font-weight: 700;
}

.price-list span {
  border-left: 3px solid var(--gold);
  padding: 8px 10px;
  background: #fff9ec;
}

.plain-list {
  padding-left: 18px;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  text-align: center;
}

.footer {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto 30px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

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

  .side-panel {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 760px) {
  .topbar,
  .workspace-head {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .language-switcher {
    grid-column: 1 / -1;
    justify-content: space-between;
  }

  .language-switcher select {
    width: min(180px, 55vw);
  }

  .shell {
    width: min(100% - 20px, 720px);
    margin-top: 18px;
  }

  .filters,
  .side-panel,
  .resource-grid {
    grid-template-columns: 1fr;
  }

  .reset-button {
    width: 100%;
  }

  h1 {
    font-size: 32px;
  }

  .stats {
    justify-content: start;
  }
}
