:root {
  color-scheme: light;
  --bg: #fff7ec;
  --surface: #fffdf8;
  --surface-soft: #ffefd2;
  --ink: #33231d;
  --muted: #8b6b5f;
  --line: rgba(155, 61, 48, 0.18);
  --red: #b9392e;
  --red-dark: #8f2d26;
  --yellow: #ffd06d;
  --yellow-soft: #ffe4a6;
  --blue: #2f7ff0;
  --blue-soft: #dcecff;
  --shadow: 0 20px 52px rgba(143, 45, 38, 0.12);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui,
    sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 10%, rgba(255, 208, 109, 0.45), transparent 28%),
    radial-gradient(circle at 86% 22%, rgba(47, 127, 240, 0.16), transparent 25%),
    linear-gradient(180deg, #fff5e5 0%, #fffaf2 44%, #fff7ec 100%);
  color: var(--ink);
}

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

button,
input {
  font: inherit;
}

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

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  min-height: 76px;
  padding: 14px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid rgba(185, 57, 46, 0.14);
  background: rgba(255, 247, 236, 0.86);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  width: 46px;
  height: 46px;
  border: 2px solid rgba(255, 208, 109, 0.9);
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 8px 20px rgba(185, 57, 46, 0.2);
  object-fit: cover;
}

.brand strong {
  color: var(--red-dark);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 46px;
}

.search-section {
  margin-bottom: 22px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 64px;
  padding: 8px 8px 8px 18px;
  border: 2px solid rgba(185, 57, 46, 0.3);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 248, 232, 0.98)),
    var(--surface);
  box-shadow:
    0 18px 42px rgba(143, 45, 38, 0.16),
    0 0 0 6px rgba(255, 208, 109, 0.22);
  color: var(--red-dark);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.search-box:focus-within {
  border-color: rgba(47, 127, 240, 0.58);
  box-shadow:
    0 22px 60px rgba(47, 127, 240, 0.18),
    0 0 0 6px rgba(47, 127, 240, 0.14);
  color: var(--blue);
  transform: translateY(-1px);
}

.search-icon {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: var(--red);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(185, 57, 46, 0.22);
}

.search-icon path {
  transform: scale(0.78);
  transform-origin: center;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 18px;
  padding: 0 4px;
}

.search-box input::placeholder {
  color: rgba(185, 57, 46, 0.82);
}

.search-button {
  display: inline-flex;
  min-width: 104px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #ffffff;
  cursor: pointer;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(47, 127, 240, 0.22);
}

.search-button:hover,
.search-button:focus-visible {
  background: #176be0;
  outline: none;
}

.library-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.filters {
  position: sticky;
  top: 98px;
}

.filter-group {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.86);
  box-shadow: 0 12px 36px rgba(143, 45, 38, 0.08);
}

.filter-group h2 {
  margin: 0 0 12px;
  color: var(--red-dark);
  font-size: 16px;
}

.segmented-list {
  display: grid;
  gap: 8px;
}

.filter-option {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.filter-icon {
  display: none;
}

.filter-label {
  min-width: 0;
}

.filter-option:hover,
.filter-option[aria-pressed="true"] {
  border-color: rgba(185, 57, 46, 0.18);
  background: var(--surface-soft);
  color: var(--red-dark);
}

.filter-option[aria-pressed="true"] .filter-count {
  background: var(--blue);
  color: #ffffff;
}

.filter-count {
  display: inline-flex;
  min-width: 26px;
  min-height: 22px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.resource-area {
  min-width: 0;
}

.count-pill {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border: 1px solid rgba(47, 127, 240, 0.2);
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  padding: 0 13px;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 14px;
}

.resource-card {
  display: flex;
  min-height: 188px;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: 0 12px 30px rgba(143, 45, 38, 0.08);
}

.resource-card:hover {
  border-color: rgba(47, 127, 240, 0.34);
  box-shadow: 0 18px 42px rgba(47, 127, 240, 0.12);
  transform: translateY(-1px);
}

.resource-card h2 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.45;
}

.description {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.open-link {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  width: 92px;
  margin-top: auto;
  border: 1px solid rgba(47, 127, 240, 0.28);
  border-radius: 8px;
  background: var(--blue);
  color: #ffffff;
  font-weight: 800;
}

.open-link:hover,
.open-link:focus-visible {
  background: #176be0;
  outline: none;
}

.empty-state {
  display: grid;
  min-height: 220px;
  place-items: center;
  gap: 8px;
  border: 1px dashed rgba(185, 57, 46, 0.24);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.7);
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--red-dark);
  font-size: 18px;
}

.site-footer {
  border-top: 1px solid rgba(185, 57, 46, 0.16);
  background: rgba(255, 247, 236, 0.72);
}

.footer-inner {
  display: grid;
  gap: 12px;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 30px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.75;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.footer-brand strong {
  color: var(--red-dark);
  font-size: 16px;
}

.footer-brand span {
  color: var(--muted);
}

.footer-inner p {
  max-width: 860px;
  margin: 0;
}

.footer-meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.footer-meta a {
  color: var(--blue);
  font-weight: 800;
}

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

  .filters {
    position: static;
  }
}

@media (max-width: 640px) {
  .topbar {
    position: static;
    min-height: 68px;
    padding-inline: 14px;
  }

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

  main {
    width: min(100% - 24px, 1180px);
    padding-top: 18px;
  }

  .search-box {
    min-height: 58px;
    padding: 7px 7px 7px 14px;
    box-shadow:
      0 14px 34px rgba(143, 45, 38, 0.16),
      0 0 0 5px rgba(255, 208, 109, 0.22);
  }

  .search-box input {
    font-size: 16px;
    padding-inline: 2px;
  }

  .search-button {
    min-width: 76px;
    min-height: 42px;
  }

  .footer-inner {
    width: min(100% - 24px, 1180px);
    padding-block: 22px 28px;
  }

  .filter-group {
    padding: 14px;
  }

  .filter-group h2 {
    margin-bottom: 10px;
  }

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

  .filter-option {
    position: relative;
    min-height: 76px;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
    padding: 10px 6px;
    border-color: rgba(185, 57, 46, 0.12);
    background: rgba(255, 247, 236, 0.68);
    color: var(--muted);
  }

  .filter-option[aria-pressed="true"] {
    border-color: rgba(47, 127, 240, 0.42);
    background: linear-gradient(180deg, #eaf4ff, #fff4d8);
    color: var(--red-dark);
  }

  .filter-icon {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 50%;
    background: var(--yellow-soft);
    color: var(--red-dark);
  }

  .filter-option[aria-pressed="true"] .filter-icon {
    background: var(--blue);
    color: #ffffff;
  }

  .filter-icon svg {
    width: 18px;
    height: 18px;
  }

  .filter-label {
    max-width: 100%;
    overflow: hidden;
    color: inherit;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .filter-count {
    position: absolute;
    top: 7px;
    right: 7px;
    min-width: 20px;
    min-height: 20px;
    font-size: 11px;
  }
}
