:root {
  --bg: #eef3f8;
  --surface: #ffffff;
  --surface-soft: #f7fafc;
  --text: #1f2f46;
  --muted: #6e7f94;
  --line: #dbe6ef;
  --green: #0b8f54;
  --green-deep: #087143;
  --blue: #245bb3;
  --gold: #c8962a;
  --shadow: 0 18px 42px rgba(31, 55, 82, 0.10);
  --font: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100dvh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(11, 143, 84, 0.08), transparent 34%),
    linear-gradient(220deg, rgba(36, 91, 179, 0.08), transparent 40%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
}

button,
input,
select {
  font: inherit;
}

.resource-top {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 36px;
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(11, 143, 84, 0.14);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
}

.brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  font-size: 20px;
  font-weight: 900;
}

.brand img {
  width: 44px;
  height: 44px;
  padding: 2px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid rgba(11, 143, 84, 0.24);
  box-shadow: 0 8px 20px rgba(11, 143, 84, 0.12);
}

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

.top-nav a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #344960;
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.top-nav a:hover {
  border-color: rgba(11, 143, 84, 0.28);
  box-shadow: 0 8px 20px rgba(31, 55, 82, 0.08);
  transform: translateY(-1px);
}

.top-nav i {
  color: var(--green);
}

.resource-shell {
  width: min(1500px, calc(100% - 48px));
  margin: 26px auto 48px;
}

.resource-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: stretch;
  padding: 28px;
  border: 1px solid rgba(11, 143, 84, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(247, 251, 249, 0.92)),
    url("../img/school-logo.png") right 34px center / 168px auto no-repeat;
  box-shadow: var(--shadow);
}

.resource-hero h1 {
  margin: 0 0 10px;
  font-size: 34px;
  line-height: 1.18;
}

.resource-hero p {
  max-width: 740px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.9;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
  gap: 10px;
}

.hero-stats div {
  min-height: 92px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
  border: 1px solid rgba(36, 91, 179, 0.10);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.hero-stats strong {
  color: var(--green-deep);
  font-size: 28px;
  line-height: 1;
}

.hero-stats span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.resource-toolbar {
  margin: 18px 0 14px;
  display: grid;
  grid-template-columns: minmax(360px, 0.88fr) minmax(520px, 1.12fr);
  gap: 14px;
  align-items: center;
}

.search-box {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(31, 55, 82, 0.05);
}

.search-box i {
  color: var(--green);
}

.search-box input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: none;
  color: var(--text);
  font-size: 15px;
}

#search-clear {
  width: 32px;
  height: 32px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #98a7b8;
  cursor: pointer;
}

#search-clear.visible {
  display: inline-flex;
}

.filter-row {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.segmented {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
}

.segmented button {
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #52647b;
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
}

.segmented button.active {
  background: linear-gradient(135deg, var(--green), var(--blue));
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(11, 143, 84, 0.18);
}

select {
  min-height: 42px;
  min-width: 130px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  outline: none;
  font-weight: 800;
}

.source-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.source-card {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid rgba(36, 91, 179, 0.10);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: #506177;
  font-size: 13px;
  font-weight: 800;
}

.source-card i {
  color: var(--gold);
}

.detail-bar {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  padding: 0 14px;
  border: 1px solid rgba(11, 143, 84, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 22px rgba(31, 55, 82, 0.06);
}

.detail-bar[hidden] {
  display: none;
}

.detail-bar button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--green-deep);
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
}

#detail-title {
  min-width: 0;
  color: #344960;
  font-size: 14px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breadcrumb {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.breadcrumb a,
.breadcrumb span {
  min-width: 0;
  color: #344960;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
}

.breadcrumb a:hover {
  color: var(--green-deep);
}

.breadcrumb i {
  flex: 0 0 auto;
  color: #a2b0c0;
  font-size: 10px;
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 12px;
}

.result-head h2 {
  margin: 0;
  font-size: 20px;
}

#result-count {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  border-radius: 999px;
  background: rgba(11, 143, 84, 0.08);
  color: var(--green-deep);
  font-size: 12px;
  font-weight: 900;
}

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

