:root {
  color-scheme: light;
  --paper: #f6f4ee;
  --card: #fffdfa;
  --ink: #202743;
  --muted: #546066;
  --border: #dedfd5;
  --green: #285d49;
  --green-wash: #e6eee6;
  --clay: #9c5037;
  --sans: "Inter", "Hiragino Sans GB", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --serif: "Instrument Serif", "Songti SC", "Noto Serif CJK SC", "SimSun", Georgia, serif;
  font: 15px/1.55 var(--sans);
}
:root:lang(en) {
  --sans: "Inter", system-ui, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
}
:root:lang(zh-Hant) {
  --sans: "Inter", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --serif: "Instrument Serif", "Songti TC", "Noto Serif CJK TC", Georgia, serif;
}
:root:lang(ja) {
  --sans: "Inter", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, system-ui, sans-serif;
  --serif: "Instrument Serif", "Hiragino Mincho ProN", "Yu Mincho", Georgia, serif;
}
:lang(ja) .intro h1 { font-size: clamp(1.75rem, 3.1vw, 3.15rem); line-height: 1.3; }
.intro h1 .title-part { display: inline-block; }
:lang(ja) .detail-head h2 { font-size: 1.5rem; }
:lang(ja) .detail-facts { grid-template-columns: minmax(88px, 28%) minmax(0, 1fr); }
:lang(ja) .results-header h2 { font-size: 1.2rem; }
:lang(ja) .language > span { white-space: nowrap; }
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
a { color: var(--green); }
:focus-visible { outline: 3px solid #3b795e; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h2 { font-size: 1.24rem; line-height: 1.3; }
h3 { font-size: 1.06rem; }
.shell { width: min(1216px, calc(100% - 72px)); margin-inline: auto; }
.masthead { border-bottom: 1px solid var(--border); position: relative; }
.masthead-inner { height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--ink); color: #fffdf4; font: 700 1.24rem var(--serif); }
.brand-mark { flex: 0 0 34px; }
.language { display: flex; align-items: center; gap: 8px; font-size: .84rem; color: var(--muted); }
.language select { min-height: 36px; padding: 3px 24px 3px 8px; width: auto; }
.language-notice:not(:empty) { position: absolute; z-index: 3; right: max(20px, calc((100% - 1216px) / 2)); top: calc(100% + 8px); background: var(--ink); color: white; border-radius: 8px; padding: 8px 13px; font-size: .88rem; }
.intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 26px; padding: clamp(32px, 5vw, 60px) 0 30px; }
.eyebrow { color: var(--green); font-weight: 700; letter-spacing: .11em; font-size: .77rem; }
h1 { font: 700 clamp(2.2rem, 4.8vw, 4.3rem)/1.12 var(--serif); letter-spacing: -.035em; margin: 7px 0 12px; }
.intro-copy, .muted, .footer { color: var(--muted); }
.intro-copy { font-size: 1.02rem; }
.intro-stats { display: flex; gap: clamp(20px, 3.8vw, 52px); padding: 4px 4px 3px 22px; border-left: 1px solid #c7d4c7; }
.intro-stats div { display: grid; white-space: nowrap; }
.intro-stats strong { font: 500 clamp(2.3rem, 4.2vw, 3.6rem)/1 Georgia, serif; font-variant-numeric: tabular-nums; }
.intro-stats span { font-size: .82rem; margin-top: 4px; color: var(--muted); }
.finder, .map-panel, .results { background: var(--card); border: 1px solid var(--border); border-radius: 15px; overflow: hidden; }
.finder { padding: 14px 18px 17px; }
.section-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.section-bar .muted { margin-top: 4px; font-size: .84rem; }
.filters { display: grid; grid-template-columns: minmax(170px, 1.65fr) repeat(7, minmax(0, 1fr)); gap: 10px; margin-top: 11px; }
.filters label { min-width: 0; display: grid; gap: 4px; color: var(--muted); font-size: .78rem; font-weight: 650; }
input, select { min-width: 0; width: 100%; min-height: 41px; padding: 6px 9px; color: var(--ink); background: #faf9f5; border: 1px solid var(--border); border-radius: 7px; font-size: .9rem; font-weight: 500; }
input::placeholder { color: #666f70; }
.button, .text-button, .close-button { border: 1px solid #c8d8cb; background: var(--green-wash); border-radius: 7px; color: var(--green); padding: 6px 11px; font-weight: 680; font-size: .84rem; white-space: nowrap; }
.button:hover:not(:disabled), .close-button:hover { background: #d5e4d8; }
.text-button { border-color: transparent; background: transparent; }
.text-button:hover { text-decoration: underline; }
.map-panel, .results { margin-top: 16px; }
.map-header, .results-header { padding: 14px 18px; }
.results-title-group { min-width: 0; }
.score-sort-label { display: grid; gap: 3px; color: var(--muted); font-size: .77rem; font-weight: 650; min-width: 0; }
.score-sort-label select { min-height: 34px; max-width: 100%; }
.map-frame { position: relative; background: #e6ebe6; border-block: 1px solid var(--border); }
#school-map { width: 100%; height: clamp(330px, 38vw, 475px); }
.map-status { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center; padding: 18px; background: #ecf0e9; color: var(--green); }
.map-status p { max-width: 28em; }
.map-caption { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 9px 18px; font-size: .77rem; color: var(--muted); }
.map-caption span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--green); }
.legend-dot.domestic { background: var(--clay); }
.pin { width: 24px; height: 24px; border: 2px solid #fffef4; border-radius: 50%; padding: 0; background: var(--green); color: white; box-shadow: 0 1px 5px #20274366; font: 700 13px/1 var(--sans); }
.pin.domestic { background: var(--clay); }
.pin:hover, .pin:focus-visible, .pin.selected { box-shadow: 0 0 0 3px #20274348, 0 2px 5px #20274366; z-index: 1; }
.school-table-scroll { position: relative; overflow-x: auto; }
.school-table-scroll:focus-visible { outline-offset: -3px; }
table { border-collapse: collapse; width: 100%; min-width: 700px; table-layout: fixed; font-size: .9rem; }
th, td { text-align: left; padding: 11px 12px; vertical-align: top; border-top: 1px solid var(--border); overflow-wrap: anywhere; }
th { background: #f0f0e9; color: #465458; font-size: .8rem; font-weight: 700; }
th:first-child { width: 21%; }
th:first-child, td:first-child { padding-left: 18px; }
th:nth-child(2) { width: 8%; }
th:nth-child(3) { width: 15%; }
th:nth-child(4) { width: 11%; }
th:nth-child(5) { width: 14%; }
#scores-heading { width: 23%; }
th:last-child { width: 8%; white-space: nowrap; }
th:last-child, td:last-child { text-align: center; padding-inline: 6px; }
tr:hover td { background: #f7f8f2; }
#rows tr { cursor: pointer; }
.school-link { color: var(--ink); font-weight: 740; text-align: left; background: none; border: 0; padding: 0; overflow-wrap: anywhere; }
.school-link:hover { color: var(--green); text-decoration: underline; }
.source-state, .school-original { display: block; margin-top: 2px; color: var(--muted); font-size: .75rem; }
.school-locality { display: block; color: var(--muted); }
.entry-age { color: var(--green); font-weight: 650; }
.stage-tags { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 4px; }
.stage-tags .stage-tag { background: #e9eee7; border-color: #dce4d9; color: #405b4c; padding-inline: 5px; }
.stage-tags .stage-unavailable { background: transparent; border-color: #dedbd2; }
.stage-unavailable .stage-caption { visibility: hidden; }
:lang(en) .stage-tags { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 136px; }
:lang(en) .stage-tags .stage-tag { min-width: 0; padding-inline: 2px; font-size: .7rem; text-align: center; white-space: nowrap; }
.cohort-size strong { display: block; font-size: .86rem; }
.cohort-size small, .cohort-context { display: block; color: var(--muted); }
.cohort-size + .cohort-size { margin-top: 5px; }
.score-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; column-gap: 8px; }
.score-line strong { font-size: .89rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.score-line small { color: var(--muted); white-space: nowrap; }
.score-line-selected { background: var(--green-wash); border-radius: 4px; }
.score-line-selected strong { color: var(--green); }
.score-line + .score-line { margin-top: 4px; }
.cell-label { display: none; }
.pill { display: inline-block; background: #eceee9; border: 1px solid #dde2d9; border-radius: 12px; color: #405348; font-size: .74rem; padding: 0 7px; font-weight: 650; }
.pill.domestic { background: #f4ece5; border-color: #ebdacf; color: #773f2e; }
.course-tags { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px; }
.course-tags .course-tag { background: #edf0f8; border-color: #dfe5f0; color: #364b76; }
.pill.grade { min-width: 24px; text-align: center; background: #eeede6; border-color: #e1dfd4; color: #56574e; white-space: nowrap; }
.pill.grade-A { background: #e1eee5; border-color: #c8ddce; color: #24523e; }
.pill.grade-B { background: #e8ecf6; border-color: #d2daed; color: #394b76; }
#rows .grade { display: inline-grid; place-items: center; min-width: 37px; min-height: 26px; font-size: .84rem; }
.score-unranked { background: #f6f5f0; color: var(--muted); }
.score-unranked .school-link, .score-unranked .entry-age { color: var(--muted); }
.score-unranked .pill:not(.stage-unavailable, .grade) { background: #edece6; border-color: #e0ded5; color: var(--muted); }
.score-unranked .school-link:hover { color: var(--green); }
.notice { margin: 12px 18px; padding: 15px; border: 1px solid var(--border); border-radius: 8px; background: var(--paper); color: var(--muted); }
.more-schools { display: grid; justify-content: center; padding: 14px; border-top: 1px solid var(--border); }
.more-schools .button { min-height: 40px; padding-inline: 17px; }
.footer { display: flex; justify-content: space-between; gap: 12px; padding: 18px 0 24px; font-size: .8rem; }
dialog { width: min(610px, 100%); height: 100dvh; max-height: 100dvh; max-width: 100%; margin: 0 0 0 auto; padding: 0; border: 0; color: var(--ink); background: var(--card); box-shadow: -12px 0 42px #20274328; overflow: auto; }
dialog::backdrop { background: #1d24446e; }
.detail-head { position: sticky; z-index: 2; top: 0; display: flex; gap: 14px; justify-content: space-between; align-items: flex-start; padding: 22px; background: var(--card); border-bottom: 1px solid var(--border); }
.detail-head h2 { font: 700 1.8rem/1.23 var(--serif); margin-top: 4px; }
.close-button { font-size: 1.45rem; line-height: 1; min-width: 38px; min-height: 38px; padding: 5px; }
.detail-content { padding: 14px 22px 24px; }
.detail-content p { margin: 5px 0 10px; }
.detail-facts { display: grid; grid-template-columns: minmax(94px, max-content) minmax(0, 1fr); gap: 7px 12px; margin: 15px 0; font-size: .9rem; }
.detail-facts dt { color: var(--muted); }
:lang(en) .detail-facts { grid-template-columns: minmax(88px, 25%) minmax(0, 1fr); }
.detail-facts dd { margin: 0; }
.rating-detail p { margin: 4px 0; }
.rating-detail .detail-source { margin: 4px 0 0; font-size: .85rem; }
.detail-section { margin-top: 19px; border-top: 1px solid var(--border); padding-top: 13px; }
.campus { margin-top: 8px; border: 1px solid var(--border); background: #f7f8f2; border-radius: 9px; padding: 10px; overflow-wrap: anywhere; }
.campus p { font-size: .84rem; margin: 3px 0; }
.campus .button { margin-top: 6px; }
.detail-source { padding-left: 1.2em; }
.detail-source li { margin: 5px 0; overflow-wrap: anywhere; }
.assessment-notes { margin: 0; padding: 0; list-style: none; }
.assessment-notes li + li { margin-top: 7px; }
.exam { border: 1px solid var(--border); border-radius: 9px; margin-top: 8px; padding: 9px 11px; }
.exam-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 7px; }
.exam h4 { margin: 0; font-size: .95rem; }
.exam p, .exam li, .exam > a { font-size: .84rem; }
.exam ul { margin: 5px 0; padding-left: 1.2em; }
.exam li + li { margin-top: 4px; }
@media (max-width: 1100px) {
  th, td { padding-inline: 8px; }
}
:lang(en) th:nth-child(2) { width: 9%; }
:lang(en) th:nth-child(4) { width: 10%; }
:lang(zh-Hant) th:nth-child(2) { width: 9%; }
:lang(zh-Hant) th:nth-child(5) { width: 13%; }
@media (min-width: 921px) {
  :lang(en) .filters { grid-template-columns: minmax(170px, 1.65fr) minmax(0, 1fr) minmax(0, 1.2fr) repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 920px) {
  .shell { width: calc(100% - 36px); }
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .search-field { grid-column: span 2; }
  th, td { padding-inline: 6px; }
  th:first-child, td:first-child { padding-left: 12px; }
  :lang(en) .stage-tags .stage-tag { white-space: normal; overflow-wrap: normal; }
}
@media (min-width: 641px) and (max-width: 920px) {
  #schools th:first-child { width: 20%; }
  #schools th:nth-child(2) { width: 11%; }
  #schools th:nth-child(3) { width: 14%; }
  #schools th:nth-child(4) { width: 12%; }
  #schools th:nth-child(5) { width: 13%; }
  #schools th:last-child { width: 7%; }
  #rows .course-tags .pill { padding-inline: 4px; font-size: .7rem; }
}
@media (max-width: 640px), (orientation: landscape) and (max-width: 950px) and (max-height: 500px) and (pointer: coarse) {
  .school-table-scroll { overflow: visible; }
  table, tbody { display: block; }
  table { min-width: 0; }
  thead { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; white-space: nowrap; }
  #rows tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas: "name name" "region region" "scores scores" "cohort stage" "course course";
    gap: 7px 12px;
    border-top: 1px solid var(--border);
    padding: 12px;
  }
  td, td:first-child, td:last-child { display: block; width: auto; min-width: 0; border: 0; padding: 0; }
  tr:hover td { background: transparent; }
  #rows [data-column="school"] { grid-area: name; padding-right: 54px; font-size: 1rem; }
  [data-column="rating"] { grid-row: 1; grid-column: 2; justify-self: end; align-self: start; }
  #rows .grade { min-width: 41px; min-height: 28px; font-size: .9rem; }
  [data-column="region"] { grid-area: region; margin-top: -3px; color: var(--muted); font-size: .79rem; }
  .school-locality { display: inline; font-size: inherit; }
  .school-locality:not(:empty)::before { content: " · "; }
  #rows [data-column="scores"] { grid-area: scores; padding: 8px 10px; border-radius: 8px; background: #f0f4ed; }
  [data-column="cohort"] { grid-area: cohort; }
  [data-column="stagesAndAge"] { grid-area: stage; }
  [data-column="typeAndCourse"] { grid-area: course; }
  .cell-label { display: block; color: var(--muted); font-size: .73rem; margin-bottom: 2px; }
  :is([data-column="region"], [data-column="rating"]) .cell-label { display: none; }
  .score-line strong { font-size: .98rem; }
  .score-line small { font-size: .76rem; }
}
@media (max-width: 640px) {
  .shell { width: calc(100% - 24px); }
  .masthead-inner { height: 55px; }
  .intro { flex-direction: column; align-items: flex-start; padding: 25px 0 18px; gap: 12px; }
  .intro-copy { font-size: .89rem; }
  .intro-stats { padding-left: 10px; gap: 16px; }
  .intro-stats div { display: flex; align-items: baseline; gap: 5px; }
  .intro-stats strong { font-size: 1.65rem; }
  .finder, .map-header, .results-header { padding: 11px; }
  .score-sort-label { max-width: 54%; }
  :lang(en) .results-title-group h2 { font-size: 1.1rem; }
  :lang(en) .score-sort-label { max-width: 50%; }
  .filters { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 7px; }
  .search-field { grid-column: auto; }
  #school-map { height: 325px; }
  .map-caption { padding: 8px 11px; gap: 5px 12px; }
  .footer { flex-direction: column; }
  dialog { margin: auto 0 0; height: auto; max-height: 92dvh; border-radius: 16px 16px 0 0; }
  .detail-head { padding: 16px; }
  .detail-content { padding: 12px 16px 20px; }
}
