:root {
  --hu-red: #cd1125;
  --hu-white: #ffffff;
  --hu-green: #00923f;
  --bg: #f4f6fb;
  --panel: #ffffff;
  --ink: #1c2433;
  --ink-soft: #5a6478;
  --line: #e4e8f0;
  --brand: #1b2a5b;
  --brand-2: #2f4ba0;
  --accent: #cd1125;
  --good: #1f9d55;
  --warn: #e0a106;
  --bad: #cd1125;
  --shadow: 0 6px 24px rgba(20, 30, 60, 0.08);
  --radius: 0;
  --fs: 15px;
  --fw: 400;
  --lh: 1.55;
  --ls: 0px;
  --ff: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  --ta: left;
  --fstyle: normal;
  --fdec: none;
  --op: 1;
  --grade5: #1f9d55;
  --grade4: #4cae4f;
  --grade3: #e0a106;
  --grade2: #e8743b;
  --grade1: #cd1125;
}

* { box-sizing: border-box; }
html { font-size: var(--fs); }
html[data-fs="sm"] { --fs: 13px; }
html[data-fs="md"] { --fs: 15px; }
html[data-fs="lg"] { --fs: 17px; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--ff);
  background: var(--bg);
  color: var(--ink);
  line-height: var(--lh);
  font-weight: var(--fw);
  letter-spacing: var(--ls);
  text-align: var(--ta);
  font-style: var(--fstyle);
  text-decoration: var(--fdec);
}
main { opacity: var(--op); transition: opacity .15s; }
h1, h2, h3 { margin: 0; font-weight: 700; }

/* Top bar */
.topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 12px 22px;
  background: var(--brand);
  color: #fff;
  position: sticky; top: 0; z-index: 30;
  box-shadow: 0 2px 12px rgba(0,0,0,.18);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-flag { width: calc(34 / 15 * 1rem); height: calc(23 / 15 * 1rem); flex: 0 0 auto; line-height: 1; overflow: hidden; }
.flag-img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; border: 0; }
.brand-text h1 { font-size: calc(17 / 15 * 1rem); letter-spacing: .2px; }
.brand-text p { margin: 0; font-size: calc(11 / 15 * 1rem); opacity: .7; font-weight: 500; }