.resource-loading {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1px solid rgba(11, 143, 84, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  font-size: 15px;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(31, 55, 82, 0.08);
}

.resource-loading i {
  color: var(--green);
  animation: resource-spin 0.8s linear infinite;
}

@keyframes resource-spin {
  to { transform: rotate(360deg); }
}

.grade-section {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
  padding: 4px 0 14px;
}

.grade-section + .grade-section {
  padding-top: 8px;
  border-top: 1px solid rgba(36, 91, 179, 0.10);
}

.grade-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.grade-section-head h3 {
  margin: 0;
  color: #1e2d45;
  font-size: 20px;
}

.grade-section-head span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(11, 143, 84, 0.08);
  color: var(--green-deep);
  font-size: 12px;
  font-weight: 900;
}

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

.resource-card {
  min-height: 214px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border: 1px solid rgba(36, 91, 179, 0.12);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
  box-shadow: 0 8px 22px rgba(34, 54, 90, 0.06);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.subject-card {
  min-height: 204px;
  color: inherit;
  text-decoration: none;
}

.subject-card h3 {
  font-size: 22px;
}

.term-card h3 {
  color: var(--green-deep);
}

.subject-foot {
  margin-top: auto;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(219, 230, 239, 0.80);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.subject-foot span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subject-foot i {
  color: var(--green);
}

.resource-card:hover {
  transform: translateY(-2px);
  border-color: rgba(11, 143, 84, 0.25);
  box-shadow: 0 16px 34px rgba(22, 48, 38, 0.10);
}

.card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.pill {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef6ff;
  color: #315f9c;
  font-size: 12px;
  font-weight: 900;
}

.pill.grade {
  background: #ecf8f1;
  color: var(--green-deep);
}

.pill.term {
  background: #fff8e8;
  color: #926b0d;
}

.resource-card h3 {
  margin: 0;
  color: #1e2d45;
  font-size: 18px;
  line-height: 1.35;
}

.resource-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.group-card {
  min-height: 236px;
}

.topic-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.topic-preview span {
  max-width: 100%;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border: 1px solid rgba(36, 91, 179, 0.10);
  border-radius: 999px;
  background: #f7fafc;
  color: #52647b;
  font-size: 12px;
  font-weight: 800;
}

.topic-card {
  min-height: 0;
  gap: 10px;
}

.lesson-card {
  min-height: 188px;
}

.topic-card h3 {
  font-size: 17px;
}

.resource-type-preview {
  margin-top: 2px;
}

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

.topic-detail-card {
  grid-column: 1 / -1;
}

.topic-resource-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 2px;
}

.resource-section {
  display: grid;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(219, 230, 239, 0.82);
}

.resource-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.resource-section-head h4 {
  margin: 0;
  color: #263950;
  font-size: 15px;
}

.resource-section-head span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef6ff;
  color: #315f9c;
  font-size: 12px;
  font-weight: 900;
}

.resource-more {
  display: grid;
  gap: 8px;
}

.resource-more summary {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--green-deep);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.resource-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(219, 230, 239, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.resource-row strong {
  display: block;
  color: #263950;
  font-size: 13px;
  line-height: 1.35;
}

.resource-row span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.resource-actions {
  margin-top: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.resource-actions a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #344960;
  text-decoration: none;
  font-size: 12px;
  font-weight: 900;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.resource-actions a.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--green), var(--blue));
  color: #ffffff;
}

.resource-actions a:hover {
  border-color: rgba(11, 143, 84, 0.28);
  color: var(--green-deep);
}

.resource-actions a.primary:hover {
  color: #ffffff;
}

.row-actions {
  margin-top: 0;
  grid-template-columns: 1fr;
}

