:root {
  --page: #f2f7fc;
  --paper: #ffffff;
  --panel: #f8fafc;
  --panel-strong: #eef4f8;
  --ink: #1e2a3a;
  --navy: #0a3b5c;
  --navy-dark: #07304b;
  --accent: #1f84a9;
  --accent-dark: #0f6485;
  --muted: #64748b;
  --soft: #94a3b8;
  --line: #dfe7ee;
  --success-bg: #d8f2de;
  --success: #1d7b43;
  --danger: #b4233f;
  --shadow: 0 20px 60px rgba(0, 20, 40, 0.1);
  font-family: "Segoe UI", "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--page);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body { min-height: 100vh; margin: 0; padding: 20px 16px 40px; background: var(--page); }
button, input { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(31, 132, 169, 0.26);
  outline-offset: 2px;
}
.hidden { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; top: 10px; left: 10px; z-index: 100;
  padding: 8px 12px; color: white; background: var(--navy); border-radius: 8px;
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

.container {
  width: min(1300px, 100%); min-height: calc(100vh - 60px); margin: 0 auto;
  padding: 28px 24px 30px; background: var(--paper); border-radius: 32px; box-shadow: var(--shadow);
}
.app-header {
  min-height: 58px; padding-bottom: 18px; margin-bottom: 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  border-bottom: 2px solid #eef2f6;
}
.title-group { min-width: 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.title-mark {
  position: relative; width: 25px; height: 25px; flex: 0 0 auto;
  background: var(--navy); border-radius: 50%;
}
.title-mark::after {
  position: absolute; top: -2px; right: -2px; width: 8px; height: 8px;
  content: ""; background: white; border: 3px solid var(--navy); border-radius: 50%;
}
.app-header h1 { margin: 0; color: var(--navy); font-size: 26px; font-weight: 750; letter-spacing: -0.02em; }
.edition, .header-badges span {
  padding: 7px 14px; color: #334155; background: #eef2f6; border-radius: 24px; font-size: 13px;
}
.header-badges { display: flex; align-items: center; gap: 10px; }
.header-badges span { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; background: #19ad71; border-radius: 50%; }

.search-panel {
  padding: 18px 24px; margin-bottom: 22px;
  background: var(--panel); border: 1px solid #e5ebf0; border-radius: 20px;
}
.query-row { display: grid; grid-template-columns: auto minmax(170px, 1fr) auto auto auto; align-items: center; gap: 12px 16px; }
.rank-label { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.rank-label strong { display: inline-flex; align-items: center; gap: 8px; color: #172436; font-size: 16px; }
.rank-label small { color: var(--muted); font-size: 13px; }
.pin { width: 9px; height: 9px; background: #e94778; border: 2px solid #ffabc4; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); }
input[type="number"], input[type="search"] {
  min-width: 0; padding: 10px 12px; color: var(--ink); background: white;
  border: 1.5px solid #d6e0e8; border-radius: 14px; outline: 0;
  font-size: 16px; font-weight: 550; transition: border-color .18s, box-shadow .18s;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(31, 132, 169, .1); }
input::placeholder { color: #aab6c5; font-weight: 400; }
select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(31, 132, 169, .1); }
.range-control { display: grid; grid-template-columns: auto 98px auto 98px; align-items: center; gap: 8px; }
.range-control label { display: inline-flex; align-items: center; gap: 5px; color: #334155; font-size: 14px; white-space: nowrap; }
.range-control input { width: 98px; text-align: center; font-weight: 700; }
.range-icon { width: 15px; height: 15px; display: inline-grid; place-items: center; color: white; background: #5b9def; border-radius: 2px; font-size: 11px; font-weight: 800; }
.button {
  min-height: 42px; padding: 9px 22px; border: 0; border-radius: 14px;
  cursor: pointer; font-size: 15px; font-weight: 700; white-space: nowrap;
  transition: background .18s, transform .12s;
}
.button:active { transform: scale(.97); }
.button-primary { color: white; background: var(--accent); }
.button-primary:hover { background: var(--accent-dark); }
.button-muted { color: #25364a; background: #e9eef4; }
.button-muted:hover { background: #dae4ec; }
.keyword-row { margin-top: 12px; display: grid; grid-template-columns: minmax(200px, 1fr) auto auto; gap: 10px; }
.dimension-row {
  width: 100%; margin-top: 18px; padding-top: 14px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  border-top: 1px dashed #d6e0e8;
}
.dimension-label { color: #334155; font-weight: 650; }
.round-filter { margin: 0; padding: 0; display: flex; gap: 8px; border: 0; }
.round-filter label { position: relative; cursor: pointer; }
.round-filter input { position: absolute; opacity: 0; pointer-events: none; }
.round-filter span {
  min-height: 38px; padding: 0 13px; display: inline-flex; align-items: center;
  color: #334155; background: white; border: 1.5px solid #d6e0e8; border-radius: 11px; font-size: 14px;
}
.round-filter input:checked + span { color: white; background: var(--accent); border-color: var(--accent); }
.round-filter input:focus-visible + span { outline: 3px solid rgba(31,132,169,.26); outline-offset: 2px; }
.dimension-select { display: inline-flex; align-items: center; gap: 8px; color: #334155; font-size: 14px; font-weight: 650; }
.dimension-select select {
  min-height: 38px; padding: 0 34px 0 12px; color: #24364a; background: white;
  border: 1.5px solid #d6e0e8; border-radius: 11px; outline: 0; font: inherit; cursor: pointer;
}
.dimension-select select:disabled { color: #8a99aa; background: #edf1f5; cursor: not-allowed; }
.current-data { color: var(--accent-dark); font-weight: 650; }
.storage-status { padding: 3px 12px; color: var(--success); background: var(--success-bg); border-radius: 24px; font-size: 12px; }
.form-message { min-height: 18px; margin: 9px 0 -8px; color: var(--danger); font-size: 12px; font-weight: 700; }

.result-summary { padding: 12px 4px 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 26px; border-bottom: 1px dashed #dbe4eb; }
.stats { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 25px; }
.stats span { color: #334155; font-size: 14px; }
.stats span::before { margin-right: 6px; color: #d84d73; }
.stats span:nth-child(1)::before { content: "◆"; }
.stats span:nth-child(2)::before { content: "▣"; color: #40b878; }
.stats span:nth-child(3)::before { content: "▥"; color: #7a7896; }
.stats span:nth-child(4)::before { content: "Σ"; color: var(--accent); }
.stats strong { margin-left: 4px; color: var(--navy); font-size: 17px; }
.filter-status { display: flex; flex-wrap: wrap; gap: 12px 22px; color: var(--accent-dark); font-size: 13px; }

.province-nav { padding: 16px 0 13px; display: flex; flex-wrap: wrap; gap: 8px 12px; border-bottom: 1px solid var(--line); }
.province-button {
  padding: 5px 14px; color: var(--accent-dark); background: #edf2f6;
  border: 1px solid transparent; border-radius: 20px; cursor: pointer; font-size: 13px; font-weight: 650;
}
.province-button:hover { background: #dbeaf1; }
.province-button.active { color: white; background: var(--accent); border-color: var(--accent); }
.province-button small { margin-left: 4px; opacity: .78; font-size: 10px; }

.results { margin-top: 15px; }
.message-state { min-height: 160px; display: grid; place-items: center; align-content: center; gap: 8px; color: var(--muted); text-align: center; }
.message-state p { margin: 0; font-size: 14px; }
.loader { width: 28px; height: 28px; border: 3px solid #d7e4ec; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.school-list { display: flex; flex-direction: column; gap: 7px; }
.school-item { background: white; border: 1px solid #e0e8ee; border-radius: 10px; overflow: hidden; }
.school-item summary {
  min-height: 48px; padding: 10px 14px; display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  list-style: none; background: var(--panel); cursor: pointer; user-select: none;
}
.school-item summary::-webkit-details-marker { display: none; }
.school-item summary:hover { background: var(--panel-strong); }
.school-arrow { color: #94a3b8; font-size: 13px; transition: transform .2s; }
.school-item[open] .school-arrow { transform: rotate(90deg); }
.school-name { min-width: 0; color: var(--navy); font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.school-code { margin-right: 3px; font-size: 13px; }
.school-meta { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.school-meta span:first-child { padding: 4px 10px; color: #334155; background: #eef2f6; border-radius: 20px; }
.school-meta span:last-child { color: var(--accent-dark); font-weight: 650; }
.major-list { padding: 4px 10px 9px 42px; display: flex; flex-direction: column; gap: 4px; }
.major-item {
  padding: 8px 12px; display: grid; grid-template-columns: minmax(180px, 1fr) auto auto auto auto auto; align-items: center; gap: 10px 14px;
  background: #f9fbfd; border-left: 3px solid transparent; border-radius: 8px; font-size: 13px;
}
.major-item:hover { background: #f1f6fa; border-left-color: var(--accent); }
.major-name { min-width: 0; color: #0b2a3a; font-weight: 600; overflow-wrap: anywhere; }
.major-code { margin-right: 7px; color: var(--accent-dark); font-size: 11px; }
.major-detail { color: #526478; white-space: nowrap; }
.level-tag { padding: 4px 8px; color: #315c46; background: #e1f2e6; border-radius: 6px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.admission-tag { padding: 4px 8px; color: #173b63; background: #e3edf7; border-radius: 6px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.category-艺术类 { color: #7b3d67; background: #f7e8f1; }
.category-体育类 { color: #7b4e12; background: #fff0d8; }
.track-tag { padding: 4px 8px; color: #674f18; background: #f7f0d8; border-radius: 6px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.score-detail { color: #8b5416; font-weight: 750; white-space: nowrap; }
.subject-tag { padding: 4px 8px; color: #40536a; background: #e9eef4; border-radius: 6px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.major-rank { color: var(--accent-dark); font-weight: 750; white-space: nowrap; }
.round-tag { padding: 4px 8px; color: var(--accent-dark); background: #e6f2f7; border-radius: 6px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.round-tag.round-3 { color: #865614; background: #fff1d9; }
.rank-delta { color: var(--muted); font-size: 11px; white-space: nowrap; }
.app-footer { margin-top: 28px; padding-top: 17px; display: flex; justify-content: space-between; gap: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.7; }
.footer-block { display: grid; gap: 5px; max-width: 620px; }
.app-footer p { margin: 0; }
.app-footer strong { color: var(--ink); }
.app-footer a { color: var(--accent-dark); text-underline-offset: 2px; }

@media (max-width: 1000px) {
  .query-row { grid-template-columns: auto minmax(180px, 1fr) auto auto; }
  .range-control { grid-column: 1 / 3; }
  .major-item { grid-template-columns: minmax(180px, 1fr) auto auto; }
  .rank-delta { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
  body { padding: 12px 8px 24px; }
  .container { min-height: calc(100vh - 24px); padding: 16px 12px 22px; border-radius: 20px; }
  .app-header { align-items: flex-start; flex-direction: column; }
  .title-group { gap: 9px; }
  .title-mark { width: 22px; height: 22px; }
  .app-header h1 { max-width: calc(100% - 34px); font-size: 20px; }
  .edition { margin-left: 31px; margin-top: -4px; font-size: 11px; }
  .header-badges { width: 100%; }
  .header-badges span { flex: 1; justify-content: center; font-size: 12px; }
  .search-panel { padding: 16px; border-radius: 20px; }
  .query-row { grid-template-columns: 1fr 1fr; align-items: stretch; }
  .rank-label, .rank-input { grid-column: 1 / -1; }
  .rank-label { white-space: normal; }
  .rank-label small { line-height: 1.45; }
  .rank-input { min-height: 82px; padding: 18px 14px; font-size: 20px !important; }
  .range-control { grid-column: 1 / -1; grid-template-columns: 90px 1fr; }
  .range-control input { width: 100%; }
  .query-row > .button { width: 100%; }
  .keyword-row { grid-template-columns: 1fr; }
  .keyword-row .button { width: 100%; }
  .dimension-row { align-items: stretch; flex-direction: column; }
  .round-filter { width: 100%; }
  .round-filter label { min-width: 0; flex: 1; }
  .round-filter span { width: 100%; padding: 0 7px; justify-content: center; font-size: 12px; }
  .dimension-select { width: 100%; justify-content: space-between; }
  .dimension-select select { min-width: 0; flex: 1; }
  .current-data, .storage-status { text-align: center; }
  .result-summary { align-items: flex-start; flex-direction: column; }
  .stats { gap: 8px 16px; }
  .province-nav { gap: 7px 9px; }
  .province-button { padding: 4px 11px; font-size: 12px; }
  .school-item summary { grid-template-columns: 18px minmax(0, 1fr); padding: 10px; }
  .school-name { font-size: 15px; }
  .school-meta { grid-column: 2; width: 100%; }
  .major-list { padding: 4px 8px 8px 20px; }
  .major-item { grid-template-columns: 1fr 1fr; gap: 7px 10px; padding: 9px; }
  .major-name { grid-column: 1 / -1; }
  .major-rank { text-align: right; }
  .round-tag { justify-self: start; }
  .rank-delta { grid-column: 1 / -1; }
  .app-footer { flex-direction: column; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
