/* ===== 山东省 · 第40届中国化学奥林匹克（初赛）获奖数据台 =====
   数据：中国化学会 / 山东化学化工学会官方公示名单（省一 + 省二 + 省三）
   说明：本页为静态站点，全部计算在浏览器端完成。 */
:root {
  color-scheme: dark;
  --ink: #eaf1fb; --muted: #91a0b5; --line: #243349; --panel: #101d31; --panel2: #14233a;
  --bg: #071325; --teal: #6ee7d8; --orange: #fb923c; --navy: #0a1729; --pink: #fb7185;
  --g1: #6ee7d8; --g2: #fb923c; --g3: #8b9dc4;
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif; font-size: 16px;
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; color: var(--ink);
  background: radial-gradient(circle at 78% -10%, #173b56 0, transparent 34rem), var(--bg);
}
.shell { display: grid; grid-template-columns: 268px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: rgba(7, 19, 37, .94); border-right: 1px solid var(--line);
  padding: 26px 18px 18px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 14px; overflow: auto;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px; }
.brand-mark {
  width: 46px; height: 46px; border: 1px solid #2b9d94; border-radius: 13px;
  display: grid; place-items: center; color: var(--teal); font-weight: 800; background: #0e2936;
}
.brand strong, .brand span { display: block; }
.brand strong { font-size: 1rem; }
.brand div span { font-size: .82rem; color: var(--muted); margin-top: 3px; }
.namecard {
  display: flex; align-items: center; gap: 11px; border: 1px solid #2b4a63; border-radius: 12px;
  background: linear-gradient(135deg, #12263b, #0f2d3a); padding: 10px 12px;
}
.namecard .mono {
  width: 38px; height: 38px; flex: none; border-radius: 11px; border: 1px solid #2b9d94;
  background: #0e2936; color: var(--teal); display: grid; place-items: center; font-weight: 800; font-size: .8rem;
}
.namecard b { display: block; font-size: .95rem; color: #fff; letter-spacing: .06em; }
.namecard small { display: block; color: var(--muted); font-size: .72rem; margin-top: 3px; }
.side-heading { color: var(--muted); font-size: .74rem; letter-spacing: .08em; margin: 4px 8px -6px; }
.tier-list { display: grid; gap: 7px; }
.tier-btn {
  width: 100%; border: 1px solid transparent; background: transparent; color: #aebbc9;
  border-radius: 10px; padding: 10px 12px; display: flex; justify-content: space-between;
  align-items: center; font: inherit; font-size: .9rem; cursor: pointer; text-align: left;
}
.tier-btn:hover { background: #12223a; color: #fff; }
.tier-btn.active { background: linear-gradient(90deg, #153748, #12263b); color: var(--teal); font-weight: 700; border-color: #1d4a5c; }
.tier-btn small { color: #71839a; font-size: .73rem; }
.tier-btn.active small { color: #83cfc7; }
.search-stack { display: grid; gap: 9px; padding: 0 2px; }
.search-stack label { display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 6px; }
.search-stack label span { color: var(--muted); font-size: .76rem; }
input[type=search], input[type=number], select {
  width: 100%; min-width: 0; background: #0d1b2e; border: 1px solid var(--line); color: var(--ink);
  border-radius: 9px; padding: 10px 11px; font: inherit; font-size: .86rem; outline: none;
}
input[type=search]:focus, input[type=number]:focus, select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px #6ee7d81f; }
.source-note { font-size: .72rem; line-height: 1.65; color: #66778d; border-top: 1px solid var(--line); padding: 14px 2px 0; margin-top: auto; }
.source-note b { color: #9fb3c8; }
.source-note a { color: var(--teal); text-decoration: none; }
.main { padding: 38px clamp(18px, 4vw, 60px) 60px; max-width: 1560px; width: 100%; margin: auto; }
.topbar { display: flex; align-items: flex-end; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.eyebrow, .section-kicker { margin: 0 0 7px; color: var(--muted); font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; }
.topbar h1 { margin: 0; font-size: clamp(1.7rem, 3.4vw, 2.6rem); letter-spacing: -.03em; }
.topbar h1 small { display: block; font-size: .82rem; letter-spacing: 0; color: var(--muted); font-weight: 400; margin-top: 8px; }
.total-pill {
  margin-left: auto; text-align: right; background: #0e2936; border: 1px solid #2b9d94;
  border-radius: 14px; padding: 10px 15px; min-width: 130px;
}
.total-pill span { display: block; font-size: 1.5rem; font-weight: 800; color: var(--teal); line-height: 1.1; }
.total-pill small { display: block; color: #83cfc7; font-size: .72rem; margin-top: 3px; }
.tier-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.tier-tab {
  border: 1px solid #2f4459; background: #101f33; color: #9fb3c8; border-radius: 999px;
  padding: 8px 15px; font: 600 .82rem inherit; cursor: pointer; min-height: 38px;
}
.tier-tab:hover { border-color: #3f5b78; color: #c7d4e2; }
.tier-tab.active { border-color: #2b9d94; background: #0e2936; color: var(--teal); box-shadow: inset 0 0 0 1px rgba(43,157,148,.35); }
.tier-tab .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }
.dl-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 18px; }
.dl-btn {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid #2b9d94; background: #0e2936;
  color: var(--teal); border-radius: 11px; padding: 11px 15px; font: 600 .88rem inherit; cursor: pointer; min-height: 46px;
}
.dl-btn:hover { background: #123645; }
.dl-btn.ghost { border-color: #2f4459; background: #101f33; color: #9fb3c8; }
.dl-hint { color: #66778d; font-size: .75rem; line-height: 1.55; flex: 1 1 240px; min-width: 0; }
.control-card {
  background: rgba(16, 29, 49, .86); border: 1px solid var(--line); border-radius: 18px;
  padding: 22px 24px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 1fr);
  gap: 18px 26px; margin-bottom: 20px;
}
.control-card h2 { margin: 0 0 6px; font-size: 1.3rem; }
.control-card p { margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.6; }
.range-control { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; }
input[type=range] { width: 100%; accent-color: var(--teal); }
.number-wrap { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .82rem; }
.number-wrap input { width: 84px; text-align: center; font-weight: 700; color: #fff; }
.range-presets { grid-column: 1/-1; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.preset-btn {
  border: 1px solid #2f4459; background: #101f33; color: #9fb3c8; border-radius: 999px;
  padding: 7px 13px; font: 600 .75rem inherit; cursor: pointer; min-height: 36px;
}
.preset-btn:hover { border-color: #3f5b78; color: #c7d4e2; }
.preset-btn.on { border-color: #2b9d94; color: var(--teal); background: #0e2936; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, .6fr)) minmax(0, 1.4fr); gap: 10px; margin: 0 0 20px; }
.metrics article {
  background: rgba(16, 29, 49, .82); border: 1px solid var(--line); border-radius: 13px;
  padding: 13px 15px; display: flex; flex-direction: column;
}
.metrics span { color: var(--muted); font-size: .76rem; display: block; margin-bottom: 4px; }
.metrics strong { font-size: 1.22rem; margin-top: auto; display: block; }
.metrics article:last-child strong { white-space: normal; overflow-wrap: anywhere; line-height: 1.3; }
.metrics .sub-count { font-size: .8rem; font-weight: 500; color: var(--muted); }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, .75fr); gap: 22px; }
.panel { background: rgba(16, 29, 49, .86); border: 1px solid var(--line); border-radius: 18px; padding: 22px 24px; }
details.panel { display: block; }
summary.panel-head { cursor: pointer; list-style: none; user-select: none; }
summary.panel-head::-webkit-details-marker { display: none; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 12px; }
.panel h2 { margin: 0; font-size: 1.12rem; }
details.panel:not([open]) > summary.panel-head { margin-bottom: 0; }
.panel-ctl { display: inline-flex; align-items: center; gap: 10px; flex: none; }
.fold-caret { flex: none; width: 7px; height: 7px; border-right: 2px solid #7d90a8; border-bottom: 2px solid #7d90a8; transform: rotate(45deg); transition: transform .18s ease; }
details[open] > summary.panel-head .fold-caret { transform: rotate(-135deg); }
.tag { font-size: .75rem; color: #acc0d2; background: #1c2d43; border: 1px solid #30455d; border-radius: 999px; padding: 6px 10px; white-space: nowrap; }
.tag.accent { color: #ffd2ad; border-color: #7a482a; background: #2a1d18; }
.panel-note { color: var(--muted); font-size: .8rem; line-height: 1.6; margin: -8px 0 16px; }
.panel-note b { color: #c7d4e2; }
.school-bars { display: grid; gap: 9px; }
.school-row { border: 1px solid #24364d; border-radius: 12px; background: #0c192b; overflow: hidden; }
.school-row summary { display: grid; grid-template-columns: 34px minmax(150px, 1fr) 62px; gap: 12px; align-items: center; padding: 12px 14px; cursor: pointer; list-style: none; }
.school-row summary::-webkit-details-marker { display: none; }
.school-row[open] { border-color: #376177; }
.school-row[open] summary { background: #10243a; }
.school-rank { font: 700 .78rem ui-monospace, monospace; color: #63788f; }
.school-name { font-size: .9rem; line-height: 1.3; overflow-wrap: anywhere; }
.school-name small { display: block; color: var(--muted); font-size: .72rem; font-weight: 500; margin-top: 3px; }
.bar-track { height: 6px; border-radius: 99px; background: #1a2b42; overflow: hidden; margin-top: 7px; }
.bar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--teal), #38bdf8); transform-origin: left; animation: grow .35s ease-out; }
.bar-fill.t3 { background: linear-gradient(90deg, #8b9dc4, #b9c6de); }
.bar-fill.t2 { background: linear-gradient(90deg, var(--orange), #fbbf24); }
.school-value { text-align: right; font-weight: 800; color: var(--teal); }
.school-value small { display: block; font-weight: 400; color: var(--muted); font-size: .7rem; margin-top: 2px; }
.merge-chip { display: inline-flex; align-items: center; padding: 2px 7px; margin-left: 6px; border: 1px solid #7a482a; border-radius: 999px; background: #2a1d18; color: var(--orange); font-size: .64rem; font-weight: 700; font-style: normal; white-space: nowrap; }
.merge-detail { margin: 0 14px 12px; padding: 11px 13px; border: 1px solid #2f4459; border-left: 3px solid var(--orange); border-radius: 11px; background: #0e1e31; }
.merge-detail p { margin: 0 0 4px; color: var(--orange); font-size: .74rem; font-weight: 700; }
.merge-detail .md-row { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0 0; font-size: .78rem; color: #c7d4e2; }
.merge-detail em { flex: none; color: var(--orange); font-style: normal; font-weight: 700; }
.student-list { list-style: none; margin: 0; padding: 6px 14px 14px 60px; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 7px; border-top: 1px solid var(--line); }
.student-list li { font-size: .78rem; color: #c7d4e2; background: #172940; border: 1px solid #29405b; border-radius: 10px; padding: 8px 10px; display: grid; gap: 4px; }
.student-list b { color: var(--orange); font-weight: 700; }
.student-name { font-size: .88rem; color: var(--ink); font-weight: 700; }
.student-name.female { color: var(--pink); }
.stu-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.award-chip { font-style: normal; font-size: .66rem; line-height: 1.4; padding: 2px 7px; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.award-chip.a1 { color: #a5f5e8; border-color: #2b9d94; background: #0e2936; }
.award-chip.a2 { color: #ffd2ad; border-color: #7a482a; background: #2a1d18; }
.award-chip.a3 { color: #cfd8ea; border-color: #46587a; background: #1a2233; }
.stu-rank { color: #8fa0b6; font-size: .7rem; }
/* ===== 跨届成绩徽章（紫=38届、蓝=39届；金/银/铜=39届决赛）===== */
.hbadges { display: flex; flex-wrap: wrap; gap: 5px; }
.hseg { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border: 1px solid #2f4459; border-radius: 8px; font-style: normal; font-size: .68rem; line-height: 1.45; white-space: nowrap; }
.hseg b { font-weight: 800; }
.hseg.mseg { border-left-width: 3px; }
.empty { color: var(--muted); font-size: .9rem; border: 1px dashed #33465e; border-radius: 12px; padding: 22px; text-align: center; grid-column: 1/-1; }
/* 跨届速览（侧栏）：按学校列出"有往年成绩"的人数 */
.ret-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.ret-list li { display: grid; grid-template-columns: 22px 1fr auto; gap: 9px; align-items: center;
  border: 1px solid #2a3c54; border-radius: 10px; padding: 8px 10px; background: #0c192b; }
.ret-order { color: #66778d; font: 700 .76rem ui-monospace, monospace; text-align: right; }
.ret-name { font-size: .84rem; color: #c7d4e2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ret-count { color: var(--teal); font: 700 .82rem ui-monospace, monospace; }
.rank-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 9px; }
.rank-item { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; border: 1px solid #29405b; border-radius: 11px; background: #0c192b; padding: 9px 11px; }
.rank-no { display: grid; place-items: center; min-width: 40px; height: 38px; padding: 0 7px; border: 1px solid #2b4a63; border-radius: 9px; background: #12263b; color: var(--teal); font: 700 .82rem ui-monospace, monospace; }
.rank-item.rk-a2 .rank-no { border-color: #7a482a; background: #2a1d18; color: #ffd2ad; }
.rank-item.rk-a3 .rank-no { border-color: #46587a; background: #1a2233; color: #cfd8ea; }
.rank-body { min-width: 0; display: grid; gap: 3px; font-size: .86rem; }
.rank-school { color: var(--muted); font-size: .76rem; line-height: 1.5; overflow-wrap: anywhere; }
.rank-school b { color: #c7d4e2; }
.chart-panel { margin-top: 22px; }
.chart-wrap { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.bar-chart { display: grid; gap: 7px; }
.bar-row { display: grid; grid-template-columns: minmax(96px, 150px) minmax(0, 1fr) 40px; gap: 10px; align-items: center; font-size: .8rem; }
.bar-row .bl { color: #c7d4e2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .bt { height: 16px; border-radius: 5px; background: #172940; overflow: hidden; display: flex; }
.bar-row .bt i { display: block; height: 100%; flex: 0 0 auto; }
.bar-row .bv { text-align: right; color: var(--muted); font: 700 .74rem ui-monospace, monospace; }
/* 学校排序口径切换（沿用右侧女队面板的胶囊按钮样式，但左对齐成一条工具行） */
.sort-toggle { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 14px; }
.sort-btn { border: 1px solid #2f4459; background: #101f33; color: #9fb3c8; border-radius: 999px; padding: 7px 14px; font: 600 .76rem inherit; cursor: pointer; min-height: 36px; }
.sort-btn:hover { border-color: #3f5b78; color: #c7d4e2; }
.sort-btn.active { border-color: #2b9d94; background: #0e2936; color: var(--teal); box-shadow: inset 0 0 0 1px rgba(43,157,148,.35); }
.sort-hint { color: #66778d; font-size: .76rem; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); font-size: .76rem; margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.donut-wrap { display: grid; place-items: center; gap: 12px; }
.donut-legend { display: grid; gap: 7px; width: 100%; }
.donut-legend div { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .82rem; color: #c7d4e2; }
.donut-legend b { color: var(--ink); }
.site-footer { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); color: #71839a; font-size: .78rem; text-align: center; letter-spacing: .03em; line-height: 1.8; }
.site-footer a { color: var(--teal); text-decoration: none; }
.menu-button { display: none; border: 1px solid #2f4459; background: #101f33; color: var(--ink); border-radius: 10px; width: 42px; height: 42px; font-size: 1.1rem; cursor: pointer; }
.backdrop { display: none; }
[hidden] { display: none !important; }
@keyframes grow { from { transform: scaleX(0); } }
@media (max-width: 1080px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics article:last-child { grid-column: 1/-1; }
  .content-grid { grid-template-columns: 1fr; }
  .chart-wrap { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell { display: block; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 30; transform: translateX(-102%);
    transition: transform .2s ease; box-shadow: 0 0 60px rgba(0,0,0,.5);
  }
  .sidebar.open { transform: none; }
  .menu-button { display: grid; place-items: center; }
  .backdrop { display: block; position: fixed; inset: 0; background: rgba(4,10,20,.6); z-index: 20; }
  .main { padding: 18px 14px 40px; }
  .control-card { grid-template-columns: 1fr; padding: 18px; }
  .range-control { grid-template-columns: minmax(0, 1fr) auto; }
  .student-list { padding: 6px 10px 12px 12px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