.row-actions a {
  min-width: 112px;
  white-space: nowrap;
}

.empty-state {
  display: none;
  min-height: 260px;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 30px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  text-align: center;
}

.empty-state.visible {
  display: grid;
}

.empty-state i {
  color: var(--green);
  font-size: 26px;
}

.empty-state h2,
.empty-state p {
  margin: 0;
}

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

@media (max-width: 1160px) {
  .resource-toolbar {
    grid-template-columns: 1fr;
  }

  .filter-row {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 3px;
  }

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

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

@media (max-width: 760px) {
  .resource-top {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 16px;
  }

  .top-nav {
    width: 100%;
  }

  .top-nav a {
    flex: 1;
  }

  .resource-shell {
    width: calc(100% - 24px);
    margin-top: 14px;
  }

  .resource-hero {
    grid-template-columns: 1fr;
    padding: 20px;
    background:
      linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(247, 251, 249, 0.92));
  }

  .resource-hero h1 {
    font-size: 28px;
  }

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

  .resource-toolbar {
    gap: 10px;
  }

  .filter-row {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .segmented {
    overflow-x: auto;
  }

  select {
    width: 100%;
  }

  .source-strip,
  .resource-grid,
  .subject-grid {
    grid-template-columns: 1fr;
  }

  .detail-bar {
    align-items: stretch;
    flex-direction: column;
    padding: 12px;
  }

  .detail-bar button {
    width: 100%;
  }

  #detail-title {
    white-space: normal;
  }

  .breadcrumb {
    flex-wrap: wrap;
  }

  .resource-row {
    grid-template-columns: 1fr;
  }

  .topic-resource-list {
    grid-template-columns: 1fr;
  }

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

/* 2026 visual polish layer */
:root {
  --bg: #eaf2f8;
  --surface: #ffffff;
  --surface-soft: #f5f9fc;
  --text: #14233a;
  --muted: #66778b;
  --line: #d7e4ee;
  --green: #0b8f64;
  --green-deep: #066647;
  --blue: #245fba;
  --gold: #b98a22;
  --shadow: 0 22px 54px rgba(30, 52, 80, 0.13);
  --shadow-soft: 0 10px 28px rgba(30, 52, 80, 0.08);
  --ring: 0 0 0 4px rgba(11, 143, 100, 0.12);
}

body {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0, rgba(255, 255, 255, 0) 220px),
    radial-gradient(circle at 12% 12%, rgba(11, 143, 100, 0.16), transparent 30%),
    radial-gradient(circle at 88% 18%, rgba(36, 95, 186, 0.13), transparent 32%),
    linear-gradient(135deg, #eef7f4 0%, #e7f1fb 47%, #f4f7fa 100%);
}

.resource-top {
  min-height: 76px;
  padding: 0 clamp(18px, 4vw, 52px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.70);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 12px 36px rgba(25, 45, 70, 0.08);
}

.brand {
  gap: 14px;
  font-size: 21px;
  letter-spacing: 0;
}

.brand img {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 10px 28px rgba(11, 143, 100, 0.20);
}

.top-nav a {
  min-height: 40px;
  padding: 0 14px;
  border-color: rgba(215, 228, 238, 0.84);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 18px rgba(30, 52, 80, 0.05);
}

.top-nav a:hover {
  border-color: rgba(11, 143, 100, 0.32);
  background: #ffffff;
  box-shadow: 0 14px 28px rgba(30, 52, 80, 0.10);
}

.resource-shell {
  width: min(1480px, calc(100% - 48px));
  margin: 30px auto 56px;
}

.resource-hero {
  position: relative;
  overflow: hidden;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.42fr);
  gap: 28px;
  min-height: 230px;
  padding: clamp(28px, 4vw, 46px);
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 8px;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 255, 255, 0.88) 46%, rgba(229, 245, 239, 0.74) 100%),
    url("../img/school-logo.png") right 42px center / 210px auto no-repeat;
  box-shadow: var(--shadow);
}