/* 地区切换条（🇭🇺 HUN / 🇦🇺 AUS）：置于品牌与主导航之间，胶囊分段控件 */
.region-switch {
  display: flex; align-items: center; gap: 2px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 0; padding: 3px;
  flex: 0 0 auto;
}
.rs-trigger {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; cursor: pointer; background: transparent; color: #fff;
  font-size: calc(13 / 15 * 1rem); font-weight: 800; letter-spacing: .4px;
  padding: 6px 12px; border-radius: 0; line-height: 1;
  transition: background .15s, color .15s, box-shadow .15s;
}
.rs-trigger:hover { background: rgba(255,255,255,.16); color: #fff; }
.rs-trigger .rs-flag { width: calc(20 / 15 * 1rem); height: calc(14 / 15 * 1rem); overflow: hidden; }
.rs-trigger .rs-caret { font-size: calc(10 / 15 * 1rem); opacity: .8; }
@media (max-width: 560px) {
  .region-switch { order: 3; width: 100%; justify-content: center; }
}

/* ===================== 地区选择：列表 / 卡片 / 世界地图 ===================== */
.rp-hint { margin: 0 0 12px; font-size: calc(12.5 / 15 * 1rem); color: #5a6478; }
.region-picker { width: 100%; }
.region-picker.rp-list {
  max-height: 56vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; gap: 8px; padding-right: 2px;
}
.rp-item {
  display: grid; grid-template-columns: auto 64px 1fr auto; gap: 12px; align-items: center;
  width: 100%; text-align: left; cursor: pointer; border: 1px solid #e4e8f0;
  background: #f7f9fc; border-radius: 0; padding: 12px 14px; color: #1f2733;
  transition: border-color .15s, background .15s, transform .05s;
}
.rp-item:hover { border-color: var(--brand); background: #eef3fb; }
.rp-item:active { transform: scale(.995); }
.rp-item.active { border-color: var(--brand); background: #e7eefb; box-shadow: inset 0 0 0 1px var(--brand); }
.rp-flag { width: calc(34 / 15 * 1rem); height: calc(23 / 15 * 1rem); flex: 0 0 auto; overflow: hidden; line-height: 1; }
.rp-code { font-size: calc(15 / 15 * 1rem); font-weight: 800; letter-spacing: .4px; text-align: left; white-space: nowrap; }
.rp-name { font-size: calc(14 / 15 * 1rem); color: #1f2733; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-check { color: var(--brand); font-weight: 800; font-size: calc(15 / 15 * 1rem); justify-self: end; }

.region-picker.rp-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px;
  max-height: 64vh; overflow-y: auto; padding: 2px;
}
.region-picker.rp-cards .rp-item { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 16px; }
.region-picker.rp-cards .rp-check { position: absolute; top: 12px; right: 12px; }

.region-picker.rp-map { width: 100%; }
.worldmap { position: relative; width: 100%; border-radius: 0; overflow: hidden; background: #eaf1fb; }
.worldmap-svg { display: block; width: 100%; height: auto; }
.worldmap-markers { position: absolute; inset: 0; }
.rp-pin {
  position: absolute; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  border: none; cursor: pointer; background: transparent; padding: 2px;
}
.rp-pin-flag { width: calc(30 / 15 * 1rem); height: calc(20 / 15 * 1rem); line-height: 1; filter: drop-shadow(0 1px 2px rgba(0,0,0,.35)); }
.rp-pin-code {
  font-size: calc(10.5 / 15 * 1rem); font-weight: 800; color: #15315e;
  background: rgba(255,255,255,.85); border-radius: 0; padding: 0 5px; letter-spacing: .4px;
}
.rp-pin::after {
  content: ''; position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%);
  width: 8px; height: 8px; border-radius: 0; background: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.25);
}
.rp-pin.active .rp-pin-flag { transform: scale(1.25); }
.rp-pin:hover .rp-pin-flag { transform: scale(1.2); }
.rp-pin.active::after { background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,.25); }

/* 首页样式下拉 */
.home-style-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.home-style-sel {
  font-size: calc(14 / 15 * 1rem); padding: 9px 12px; border-radius: 0;
  border: 1px solid #d7deea; background: #fff; color: #1f2733; min-width: 170px;
}
.home-style-sel:focus { outline: 2px solid var(--brand); outline-offset: 1px; }

.tabs { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.tab {
  background: transparent; color: #cdd6f0; border: none; cursor: pointer;
  padding: 9px 16px; border-radius: 0; font-size: calc(14 / 15 * 1rem); font-weight: 600;
  transition: background .15s, color .15s;
}
.tab:hover { background: rgba(255,255,255,.1); color: #fff; }
.tab.active { background: #fff; color: var(--brand); }

/* ===== Top-right tools: 字体弹出 + 语言下拉（语言在最右） ===== */
.top-tools { display: flex; align-items: center; gap: 10px; margin-left: 10px; }
.font-pop { position: relative; }
.tool-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.3);
  border-radius: 0; padding: 0 12px; cursor: pointer; font-weight: 600; font-size: calc(13 / 15 * 1rem);
  font-family: inherit; line-height: 1; white-space: nowrap;
  height: 36px; width: 120px; appearance: none; box-sizing: border-box;
}
.tool-btn:hover { background: rgba(255,255,255,.22); }
.tool-btn[aria-expanded="true"] { background: #fff; color: var(--brand); border-color: #fff; }
.tool-btn .tool-aa { font-style: italic; font-weight: 800; }
.tool-btn .tool-chev { font-size: calc(9 / 15 * 1rem); opacity: .85; margin-left: 1px; }
.font-pop-panel {
  position: absolute; top: calc(100% + 9px); right: 0; z-index: 50;
  width: min(440px, 88vw); max-height: 72vh; overflow: auto;
  background: #fff; color: var(--ink); border: 1px solid var(--line);
  box-shadow: 0 10px 34px rgba(0,0,0,.22); padding: 14px 16px;
}
.font-pop-panel .font-settings { box-shadow: none; border: 0; padding: 0; }
.top-lang {
  background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.3);
  border-radius: 0; padding: 7px 26px 7px 10px; cursor: pointer; font-weight: 600; font-size: calc(13 / 15 * 1rem);
  height: 36px; width: 120px; appearance: none; font-family: inherit;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='white' stroke-width='1.6'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center;
  box-sizing: border-box; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;
}
.top-lang:hover { background-color: rgba(255,255,255,.22); }
.top-lang option { background: #fff; color: var(--ink); }

.school-select {
  background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.3);
  border-radius: 0; padding: 7px 28px 7px 10px; font-size: calc(13 / 15 * 1rem); font-weight: 600; cursor: pointer;
  max-width: 280px; min-width: 160px; height: 36px; appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='white' stroke-width='1.6'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center;
}
.school-select:hover { background-color: rgba(255,255,255,.2); }
.school-select option { color: #1c2433; background: #fff; }

/* School hero banner */
.school-hero {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(90deg, #1b2a5b, #2f4ba0); color: #fff;
  border-radius: var(--radius); padding: 16px 20px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.school-hero .sh-icon { font-size: calc(30 / 15 * 1rem); line-height: 1; }
.school-hero .sh-name { font-size: calc(20 / 15 * 1rem); font-weight: 800; }

/* 概览顶部「大大的学校招牌」：一整行、与快速录入学校同步（非下拉） */
.school-hero.big { padding: 22px 26px; margin-bottom: 20px; border-radius: var(--radius); }
.school-hero.big .sh-icon { font-size: calc(42 / 15 * 1rem); }
.school-hero.big .school-logo-wrap { width: 56px; height: 56px; flex: 0 0 56px; border-radius: 0; box-shadow: 0 2px 10px rgba(0,0,0,.28); border: none; }
.school-hero.big .school-logo-wrap .monogram { font-size: calc(20 / 15 * 1rem); }
.school-hero.big .sh-name { font-size: calc(28 / 15 * 1rem); font-weight: 800; letter-spacing: .3px; }
.school-hero.big .sh-sub { font-size: calc(12.5 / 15 * 1rem); opacity: .82; margin-top: 3px; font-weight: 500; }

/* Layout */
main { max-width: 1180px; margin: 0 auto; padding: 22px; }
.view { display: none; animation: fade .25s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 20px; box-shadow: var(--shadow);
}
.panel-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h2 { font-size: calc(16 / 15 * 1rem); color: var(--brand); }
.hint { font-size: calc(12.5 / 15 * 1rem); color: var(--ink-soft); }
.panel-head.cal-head { justify-content: space-between; align-items: center; gap: 10px; flex-wrap: nowrap; }
.panel-head.cal-head h2 { flex: 0 0 auto; }
.panel-head.cal-head .hint { flex: 0 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-head.cal-head .live-countdown {
  margin-left: auto; padding: 0; background: transparent; border: 0;
  display: inline-flex; flex-direction: column; align-items: flex-end; gap: 2px;
}
.panel-head.cal-head .live-countdown .lc-row { gap: 8px; align-items: center; }
.panel-head.cal-head .live-countdown .lc-tz-left { font-size: calc(10 / 15 * 1rem); text-align: right; }
.panel-head.cal-head .live-countdown .lc-event { margin-top: 0; font-size: calc(11 / 15 * 1rem); text-align: right; }

/* Overview top: 1/4 metric · 1/4 metric · 2/4 calendar */
.ov-top { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 16px; margin-bottom: 20px; align-items: stretch; }
.ov-top > .summary-grid { grid-column: 1 / 3; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 0; }
.ov-top > .ov-cal-panel { grid-column: 3 / 4; margin-bottom: 0; display: flex; flex-direction: column; }
.ov-cal-panel .exam-calendar { flex: 1; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--cardc, var(--brand-2)); }
.card .label { font-size: calc(12 / 15 * 1rem); color: var(--ink-soft); text-transform: none; letter-spacing: .3px; font-weight: 700; }
.card .value { font-size: calc(32 / 15 * 1rem); font-weight: 800; margin-top: 6px; color: var(--cardc, var(--brand)); }
.card .sub { font-size: calc(12 / 15 * 1rem); color: var(--ink-soft); margin-top: 4px; }
.card .progress { height: 6px; background: #e4e8f0; border-radius: 0; margin-top: 10px; overflow: hidden; }
.card .progress span { display: block; height: 100%; background: var(--brand-2); border-radius: 0; transition: width .3s ease; }

.chart-wrap { position: relative; height: 320px; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.stats-grid .panel { margin-bottom: 0; }
@media (max-width: 1024px) {
  .ov-top { grid-template-columns: 1fr 1fr 1.5fr; }
}
@media (max-width: 860px) {
  .ov-top { grid-template-columns: 1fr; }
  .ov-top > .summary-grid { grid-column: auto; grid-template-columns: 1fr 1fr; }
  .ov-top > .ov-cal-panel { grid-column: auto; }
  .stats-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .ov-top > .summary-grid { grid-template-columns: 1fr; }
}

/* Recent semesters */
.recent-list { display: flex; flex-direction: column; gap: 10px; }
.recent-row {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr; gap: 10px; align-items: center;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 0; background: #fafbfe;
}
.recent-row.head { background: transparent; border: none; padding: 4px 14px; font-size: calc(11 / 15 * 1rem); text-transform: none; letter-spacing: .2px; color: var(--ink-soft); font-weight: 700; }
.recent-row .sem { font-weight: 700; color: var(--brand); display: flex; flex-direction: column; line-height: 1.25; }
.recent-row .sem .rs-school { font-size: calc(15 / 15 * 1rem); }
.recent-row .sem .rs-term { font-size: calc(12 / 15 * 1rem); color: var(--ink-soft); font-weight: 600; }
.recent-row .num { font-variant-numeric: tabular-nums; text-align: right; }
.recent-row .num.two { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.recent-row .num.two span { font-size: calc(12.5 / 15 * 1rem); font-weight: 700; }
.recent-row .num.two small { font-size: calc(10 / 15 * 1rem); color: var(--ink-soft); font-weight: 600; }
.empty { color: var(--ink-soft); text-align: center; padding: 30px; font-style: italic; }
.empty-action { display: flex; flex-direction: column; align-items: center; gap: 14px; font-style: normal; }
.empty-action p { margin: 0; max-width: 420px; line-height: 1.6; }

/* Toolbar */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.spacer { flex: 1; }
.grade-search-row { margin-bottom: 16px; }
.grade-search {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 0;
  font-size: calc(13.5 / 15 * 1rem); font-family: inherit; color: var(--ink); background: #fff;
}
.grade-search:focus { outline: 2px solid var(--brand-2); border-color: transparent; }
.filter-chips { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.filter-chip {
  height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 0;
  font-size: calc(13 / 15 * 1rem); font-family: inherit; color: var(--ink); background: #fff;
  cursor: pointer; transition: .15s; font-weight: 600;
}
.filter-chip:hover { background: #f2f5fb; }
.filter-chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.filter-panel { display: none; background: #fafbff; border: 1px solid var(--line); padding: 14px; margin-bottom: 16px; }
.filter-panel.open { display: block; }
.filter-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.filter-row:last-child { margin-bottom: 0; }
.filter-row.filter-actions { justify-content: flex-end; }
.filter-label { font-weight: 700; color: var(--ink-soft); font-size: calc(12.5 / 15 * 1rem); white-space: nowrap; }
#toggleFilterBtn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.empty.small { padding: 16px; font-size: calc(13 / 15 * 1rem); }
.btn {
  background: #eef1f8; color: var(--brand); border: 1px solid var(--line); border-radius: 0;
  padding: 10px 16px; cursor: pointer; font-weight: 600; font-size: calc(14 / 15 * 1rem); transition: .15s;
}
.btn:hover { background: #e2e7f5; }
.btn.primary { background: var(--brand-2); color: #fff; border-color: var(--brand-2); }
.btn.primary:hover { background: #25408c; }
.btn.danger { background: #fff; color: var(--bad); border-color: #f2c2c8; }
.btn.danger:hover { background: #fdeef0; }
.btn.small { padding: 5px 10px; font-size: calc(12.5 / 15 * 1rem); border-radius: 0; }

/* Tree */
.tree { display: flex; flex-direction: column; gap: 14px; }
.year-block { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.year-head {
  display: grid; grid-template-columns: 16px 120px 1fr auto; align-items: center; gap: 10px; padding: 14px 18px; cursor: pointer;
  background: linear-gradient(90deg, #f7f9ff, #fff); border-bottom: 1px solid var(--line);
}
.year-head .ytitle { font-size: calc(16 / 15 * 1rem); font-weight: 800; color: var(--brand); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.year-head .ychev { transition: transform .2s; color: var(--ink-soft); }
.year-block.collapsed .year-head .ychev { transform: rotate(-90deg); }
.year-head .ystats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; font-size: calc(12.5 / 15 * 1rem); color: var(--ink-soft); }
.year-head .ystats b { color: var(--ink); }
.year-head .yactions { display: flex; gap: 6px; }

.sem-block { border-bottom: 1px solid var(--line); }
.sem-block:last-child { border-bottom: none; }
.sem-head {
  display: grid; grid-template-columns: 16px 120px 1fr auto; align-items: center; gap: 10px; padding: 11px 18px 11px 34px; cursor: pointer;
  background: #fbfcff;
}
.sem-head .stitle { font-weight: 700; color: var(--brand-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sem-head .schev { color: var(--ink-soft); transition: transform .2s; }
.sem-block.collapsed .sem-head .schev { transform: rotate(-90deg); }
.sem-head .sstats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; font-size: calc(12.5 / 15 * 1rem); color: var(--ink-soft); }
.sem-head .sstats b { color: var(--ink); }
.sem-head .sactions { display: flex; gap: 6px; }
.year-block.collapsed .sem-block, .year-block.collapsed .year-foot { display: none; }
.sem-block.collapsed .course-row { display: none; }

/* School (multi-school top-level grouping) */
.school-block {
  background: var(--panel); border: 1.5px solid var(--brand); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.school-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; cursor: pointer;
  background: linear-gradient(90deg, #eef3ff, #f8faff); border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.school-head .school-logo-wrap { width: 34px; height: 34px; flex: 0 0 34px; }
.school-head .schev { transition: transform .2s; color: var(--ink-soft); font-size: calc(13 / 15 * 1rem); }
.school-block.collapsed .school-head .schev { transform: rotate(-90deg); }
.school-head .sctitle {
  font-size: calc(17 / 15 * 1rem); font-weight: 800; color: var(--brand);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.school-head .scdeg {
  font-size: calc(11 / 15 * 1rem); font-weight: 700; color: #fff; background: var(--brand-2);
  padding: 2px 9px; border-radius: 0; white-space: nowrap;
}
.school-head .scstats {
  display: flex; flex-wrap: nowrap; gap: 14px; align-items: center;
  font-size: calc(12.5 / 15 * 1rem); color: var(--ink-soft); margin-left: auto;
}
.school-head .scstats b { color: var(--ink); }
.school-head .scactions { display: flex; gap: 6px; }
.school-block.collapsed .year-block { display: none; }
/* 学年/学期在学校内缩进，体现层级 */
.school-block .year-block { margin: 10px; border-color: var(--line); box-shadow: none; }
.school-block .year-block:last-child { margin-bottom: 10px; }

.year-foot { padding: 10px 18px 14px 34px; }
.course-add-btn { font-size: calc(13 / 15 * 1rem); }

.course-row {
  display: grid; grid-template-columns: 1.6fr .8fr .7fr .7fr auto; gap: 12px; align-items: center;
  padding: 9px 18px 9px 46px; border-top: 1px dashed var(--line); font-size: calc(14 / 15 * 1rem);
}
.course-row:hover { background: #fafbff; }
.course-row .cname { font-weight: 600; }
.course-row .ccode { color: var(--ink-soft); font-size: calc(12 / 15 * 1rem); }
.et-badge { display: inline-block; margin-left: 6px; padding: 1px 6px; background: #eef2ff; color: var(--brand-2); border: 1px solid var(--brand-2); font-size: calc(10 / 15 * 1rem); font-weight: 700; }
.course-row .cnum { font-variant-numeric: tabular-nums; text-align: center; }
.grade-pill {
  display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px;
  border-radius: 0; color: #fff; font-weight: 800; font-size: calc(14 / 15 * 1rem); cursor: pointer; border: none;
}
.grade-pill.g5 { background: var(--grade5); }
.grade-pill.g4 { background: var(--grade4); }
.grade-pill.g3 { background: var(--grade3); }
.grade-pill.g2 { background: var(--grade2); }
.grade-pill.g1 { background: var(--grade1); }
.grade-pill.g0 { background: #b9c0d0; }
.course-row .cactions { display: flex; gap: 6px; justify-content: flex-end; }

@media (max-width: 720px) {
  .course-row { grid-template-columns: 1.4fr .6fr .6fr auto; }
  .course-row .ccode { display: none; }
  .recent-row { grid-template-columns: 1.2fr 1fr 1fr; }
  .recent-row .hide-sm { display: none; }
}

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(18, 26, 51, .55); display: flex; align-items: center;
  justify-content: center; z-index: 50; padding: 18px;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: #fff; border-radius: 0; width: 100%; max-width: 520px; box-shadow: 0 20px 60px rgba(0,0,0,.3);
  max-height: 90vh; display: flex; flex-direction: column; overflow: hidden;
}
.modal:has(.region-picker.rp-map), .modal:has(.region-picker.rp-cards) { max-width: 720px; }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: calc(16 / 15 * 1rem); color: var(--brand); }
.modal-close { margin-left: auto; background: none; border: none; font-size: calc(18 / 15 * 1rem); cursor: pointer; color: var(--ink-soft); }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: calc(13 / 15 * 1rem); font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.field input, .field select {
  width: 100%; height: 44px; padding: 0 34px 0 12px; border: 1px solid var(--line); border-radius: 0; font-size: calc(14 / 15 * 1rem);
  font-family: inherit; color: var(--ink); background: #fff; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%23334155' stroke-width='1.6'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center;
}
.field input:focus, .field select:focus { outline: 2px solid var(--brand-2); border-color: transparent; }
.field input { padding-right: 12px; background-image: none; appearance: auto; cursor: text; }
.field .err { color: var(--bad); font-size: calc(12 / 15 * 1rem); margin-top: 4px; display: none; }
.field.invalid .err { display: block; }
.field.invalid input { border-color: var(--bad); }

.grade-choices { display: flex; gap: 8px; flex-wrap: wrap; }
.grade-opt {
  flex: 1; min-width: 64px; padding: 10px; border: 2px solid var(--line); border-radius: 0; cursor: pointer;
  text-align: center; font-weight: 700; background: #fff; transition: .12s;
}
.grade-opt small { display: block; font-size: calc(10.5 / 15 * 1rem); font-weight: 500; color: var(--ink-soft); }
.grade-opt.sel { border-color: var(--brand-2); background: #eef2ff; }
.grade-opt.g5.sel { border-color: var(--grade5); background: #e8f6ee; }
.grade-opt.g4.sel { border-color: var(--grade4); background: #eaf7ea; }
.grade-opt.g3.sel { border-color: var(--grade3); background: #fdf6e3; }
.grade-opt.g2.sel { border-color: var(--grade2); background: #fdeee4; }
.grade-opt.g1.sel { border-color: var(--grade1); background: #fdeef0; }

/* Data view */
.data-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.scale-legend { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.scale-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center; padding: 14px 8px; border-radius: 0; color: #fff; font-weight: 800; }
.scale-item .sc-num { font-size: calc(20 / 15 * 1rem); font-weight: 800; line-height: 1; opacity: .82; }
.scale-item .sc-cn { font-size: calc(15 / 15 * 1rem); font-weight: 800; line-height: 1.12; }
.scale-item .sc-en { font-size: calc(10.5 / 15 * 1rem); font-weight: 500; opacity: .9; line-height: 1.1; }
.scale-item.g5 { background: var(--grade5); }
.scale-item.g4 { background: var(--grade4); }
.scale-item.g3 { background: var(--grade3); }
.scale-item.g2 { background: var(--grade2); }
.scale-item.g1 { background: var(--grade1); }
.formula-list { margin: 0; padding-left: 20px; }
.formula-list li { margin-bottom: 12px; font-size: calc(14 / 15 * 1rem); }
.formula-list code { background: #eef1f8; padding: 2px 7px; border-radius: 0; font-size: calc(13 / 15 * 1rem); color: var(--brand); }

.foot { text-align: center; color: var(--ink-soft); font-size: calc(12 / 15 * 1rem); padding: 22px; letter-spacing: .5px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--brand); color: #fff; padding: 12px 22px; border-radius: 0;
  font-size: calc(14 / 15 * 1rem); font-weight: 600; z-index: 60; box-shadow: 0 8px 30px rgba(0,0,0,.25);
  animation: pop .25s ease;
}
@keyframes pop { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%); } }

/* 概览倒数日：条目可点击编辑 */
.exam-countdown-click .exam-row { cursor: pointer; transition: background .12s, box-shadow .12s; }
.exam-countdown-click .exam-row:hover { background: #eef2ff; box-shadow: inset 3px 0 0 var(--brand-2); }
.exam-countdown-click .exam-row:focus { outline: 2px solid var(--brand-2); outline-offset: -2px; }

/* Quick-add: strict grid layout — every control is a uniform square-edged rectangle */
.qrow { display: grid; gap: 12px; margin-bottom: 12px; }
.qrow:last-child { margin-bottom: 0; }
.qrow-1 { grid-template-columns: 4fr 1fr 1fr 2fr; }
.qrow-2 { grid-template-columns: 4fr 2fr 1fr 1fr; }
.qrow-3 { grid-template-columns: 4fr 4fr; align-items: end; }

.qfield { display: flex; flex-direction: column; }
.qfield label {
  display: flex; flex-direction: column; justify-content: flex-end;
  min-height: 2.4em;
  font-size: calc(11.5 / 15 * 1rem); font-weight: 700; color: var(--ink-soft);
  margin-bottom: 6px; text-transform: none; letter-spacing: .2px; line-height: 1.2;
}
.qfield input, .qfield select {
  width: 100%; height: 46px; padding: 0 12px; border: 1px solid var(--line); border-radius: 0;
  font-size: calc(14 / 15 * 1rem); font-family: inherit; color: var(--ink); background: #fff;
}
.qfield input:focus, .qfield select:focus { outline: 2px solid var(--brand-2); border-color: transparent; }

/* School (read-only) field: logo + CN name (top) + EN name (small, bottom) */
.qfield .ro {
  height: 46px; display: flex; align-items: center; gap: 10px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 0; background: #fafbff;
}
.qfield .ro .school-logo-wrap { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 0; box-shadow: none; border: 1px solid var(--line); }
.qfield .ro .school-logo-wrap .monogram { font-size: calc(12 / 15 * 1rem); }
.school-names { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.school-names .sn-cn { font-size: calc(14 / 15 * 1rem); font-weight: 700; color: var(--brand); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.school-names .sn-en { font-size: calc(10.5 / 15 * 1rem); font-weight: 500; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Grade choices: equal square tiles, aligned to the grid */
.qfield .grade-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(56px, 1fr)); gap: 6px; }
.qfield .grade-opt {
  min-width: 0; min-height: 46px; padding: 4px; border: 2px solid var(--line); border-radius: 0;
  cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 700; background: #fff; transition: .12s;
}
.qfield .grade-opt small { font-size: calc(8.5 / 15 * 1rem); font-weight: 500; color: var(--ink-soft); line-height: 1.1; }
.qfield .grade-opt.sel { border-color: var(--brand-2); background: #eef2ff; }
.qfield .grade-opt.g5.sel { border-color: var(--grade5); background: #e8f6ee; }
.qfield .grade-opt.g4.sel { border-color: var(--grade4); background: #eaf7ea; }
.qfield .grade-opt.g3.sel { border-color: var(--grade3); background: #fdf6e3; }
.qfield .grade-opt.g2.sel { border-color: var(--grade2); background: #fdeee4; }
.qfield .grade-opt.g1.sel { border-color: var(--grade1); background: #fdeef0; }

/* Add button: full-height square tile aligned to the grade row */
.qfield.qf-action { justify-content: flex-end; }
.qfield .qa-add { width: 100%; height: 46px; border-radius: 0; }

@media (max-width: 720px) {
  .qrow-1, .qrow-2 { grid-template-columns: repeat(2, 1fr); }
  .qrow-1 .qf-school, .qrow-2 .qf-name { grid-column: 1 / -1; }
  .qrow-3 { grid-template-columns: 1fr; }
  .qrow-3 .qf-grade { grid-column: auto; }
  .qfield .qa-add { width: 100%; }
}

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .row-2 { grid-template-columns: 1fr; } }

/* School logos (emblem + monogram fallback) */
.school-logo-wrap { position: relative; width: 36px; height: 36px; flex: 0 0 36px; border-radius: 0; overflow: hidden; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.school-logo-wrap .monogram { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: calc(13 / 15 * 1rem); letter-spacing: .3px; }
.school-logo-wrap img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.school-logo-wrap .monogram { font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }

/* Custom school picker */
.school-picker { position: relative; }
.school-picker-btn {
  display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.12); color: #fff;
  border: 1px solid rgba(255,255,255,.3); border-radius: 0; padding: 5px 10px 5px 8px; cursor: pointer;
  max-width: 300px; min-width: 170px; height: 36px;
}
.school-picker-btn:hover { background: rgba(255,255,255,.2); }
.school-picker-btn .school-logo-wrap { width: 26px; height: 26px; flex: 0 0 26px; border-radius: 0; box-shadow: none; border: 1px solid rgba(255,255,255,.35); }
.school-picker-btn .school-logo-wrap .monogram { font-size: calc(10 / 15 * 1rem); }
.school-picker-name { font-size: calc(13 / 15 * 1rem); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.school-chev { font-size: calc(10 / 15 * 1rem); opacity: .8; margin-left: 2px; }
.school-pop {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 40; width: 330px; max-width: 88vw;
  background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 0;
  box-shadow: 0 16px 50px rgba(20,30,60,.25); padding: 10px; max-height: 62vh; display: flex; flex-direction: column;
}
.school-pop[hidden] { display: none; }
.school-search-wrap { padding: 2px 4px 8px; }
.school-search-wrap input { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 0; font-size: calc(14 / 15 * 1rem); font-family: inherit; color: var(--ink); }
.school-list { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.school-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: none;
  padding: 8px; border-radius: 0; cursor: pointer; color: var(--ink);
}
.school-item:hover { background: #f1f4fb; }
.school-item.sel { background: #e7edff; }
.school-item .si-text { display: flex; flex-direction: column; min-width: 0; }
.school-item .si-name { font-size: calc(13.5 / 15 * 1rem); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.school-item .si-sub { font-size: calc(11 / 15 * 1rem); color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.school-item .si-check { margin-left: auto; color: var(--brand-2); font-weight: 800; }
.school-custom { margin-top: 6px; width: 100%; text-align: center; background: #eef1f8; border: 1px dashed var(--line); border-radius: 0; padding: 9px; cursor: pointer; font-size: calc(13 / 15 * 1rem); font-weight: 600; color: var(--brand); }
.school-custom:hover { background: #e2e7f5; }

/* Hero logo */
.school-hero .school-logo-wrap { width: 48px; height: 48px; flex: 0 0 48px; border-radius: 0; box-shadow: 0 2px 8px rgba(0,0,0,.25); border: none; }
.school-hero .school-logo-wrap .monogram { font-size: calc(17 / 15 * 1rem); }

/* Semester control (select + add button) */
.sem-control { display: flex; gap: 8px; align-items: stretch; }
.sem-control select { flex: 1; min-width: 0; }
.add-sem-btn { flex: 0 0 auto; white-space: nowrap; }

/* Global target-credits editor */
.target-edit { font-size: calc(12 / 15 * 1rem); color: var(--ink-soft); margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.target-edit input { width: 72px; padding: 4px 7px; border: 1px solid var(--line); border-radius: 0; font-size: calc(13 / 15 * 1rem); font-family: inherit; color: var(--ink); }

.opt-tag { font-size: calc(10 / 15 * 1rem); font-weight: 700; color: var(--brand-2); background: #eef2ff; border-radius: 0; padding: 1px 6px; margin-left: 3px; vertical-align: middle; }

@media (max-width: 720px) {
  .school-pop { width: 280px; }
  .school-picker-btn { min-width: 150px; }
}

/* ===== Student-view additions: bilingual labels, stat chips, percent, stats strip, font switch ===== */
.bi { display: inline-flex; flex-direction: column; line-height: 1.12; }
.bi-main { font-weight: 700; }
.bi-sub { font-size: calc(10.5 / 15 * 1rem); font-weight: 500; opacity: .72; margin-top: 1px; }
/* buttons: keep bilingual label on one line */
.btn .bi { flex-direction: row; align-items: baseline; gap: 5px; }
.btn .bi-sub { font-size: calc(10.5 / 15 * 1rem); opacity: .85; font-weight: 600; margin-top: 0; }

/* card labels: allow CN + EN sub without heavy uppercase on the sub */
.card .label .bi-sub { text-transform: none; letter-spacing: 0; }
.card .pct { margin-top: 8px; display: flex; align-items: baseline; gap: 6px; }
.card .pct-val { font-size: calc(18 / 15 * 1rem); font-weight: 800; color: var(--cardc, var(--brand-2)); }
.card .pct-note { font-size: calc(10 / 15 * 1rem); color: var(--ink-soft); }
.card .pct-note .bi { flex-direction: row; gap: 4px; align-items: baseline; }
.card .pct-note .bi-sub { font-size: calc(10 / 15 * 1rem); }

/* inline stat chips in grades tree (year / semester headers) */
.stat { display: flex; flex-direction: column; align-items: center; text-align: center; line-height: 1.12; }
.stat b { font-size: calc(13 / 15 * 1rem); font-weight: 800; color: var(--ink); }
.stat i { font-style: normal; font-size: calc(10 / 15 * 1rem); color: var(--ink-soft); }
.stat i s { text-decoration: none; opacity: .6; margin-left: 3px; }
.failed-note { padding: 5px 34px 7px; font-size: calc(11 / 15 * 1rem); color: var(--hu-red); background: #fdf0f1; font-weight: 600; }
.failed-note s { text-decoration: none; opacity: .7; margin-left: 4px; font-weight: 500; }

/* grades view: explicit school banner */
.grades-hero { margin-bottom: 16px; }
.school-hero .sh-sub { font-size: calc(11 / 15 * 1rem); opacity: .82; margin-top: 2px; font-weight: 500; }

/* stats view: summary strip + chart captions */
.stats-strip { display: flex; flex-direction: column; gap: 16px; margin-bottom: 20px; }
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stats-row.secondary { grid-template-columns: repeat(2, 1fr); }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 0; padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.tile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--cardc, var(--brand-2)); }
.tile .label { font-size: calc(12 / 15 * 1rem); color: var(--ink-soft); text-transform: none; letter-spacing: .3px; font-weight: 700; }
.tile .label .bi-sub { text-transform: none; letter-spacing: 0; }
.tile .value { font-size: calc(28 / 15 * 1rem); font-weight: 800; margin-top: 6px; color: var(--cardc, var(--brand)); }
.tile .pct { font-size: calc(15 / 15 * 1rem); font-weight: 700; color: var(--brand-2); margin-top: 4px; }
.tile .sub { font-size: calc(11 / 15 * 1rem); color: var(--ink-soft); margin-top: 4px; }
.chart-cap { font-size: calc(12 / 15 * 1rem); color: var(--ink-soft); margin: 0 0 10px; }
.chart-cap s { text-decoration: none; opacity: .65; margin-left: 4px; }
.stats-grid .panel.span-2 { grid-column: 1 / -1; }
@media (max-width: 1024px) { .stats-row, .stats-row.secondary { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .stats-row, .stats-row.secondary { grid-template-columns: 1fr; } }

/* font-size switcher (小 / 中 / 大) in the top bar */
.fs-switch { display: inline-flex; border: 1px solid rgba(255,255,255,.3); }
.fs-switch button { background: rgba(255,255,255,.12); color: #fff; border: none; border-right: 1px solid rgba(255,255,255,.3); cursor: pointer; padding: 7px 10px; font-size: calc(12 / 15 * 1rem); font-weight: 700; font-family: inherit; }
.fs-switch button:last-child { border-right: none; }
.fs-switch button:hover { background: rgba(255,255,255,.2); }
.fs-switch button.active { background: #fff; color: var(--brand); }

/* ===== New feature styles: ability radar / exams / admission analysis / performance ===== */

.chart-wrap.radar-wrap { height: 380px; }

/* 学术能力雷达：六维核心素养图例 */
.ability-legend { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
/* 学术能力雷达：图在左、六维标签在右一列（桌面） */
.ability-row { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; align-items: center; }
.ability-legend-side { grid-template-columns: 1fr; margin-top: 0; max-height: 380px; overflow-y: auto; }
.ab-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px solid var(--line); border-left: 3px solid var(--brand-2); padding: 8px 12px; background: #fafbfe; }
.ab-label { display: flex; flex-direction: column; line-height: 1.12; }
.ab-cn { font-weight: 700; color: var(--brand); font-size: calc(13 / 15 * 1rem); }
.ab-en { font-size: calc(9.5 / 15 * 1rem); color: var(--ink-soft); margin-top: 1px; }
.ab-val { font-weight: 800; color: var(--brand-2); font-size: calc(16 / 15 * 1rem); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ab-val span { font-size: calc(10 / 15 * 1rem); font-weight: 600; margin-left: 1px; }
@media (max-width: 760px) { .ability-row { grid-template-columns: 1fr; } .ability-legend-side { max-height: none; } }
@media (max-width: 560px) { .ability-legend { grid-template-columns: repeat(2, 1fr); } }
.ability-status { margin-top: 10px; font-size: calc(11.5 / 15 * 1rem); color: var(--ink-soft); text-align: center; }

/* 学术段位徽章（英雄联盟段位体系）：标注在成绩/分数旁 */
.tier-row { margin-top: 10px; }
.tier-badge { display: inline-flex; align-items: baseline; gap: 6px; padding: 3px 12px; border: 2px solid var(--tier); border-radius: 0; background: color-mix(in srgb, var(--tier) 12%, #fff); }
.tier-badge .tier-cn { font-weight: 600; color: var(--tier); font-size: calc(14 / 15 * 1rem); }
.tier-badge .tier-sub { font-weight: 600; color: var(--tier); font-size: calc(10.5 / 15 * 1rem); opacity: .85; }
.tier-chip { display: inline-block; margin-top: 5px; padding: 1px 7px; border: 1px solid var(--tier); border-radius: 0; background: color-mix(in srgb, var(--tier) 12%, #fff); color: var(--tier); font-size: calc(9.5 / 15 * 1rem); font-weight: 600; }
/* 游戏段位徽章（概览称号标签，字重常规） */
.game-badge { display: inline-flex; align-items: baseline; gap: 6px; padding: 3px 12px; border: 2px solid var(--tier); border-radius: 0; background: color-mix(in srgb, var(--tier) 14%, #fff); }
.game-badge .gt-cn { font-weight: 600; color: var(--tier); font-size: calc(15 / 15 * 1rem); letter-spacing: .5px; }
.game-badge .gt-sub { font-weight: 500; color: var(--tier); font-size: calc(10.5 / 15 * 1rem); opacity: .85; }
.card .game-badge { margin-top: 0; }
/* 概览卡片内的段位徽章略微醒目 */
.card .tier-badge { margin-top: 0; }

.exam-countdown { display: flex; flex-direction: column; gap: 10px; }
.exam-tz { font-size: calc(12.5 / 15 * 1rem); color: var(--ink-soft); }
.exam-tz b { color: var(--ink); }
.exam-row { display: grid; grid-template-columns: auto 1.2fr 0.9fr auto; gap: 12px; align-items: center; padding: 10px 14px; border: 1px solid var(--line); background: #fafbfe; }
.exam-name { font-weight: 700; color: var(--brand); }
.exam-date { color: var(--ink-soft); font-size: calc(12.5 / 15 * 1rem); font-variant-numeric: tabular-nums; }
.exam-days { font-weight: 800; font-size: calc(15 / 15 * 1rem); text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); }
.exam-days.ok { color: var(--hu-green); }
.exam-days.soon { color: var(--warn); }
.exam-days.past { color: var(--ink-soft); font-weight: 600; }
.exam-tag { display: inline-block; flex: none; padding: 2px 8px; border: 1px solid var(--ec, var(--brand-2)); color: var(--ec, var(--brand-2)); background: color-mix(in srgb, var(--ec, var(--brand-2)) 12%, #fff); font-size: calc(10.5 / 15 * 1rem); font-weight: 700; white-space: nowrap; }
@media (max-width: 560px) { .exam-row { grid-template-columns: auto 1fr auto; } .exam-row .exam-date { display: none; } }

/* Exam calendar */
.exam-calendar { margin-top: 16px; border-top: 1px dashed var(--line); padding-top: 14px; }
.cal-head { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 10px; }
.cal-head .cal-title { font-weight: 800; color: var(--brand); min-width: 120px; text-align: center; font-size: calc(14 / 15 * 1rem); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-weekdays { margin-bottom: 5px; }
.cal-wd { text-align: center; font-size: calc(11 / 15 * 1rem); color: var(--ink-soft); font-weight: 700; padding: 2px 0; }
.cal-cell { min-height: 46px; border: 1px solid var(--line); border-radius: 0; padding: 3px 4px; display: flex; flex-direction: column; gap: 2px; background: #fff; font-size: calc(11 / 15 * 1rem); }
.cal-cell.empty { background: transparent; border-color: transparent; }
.cal-cell .cal-num { font-weight: 700; color: var(--ink); line-height: 1.1; }
.cal-cell.today { border-color: var(--brand-2); box-shadow: inset 0 0 0 1px var(--brand-2); }
.cal-cell.today .cal-num { color: var(--brand-2); }
.cal-cell.has-exam { background: color-mix(in srgb, var(--warn) 12%, #fff); cursor: pointer; border-color: color-mix(in srgb, var(--warn) 45%, #fff); }
.cal-cell.has-exam:hover { background: color-mix(in srgb, var(--warn) 20%, #fff); }
.cal-cell.sel { outline: 2px solid var(--brand-2); }
.cal-exam { font-size: calc(9.5 / 15 * 1rem); line-height: 1.15; color: var(--ec, var(--brand)); background: color-mix(in srgb, var(--ec, var(--brand)) 16%, #fff); border-left: 2px solid var(--ec, var(--brand)); border-radius: 0; padding: 0 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-more { font-size: calc(9.5 / 15 * 1rem); color: var(--ink-soft); }
.cal-detail { margin-top: 10px; border: 1px solid var(--line); background: #fafbfe; padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; }
.cal-detail-row { display: flex; gap: 10px; align-items: baseline; font-size: calc(13 / 15 * 1rem); }
.cal-detail-row b { color: var(--brand); }
.cal-detail-row span { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.cal-detail-tag { display: inline-block; padding: 1px 8px; border: 1px solid var(--ec, var(--brand-2)); color: var(--ec, var(--brand-2)); background: color-mix(in srgb, var(--ec, var(--brand-2)) 12%, #fff); font-size: calc(10.5 / 15 * 1rem); font-weight: 700; }

.exam-manager .exam-add { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.exam-manager .exam-add input { height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 0; font-size: calc(14 / 15 * 1rem); font-family: inherit; color: var(--ink); }
.exam-manager .exam-add input[type="text"], .exam-manager .exam-add input:not([type]) { flex: 1; min-width: 120px; }
.exam-manager .exam-add input[type="date"] { flex: 0 0 auto; }
.exam-manager .exam-add select {
  height: 44px; padding: 0 34px 0 12px; border: 1px solid var(--line); border-radius: 0;
  background: #fff; color: var(--ink); font-family: inherit; font-size: calc(14 / 15 * 1rem);
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%23334155' stroke-width='1.6'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center;
  flex: 0 0 auto; min-width: 130px;
}
.exam-manager .exam-add select:focus { outline: 2px solid var(--brand-2); border-color: transparent; }
.exam-list { display: flex; flex-direction: column; gap: 8px; }
.exam-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border: 1px solid var(--line); background: #fafbfe; }
.exam-item small { color: var(--ink-soft); margin-left: 6px; font-variant-numeric: tabular-nums; }

.analysis-box { display: flex; flex-direction: column; gap: 14px; }
.ana-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: calc(13.5 / 15 * 1rem); color: var(--ink-soft); }
.ana-head b { color: var(--brand); }
.ana-arrow { color: var(--brand-2); font-weight: 800; }
.ana-based { margin-left: auto; }
.tier { background: #fafbfe; border: 1px solid var(--line); padding: 12px 14px; }
.tier-title { font-weight: 800; color: var(--brand); margin-bottom: 10px; font-size: calc(14 / 15 * 1rem); }
.tier-title small { color: var(--ink-soft); font-weight: 600; margin-left: 4px; }
.tier-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.school-chip { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 0; padding: 7px 12px; cursor: pointer; font-weight: 600; font-size: calc(13 / 15 * 1rem); color: var(--ink); font-family: inherit; transition: .15s; max-width: 100%; text-align: left; }
.school-chip:hover { border-color: var(--brand-2); background: #eef2ff; }
.school-chip .sc-name { color: var(--brand); word-break: break-word; }
.school-chip .sc-prob { font-weight: 800; flex: 0 0 auto; }
.ana-to { font-weight: 700; }
.ana-controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 12px; background: #f3f6fd; border: 1px solid var(--line); }
.ana-controls label { font-size: calc(12.5 / 15 * 1rem); color: var(--ink-soft); font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.ana-controls select { font-family: inherit; font-size: calc(13 / 15 * 1rem); padding: 5px 8px; border: 1px solid var(--line); border-radius: 0; color: var(--ink); }
.ana-ai { margin-left: auto; font-size: calc(11.5 / 15 * 1rem); color: var(--brand-2); font-weight: 700; display: inline-flex; align-items: center; gap: 5px; }
.ana-ai::before { content: "✦"; }
.ana-tip { font-size: calc(11.5 / 15 * 1rem); color: var(--ink-soft); line-height: 1.5; margin: 2px 0 0; }

/* 院校详情弹窗 */
.sd-head { margin-bottom: 10px; }
.sd-name { font-size: calc(18 / 15 * 1rem); font-weight: 800; color: var(--brand); }
.sd-en { font-size: calc(12 / 15 * 1rem); color: var(--ink-soft); }
.sd-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.sd-tag { font-size: calc(12 / 15 * 1rem); font-weight: 700; color: var(--ink); background: #eef2ff; border: 1px solid var(--brand-2); padding: 3px 9px; }
.sd-card { border: 1px solid var(--line); background: #fafbfe; padding: 14px 16px; margin-bottom: 14px; }
.sd-card .sd-h { font-size: calc(14 / 15 * 1rem); font-weight: 800; color: var(--brand); margin-bottom: 10px; display: flex; align-items: center; gap: 7px; }
.sd-card .sd-icon { color: var(--brand-2); }
.sd-card .sd-body { font-size: calc(13.5 / 15 * 1rem); line-height: 1.7; color: var(--ink); }
.sd-card .sd-body p { margin: 0 0 8px; }
.sd-card .sd-body p:last-child { margin-bottom: 0; }
.sd-req-list { margin: 0; padding-left: 18px; font-size: calc(13.5 / 15 * 1rem); line-height: 1.8; color: var(--ink); }
.sd-req-list li { margin-bottom: 6px; white-space: normal; word-break: break-word; }
.sd-req-list li:last-child { margin-bottom: 0; }
.sd-sec { margin-bottom: 12px; }
.sd-h { font-size: calc(13 / 15 * 1rem); font-weight: 800; color: var(--brand-2); margin-bottom: 4px; }
.sd-p { font-size: calc(13.5 / 15 * 1rem); line-height: 1.6; color: var(--ink); }

/* 成绩表现：通过率 / 挂科率 等（按分值自动变色） */
.perf-box { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.perf-tile { position: relative; border: 1px solid var(--line); border-radius: 0; background: #fff; padding: 14px 16px 14px 20px; overflow: hidden; }
.perf-tile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--cardc, var(--brand-2)); }
.perf-tile .pt-label { font-size: calc(11.5 / 15 * 1rem); font-weight: 700; color: var(--ink-soft); letter-spacing: .2px; }
.perf-tile .pt-value { font-size: calc(26 / 15 * 1rem); font-weight: 800; color: var(--cardc, var(--brand)); margin-top: 6px; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .perf-box { grid-template-columns: repeat(2, 1fr); } }

/* ===== Calendar view ===== */
.view-calendar .live-countdown {
  font-size: calc(34 / 15 * 1rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: center;
  padding: 18px;
  background: #fafbfe;
  border: 1px solid var(--line);
  color: var(--brand);
  letter-spacing: 1px;
}
.view-calendar .live-countdown .lc-unit {
  font-size: calc(14 / 15 * 1rem);
  font-weight: 600;
  color: var(--ink-soft);
  margin: 0 4px 0 1px;
}
.view-calendar .live-countdown .lc-event {
  display: block;
  font-size: calc(13 / 15 * 1rem);
  font-weight: 600;
  color: var(--ink-soft);
  margin-top: 8px;
  letter-spacing: 0;
}
.view-calendar .live-countdown.past { color: var(--ink-soft); }
.view-calendar .live-countdown.soon { color: var(--warn); }
.view-calendar .live-countdown.ok { color: var(--good); }

/* ===== Tier list in settings ===== */
.tier-list { display: flex; flex-direction: column; gap: 10px; }
.tier-rows { display: flex; flex-direction: row; flex-wrap: nowrap; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.tier-row-item {
  flex: 0 0 auto; min-width: 104px; max-width: 132px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 12px 14px; border: 1px solid var(--line); background: #fafbfe;
}
.tier-row-item .tier-dot { width: 16px; height: 16px; border-radius: 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.tier-row-item .tier-name { font-weight: 800; font-size: calc(15 / 15 * 1rem); line-height: 1.1; }
.tier-row-item .tier-en { font-size: calc(10.5 / 15 * 1rem); color: var(--ink-soft); font-weight: 600; }
.tier-row-item .tier-range {
  margin-left: 0; margin-top: 2px; font-size: calc(11.5 / 15 * 1rem); color: var(--ink-soft);
  font-variant-numeric: tabular-nums; background: #eef2ff; padding: 1px 7px; border-radius: 0;
}
.tier-row-item .tier-gpa {
  display: flex; flex-direction: column; gap: 1px;
  margin-top: 2px; font-size: calc(10.5 / 15 * 1rem); color: var(--ink-soft); font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.tier-row-item .tier-gpa-label { font-size: calc(10 / 15 * 1rem); opacity: .85; }
.tier-row-item .tier-gpa-range { font-weight: 700; }
.tier-note { margin: 10px 0 0; font-size: calc(12 / 15 * 1rem); color: var(--ink-soft); line-height: 1.5; width: 100%; }

/* ===== Percentage suffix on grades-module stat chips ===== */
.stat-pct { font-size: calc(10 / 15 * 1rem); font-weight: 700; color: var(--brand-2); opacity: .92; margin-left: 2px; }

/* ===== Event manager: “no specific time” checkbox ===== */
.exam-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.exam-notime { display: inline-flex; align-items: center; gap: 6px; font-size: calc(12.5 / 15 * 1rem); color: var(--ink-soft); font-weight: 600; cursor: pointer; }
.exam-notime input { width: 16px; height: 16px; }

/* ===== Live countdown: 时区在左、天时分秒在右并突出 ===== */
.view-calendar .live-countdown .lc-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.view-calendar .live-countdown .lc-tz-left { text-align: left; font-size: calc(12.5 / 15 * 1rem); font-weight: 600; color: var(--ink-soft); letter-spacing: 0; }
.view-calendar .live-countdown .lc-tz-left b { color: var(--ink); font-weight: 700; }
.view-calendar .live-countdown .lc-tz-label { display: block; font-size: calc(10.5 / 15 * 1rem); opacity: .8; margin-bottom: 2px; }
.view-calendar .live-countdown .lc-count {
  margin-left: auto; text-align: right;
  font-size: calc(52 / 15 * 1rem); font-weight: 900;
  font-variant-numeric: tabular-nums; letter-spacing: 1px; line-height: 1;
  background: var(--brand); color: #fff;
  padding: 10px 18px; border-radius: 0;
  box-shadow: 0 6px 18px rgba(27, 42, 91, .22);
}
.view-calendar .live-countdown .lc-unit { font-size: calc(15 / 15 * 1rem); font-weight: 700; opacity: .9; margin: 0 5px 0 2px; }
.view-calendar .live-countdown .lc-time { font-variant-numeric: tabular-nums; }
.view-calendar .live-countdown .lc-event { display: block; font-size: calc(14 / 15 * 1rem); font-weight: 700; color: var(--ink); margin-top: 14px; letter-spacing: 0; text-align: left; }
.view-calendar .live-countdown .lc-none { font-size: calc(14 / 15 * 1rem); font-weight: 600; color: var(--ink-soft); letter-spacing: 0; }
.view-calendar .live-countdown.past .lc-count { background: var(--ink-soft); }
.view-calendar .live-countdown.soon .lc-count { background: var(--warn); }
.view-calendar .live-countdown.ok .lc-count { background: var(--good); }

/* ===== Language settings (panel, expandable) ===== */
.lang-settings { display: flex; flex-direction: column; gap: 12px; }
.setting-current { font-size: calc(14 / 15 * 1rem); color: var(--ink-soft); }
.setting-current b { color: var(--brand); font-size: calc(16 / 15 * 1rem); }
.lang-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.lang-opt { padding: 8px 14px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-family: inherit; font-size: calc(13.5 / 15 * 1rem); font-weight: 600; color: var(--ink); border-radius: 0; transition: .12s; }
.lang-opt:hover { border-color: var(--brand-2); }
.lang-opt.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ===== Font settings (panel, expandable) ===== */
.font-settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 22px; }
.font-group { display: flex; flex-direction: column; gap: 7px; }
.font-group > label { font-size: calc(13 / 15 * 1rem); font-weight: 700; color: var(--brand); }
.font-group select { font-family: inherit; font-size: calc(13.5 / 15 * 1rem); padding: 7px 10px; border: 1px solid var(--line); border-radius: 0; color: var(--ink); background: #fff; }
.font-group input[type="range"] { width: 100%; accent-color: var(--brand-2); }
.seg { display: inline-flex; border: 1px solid var(--line); width: fit-content; }
.seg button { background: #fff; color: var(--ink); border: none; border-right: 1px solid var(--line); cursor: pointer; padding: 7px 13px; font-size: calc(13 / 15 * 1rem); font-weight: 700; font-family: inherit; }
.seg button:last-child { border-right: none; }
.seg button:hover { background: #eef2ff; }
.seg button.active { background: var(--brand); color: #fff; }
@media (max-width: 620px) { .font-settings { grid-template-columns: 1fr; } }

/* ===== Bilingual stacked year/semester labels in grades tree ===== */
.year-sem-bi { display: flex; flex-direction: column; line-height: 1.15; }
.year-sem-bi .ys-main { font-weight: 700; color: var(--brand); font-size: calc(13 / 15 * 1rem); }
.year-sem-bi .ys-sub { font-size: calc(10 / 15 * 1rem); color: var(--ink-soft); }
.year-head .btn .bi, .sem-head .btn .bi { flex-direction: column; align-items: flex-start; gap: 0; line-height: 1.15; }
.year-head .btn .bi-sub, .sem-head .btn .bi-sub { margin-top: 1px; }

/* ===== Dynamic grade chip overrides fixed blue ===== */
.tier-chip.dyn { border-color: currentColor; background: color-mix(in srgb, currentColor 12%, #fff); }
.grade-pill.dyn { background: var(--gpbg, #b9c0d0); }

/* ===== Exam add form datetime-local ===== */
.exam-manager .exam-add input[type="datetime-local"] { flex: 0 0 auto; min-width: 220px; }
