:root {
  --bg: #f6f3ec;
  --surface: #fffdf8;
  --surface-2: #efeadf;
  --ink: #1d2621;
  --ink-2: #4b564f;
  --muted: #7d867f;
  --line: #e2dccf;
  --green: #1f6f4a;
  --green-2: #2f8a5f;
  --green-soft: #e3efe6;
  --amber: #b86e12;
  --amber-soft: #f8ead3;
  --red-soft: #f6e1dc;
  --red: #a2412c;
  --shadow: 0 1px 2px rgba(29, 38, 33, .05), 0 8px 24px -12px rgba(29, 38, 33, .18);
  --radius: 16px;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Segoe UI", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121714;
    --surface: #1a211c;
    --surface-2: #222a24;
    --ink: #e8ece6;
    --ink-2: #b7c0b8;
    --muted: #87918a;
    --line: #2c352e;
    --green: #5fbf8a;
    --green-2: #7fd3a3;
    --green-soft: #1f3327;
    --amber: #e3a552;
    --amber-soft: #3a2d18;
    --red-soft: #3b231d;
    --red: #e58b74;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -14px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--green); }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); }

/* header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-row { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 600; letter-spacing: .02em; }
.brand-mark { width: 24px; height: 24px; fill: var(--green); }
.header-right { display: flex; align-items: center; gap: 10px; }
.lang {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.lang:hover { color: var(--ink); border-color: var(--muted); }
.title-en { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.35; overflow-wrap: anywhere; }
.title-en.lg { font-size: 14px; margin: -4px 0 12px; }
.orig { display: block; font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 2px; }
.orig.block { margin-top: -6px; }
.rmb { display: block; font-size: 11.5px; font-weight: 400; color: var(--muted); }
.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 999px; }
.tabs a { padding: 6px 14px; border-radius: 999px; color: var(--ink-2); text-decoration: none; font-size: 14px; white-space: nowrap; }
.tabs a.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-weight: 600; }

/* hero */
.hero {
  padding: 40px 0 28px;
  background:
    radial-gradient(900px 300px at 85% -10%, color-mix(in srgb, var(--green) 14%, transparent), transparent 70%),
    radial-gradient(700px 260px at 0% 0%, color-mix(in srgb, var(--amber) 10%, transparent), transparent 70%);
}
.hero h1 { font-family: var(--serif); font-weight: 700; font-size: clamp(30px, 4.4vw, 50px); line-height: 1.2; margin: 0 0 12px; letter-spacing: .01em; }
.br-mobile { display: none; }
.hero-sub { color: var(--ink-2); margin: 0 0 20px; font-size: 17px; line-height: 1.7; max-width: 900px; }
.hero-sub b { color: var(--ink); font-variant-numeric: tabular-nums; }
.search { position: relative; max-width: 680px; }
.search svg { position: absolute; left: 18px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search input {
  width: 100%; height: 54px; padding: 0 20px 0 50px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  box-shadow: var(--shadow); font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.search input:focus { border-color: var(--green); box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 18%, transparent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  padding: 6px 14px; border-radius: 999px; font-size: 14px; cursor: pointer; transition: all .15s;
}
.chip:hover { border-color: var(--green); color: var(--ink); }
.chip.on { background: var(--green); border-color: var(--green); color: #fff; }
.chip small { opacity: .7; margin-left: 4px; font-variant-numeric: tabular-nums; }

/* layout */
.layout { display: grid; grid-template-columns: 260px 1fr; gap: 28px; padding-top: 8px; padding-bottom: 64px; align-items: start; }
.filters {
  position: sticky; top: 76px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
  max-height: calc(100vh - 92px); overflow: auto;
}
.filters-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.filters h2 { font-size: 16px; margin: 0; }
.link { background: none; border: 0; color: var(--green); cursor: pointer; padding: 0; font-size: 14px; }
.field { display: block; border: 0; padding: 0; margin: 16px 0 0; }
.field > span, .field legend { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; padding: 0; }
.field output { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
select {
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%237d867f' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 11px 8px;
  padding-right: 34px !important; cursor: pointer;
}
.field select, .field input[type=text], .field textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--line); background-color: var(--bg); outline: none;
}
.field textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.field select:focus, .field input[type=text]:focus, .field textarea:focus { border-color: var(--green); }
.field select:focus { border-color: var(--green); }
input[type=range] { width: 100%; accent-color: var(--green); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  flex: 1 1 auto; border: 1px solid var(--line); background: var(--bg); color: var(--ink-2);
  border-radius: 10px; padding: 6px 8px; font-size: 13px; cursor: pointer;
}
.seg button.on { border-color: var(--green); background: var(--green-soft); color: var(--green); font-weight: 600; }
.toggle { display: flex; align-items: center; gap: 8px; margin-top: 16px; font-size: 14px; cursor: pointer; }
.toggle input { accent-color: var(--green); width: 16px; height: 16px; }
.hint { margin: 4px 0 0 24px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.hint.flush { margin-left: 0; margin-top: 6px; }
.explain { margin-top: 8px; font-size: 12.5px; color: var(--ink-2); line-height: 1.6; }
.explain summary { cursor: pointer; color: var(--green); list-style: none; }
.explain summary::-webkit-details-marker { display: none; }
.explain summary::before { content: "ⓘ "; }
.explain p { margin: 8px 0 0; }
.fb { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 22px 22px; box-shadow: var(--shadow); }
.fb .cta { border: 0; cursor: pointer; }
.fb-status { margin: 12px 0 0; font-size: 14px; color: var(--ink-2); }
.report { display: inline-block; margin-top: 18px; font-size: 13px; color: var(--muted); }

/* results */
.results-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 14px; }
.count { margin: 0; color: var(--ink-2); font-size: 14px; }
.count b { color: var(--ink); font-variant-numeric: tabular-nums; }
.sort select { height: 38px; border-radius: 10px; border: 1px solid var(--line); background-color: var(--surface); padding: 0 12px; }
.btn-filter { display: none; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; height: 36px; padding: 0 14px; cursor: pointer; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.sentinel { height: 40px; }
.empty { text-align: center; color: var(--muted); padding: 48px 0; }

.card {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; cursor: pointer; text-align: left; box-shadow: var(--shadow);
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--green) 45%, var(--line)); }
.card:focus-visible { outline: 3px solid color-mix(in srgb, var(--green) 40%, transparent); outline-offset: 2px; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.school-pill { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink-2); }
.school-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--green)); }
.card h3 { margin: 0; font-size: 16.5px; line-height: 1.4; font-weight: 650; overflow-wrap: anywhere; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); }
.tag.award { background: var(--green-soft); color: var(--green); font-weight: 600; }
.tag.warn { background: var(--red-soft); color: var(--red); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--line); }
.stat dt { font-size: 11.5px; color: var(--muted); }
.stat dd { margin: 0; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat dd.big { font-size: 18px; color: var(--ink); }
.stat dd small { font-weight: 400; color: var(--muted); font-size: 11.5px; margin-left: 4px; }
.stat dd.na { color: var(--muted); font-weight: 400; }
.note { font-size: 13px; color: var(--ink-2); background: var(--amber-soft); border-radius: 10px; padding: 7px 10px; line-height: 1.5; }

/* sheet */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(10, 14, 12, .38); z-index: 40; animation: fade .2s; }
.sheet {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100%); z-index: 41;
  background: var(--surface); box-shadow: -20px 0 50px -20px rgba(0,0,0,.35);
  overflow: auto; animation: slide .25s cubic-bezier(.2,.8,.2,1);
}
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.sheet-close {
  position: sticky; top: 14px; float: right; margin: 14px 14px 0 0; z-index: 2;
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  font-size: 22px; line-height: 1; cursor: pointer; color: var(--ink-2);
}
.sheet-body { padding: 28px 28px 48px; }
.sheet-body .eyebrow { font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.sheet-body h2 { font-family: var(--serif); font-size: 26px; line-height: 1.3; margin: 0 0 12px; padding-right: 40px; }
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 18px 0; }
.fact { background: var(--surface); padding: 12px 14px; }
.fact dt { font-size: 12px; color: var(--muted); }
.fact dd { margin: 2px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.fact dd.na { color: var(--muted); font-weight: 400; }
.section-h { font-size: 15px; margin: 24px 0 8px; }
.quote {
  margin: 8px 0; padding: 10px 14px; border-left: 3px solid var(--green);
  background: var(--surface-2); border-radius: 0 10px 10px 0; font-size: 13.5px; color: var(--ink-2);
}
.quote b { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; margin-bottom: 2px; }
.cta { display: inline-flex; align-items: center; gap: 6px; margin-top: 20px; padding: 10px 18px; border-radius: 999px; background: var(--green); color: #fff; text-decoration: none; font-weight: 600; }
.cta:hover { background: var(--green-2); }
.cta.ghost { background: transparent; color: var(--green); border: 1px solid var(--green); margin-left: 8px; }

/* schools */
.page { padding-top: 40px; padding-bottom: 64px; }
.page-title { font-family: var(--serif); font-size: 36px; margin: 0 0 6px; }
.page-sub { color: var(--ink-2); margin: 0 0 24px; }
.school-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.school-card .zh { font-family: var(--serif); font-size: 20px; font-weight: 700; margin: 0; }
.school-card .en { color: var(--muted); font-size: 13px; margin: 0; }
.school-card .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }

/* prose */
.prose-page { max-width: 820px; }
.prose { font-size: 15.5px; line-height: 1.75; }
.prose h1 { font-family: var(--serif); font-size: 34px; line-height: 1.3; margin: 0 0 20px; }
.prose h2 { font-family: var(--serif); font-size: 22px; margin: 36px 0 12px; padding-top: 16px; border-top: 1px solid var(--line); }
.prose ul { padding-left: 1.2em; }
.prose li { margin: 10px 0; }
.prose blockquote {
  margin: 8px 0 8px; padding: 8px 14px; border-left: 3px solid var(--green);
  background: var(--surface-2); border-radius: 0 10px 10px 0; color: var(--ink-2); font-size: 13.5px; line-height: 1.6;
}
.prose blockquote + blockquote { margin-top: -2px; }
.prose a { overflow-wrap: anywhere; }
.sheet-body .prose h1 { font-size: 26px; padding-right: 40px; }
.sheet-body .prose h2 { font-size: 18px; }

.site-footer { border-top: 1px solid var(--line); padding: 28px 0 40px; font-size: 13.5px; color: var(--ink-2); }
.site-footer p { margin: 4px 0; }

/* mobile */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .filters {
    position: fixed; inset: auto 0 0 0; top: auto; max-height: 82vh; z-index: 42;
    border-radius: 20px 20px 0 0; transform: translateY(105%); transition: transform .25s;
  }
  .filters.open { transform: none; }
  .btn-filter { display: inline-block; }
}
@media (max-width: 600px) {
  .wrap { padding: 0 16px; }
  .header-row { height: auto; padding: 10px 0; flex-direction: column; align-items: flex-start; gap: 8px; }
  .header-right { width: 100%; justify-content: space-between; }
  .hero { padding-top: 32px; }
  .br-mobile { display: inline; }
  .grid { grid-template-columns: 1fr; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin-right: -16px; padding-right: 16px; padding-bottom: 4px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  .sheet-body { padding: 20px 18px 40px; }
  .facts { grid-template-columns: 1fr 1fr; }
}

/* China degree equivalence table on the school sheet */
.equiv-flag { display: inline-block; font-size: 13px; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.equiv-flag.on { background: var(--green-soft); color: var(--green); }
.equiv-wrap { overflow-x: auto; margin: 12px 0; }
.equiv { border-collapse: collapse; width: 100%; font-size: 14px; }
.equiv th, .equiv td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.equiv thead th { font-weight: 600; color: var(--muted); white-space: nowrap; }
.equiv tbody th { font-weight: 500; min-width: 9em; }
.equiv td { white-space: nowrap; }