.resource-hero::before {
  content: "";
  position: absolute;
  inset: auto -90px -140px auto;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(11, 143, 100, 0.15), transparent 64%);
  pointer-events: none;
}

.resource-hero::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 7px;
  height: 100%;
  background: linear-gradient(180deg, var(--green), var(--blue));
}

.resource-hero > * {
  position: relative;
  z-index: 1;
}

.resource-hero h1 {
  max-width: 760px;
  margin-bottom: 14px;
  color: #0f2036;
  font-size: clamp(34px, 4.3vw, 52px);
  line-height: 1.08;
  font-weight: 950;
}

.resource-hero p {
  max-width: 780px;
  color: #52677e;
  font-size: 16px;
  line-height: 1.95;
}

.hero-stats {
  align-self: center;
  grid-template-columns: 1fr;
  gap: 12px;
}

.hero-stats div {
  min-height: 72px;
  grid-template-columns: auto 1fr;
  justify-items: start;
  align-content: center;
  column-gap: 12px;
  padding: 14px 18px;
  border-color: rgba(255, 255, 255, 0.74);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 12px 28px rgba(30, 52, 80, 0.08);
  backdrop-filter: blur(18px);
}

.hero-stats strong {
  grid-row: span 2;
  min-width: 112px;
  color: var(--green-deep);
  font-size: 31px;
  letter-spacing: 0;
}

.hero-stats span {
  align-self: center;
  color: #43576e;
  font-size: 13px;
}

.resource-toolbar {
  position: sticky;
  top: 86px;
  z-index: 12;
  grid-template-columns: minmax(320px, 1fr) minmax(520px, auto);
  gap: 16px;
  margin: 22px 0 16px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.search-box {
  min-height: 54px;
  padding: 0 16px;
  border-color: rgba(215, 228, 238, 0.92);
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72);
}

.search-box:focus-within {
  border-color: rgba(11, 143, 100, 0.38);
  box-shadow: var(--ring);
}

.search-box i {
  font-size: 17px;
}

.search-box input {
  font-size: 15px;
  font-weight: 700;
}

.filter-row {
  gap: 12px;
}

.segmented,
select {
  border-color: rgba(215, 228, 238, 0.92);
  box-shadow: 0 8px 18px rgba(30, 52, 80, 0.05);
}

.segmented {
  padding: 5px;
  background: #f5f9fc;
}

.segmented button {
  min-height: 38px;
  padding: 0 16px;
}

.segmented button.active {
  background: linear-gradient(135deg, #0b8f64, #176eb8);
  box-shadow: 0 10px 22px rgba(11, 143, 100, 0.24);
}

select {
  min-height: 48px;
  min-width: 142px;
}

.source-strip {
  gap: 14px;
  margin-bottom: 22px;
}

.source-card {
  min-height: 56px;
  padding: 12px 16px;
  border-color: rgba(255, 255, 255, 0.76);
  background: rgba(255, 255, 255, 0.66);
  box-shadow: 0 8px 22px rgba(30, 52, 80, 0.06);
}

.source-card i {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: rgba(185, 138, 34, 0.12);
}

.result-head {
  margin: 20px 0 16px;
}

.result-head h2,
.grade-section-head h3 {
  color: #13243b;
  font-weight: 950;
  letter-spacing: 0;
}

#result-count,
.grade-section-head span {
  min-height: 34px;
  padding: 0 13px;
  background: rgba(11, 143, 100, 0.10);
}

.resource-grid,
.subject-grid {
  gap: 18px;
}

.grade-section {
  gap: 16px;
  padding: 8px 0 22px;
}

.grade-section + .grade-section {
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.72);
}

.resource-card {
  position: relative;
  overflow: hidden;
  min-height: 224px;
  gap: 13px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(248, 252, 255, 0.92)),
    linear-gradient(135deg, rgba(11, 143, 100, 0.08), transparent 48%);
  box-shadow: 0 12px 28px rgba(30, 52, 80, 0.09);
}

.resource-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--green), rgba(36, 95, 186, 0.72));
  opacity: 0;
  transition: opacity 0.18s ease;
}

.resource-card::after {
  content: "";
  position: absolute;
  right: -46px;
  top: -58px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(11, 143, 100, 0.10), transparent 64%);
  pointer-events: none;
}

.resource-card:hover {
  transform: translateY(-4px);
  border-color: rgba(11, 143, 100, 0.24);
  box-shadow: 0 22px 42px rgba(22, 50, 78, 0.14);
}

.resource-card:hover::before {
  opacity: 1;
}

.subject-card h3 {
  font-size: 24px;
}

.resource-card h3 {
  color: #13243b;
  font-weight: 950;
}

.resource-card p {
  color: #5f7188;
  font-size: 13.5px;
}

.card-meta {
  min-height: 26px;
}

.pill {
  min-height: 26px;
  padding: 0 10px;
  border: 1px solid rgba(36, 95, 186, 0.08);
  background: #edf5ff;
  color: #285f9b;
}

.pill.grade {
  border-color: rgba(11, 143, 100, 0.10);
  background: #e8f7ef;
  color: var(--green-deep);
}

.pill.term {
  border-color: rgba(185, 138, 34, 0.12);
  background: #fff7e4;
  color: #7b5a09;
}

.topic-preview {
  gap: 8px;
}

.topic-preview span {
  min-height: 28px;
  padding: 0 10px;
  border-color: rgba(215, 228, 238, 0.96);
  background: rgba(245, 249, 252, 0.96);
  color: #52657a;
}

.subject-foot {
  min-height: 40px;
  margin-top: auto;
  padding-top: 12px;
  border-top-color: rgba(215, 228, 238, 0.84);
}

.subject-foot i {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: rgba(11, 143, 100, 0.10);
}

.resource-actions a,
.detail-bar button,
.resource-more summary {
  border-color: rgba(215, 228, 238, 0.96);
  box-shadow: 0 8px 18px rgba(30, 52, 80, 0.05);
}

.resource-actions a.primary {
  background: linear-gradient(135deg, #0b8f64, #176eb8);
  box-shadow: 0 12px 24px rgba(11, 143, 100, 0.20);
}

.resource-row {
  padding: 12px;
  border-color: rgba(215, 228, 238, 0.92);
  background: rgba(255, 255, 255, 0.86);
}

.resource-section {
  gap: 10px;
  padding-top: 12px;
}

.empty-state,
.resource-loading,
.detail-bar {
  border-color: rgba(255, 255, 255, 0.76);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-soft);
}

@media (max-width: 1160px) {
  .resource-toolbar {
    position: static;
    grid-template-columns: 1fr;
  }

  .filter-row {
    justify-content: flex-start;
  }
}

@media (max-width: 860px) {
  .resource-shell {
    width: calc(100% - 28px);
  }

  .resource-hero {
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 28px 22px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(239, 248, 244, 0.90));
  }

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

  .hero-stats div {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .hero-stats strong {
    min-width: 0;
    grid-row: auto;
    font-size: 26px;
  }
}

@media (max-width: 760px) {
  .resource-top {
    gap: 12px;
    padding: 12px 14px;
  }

  .top-nav a {
    justify-content: center;
    padding: 0 10px;
  }

  .resource-shell {
    margin-top: 16px;
  }

  .resource-hero h1 {
    font-size: 31px;
  }

  .hero-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .hero-stats div {
    min-height: 84px;
    padding: 10px 8px;
  }

  .hero-stats strong {
    font-size: 24px;
  }

  .hero-stats span {
    font-size: 12px;
  }

  .resource-toolbar {
    padding: 12px;
  }

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

  .segmented {
    grid-column: 1 / -1;
    border-radius: 8px;
  }

  .segmented button {
    flex: 0 0 auto;
  }
}
