:root {
  --ink: #e7f2ff;
  --muted: #8eb4d6;
  --cyan: #3ec6ff;
  --gold: #ffd15c;
  --line: rgba(90, 176, 240, 0.35);
  --panel: rgba(8, 28, 62, 0.88);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  height: 100vh;
  padding: 12px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--ink);
  font-family: "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(800px 240px at 50% 0%, rgba(36, 120, 230, 0.28), transparent 70%),
    linear-gradient(180deg, #071833, #04101f 55%, #020812);
  overflow: hidden;
}
.top {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
  grid-template-areas: "brand title clock" "filters filters filters";
  align-items: center;
  gap: 6px 16px;
}
.side-brand { grid-area: brand; }
.side-clock { grid-area: clock; }
.title-block { grid-area: title; position: static; transform: none; }
.filters { grid-area: filters; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
.side-brand { padding-right: 0; }
.side-clock { padding-left: 0; }
.illus { width: 52px; height: 46px; }
.title-block h1 { font-size: clamp(26px, 2.2vw, 36px); }
.side-brand, .side-clock { display: flex; align-items: center; gap: 10px; min-width: 0; }
.side-clock { justify-content: flex-end; }
.illus { flex: none; filter: drop-shadow(0 0 8px rgba(62, 198, 255, 0.35)); }
.side-brand p { margin: 0; color: var(--cyan); letter-spacing: 0.12em; font-size: 14px; }
.title-block {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: center;
}
.title-block h1 {
  margin: 0;
  font-size: clamp(26px, 2.2vw, 36px);
  letter-spacing: 0.16em;
  font-weight: 700;
  text-shadow: 0 0 18px rgba(62, 198, 255, 0.55);
}
.title-mark { display: block; width: 220px; height: 16px; margin: 2px auto 0; }
.wing { width: 72px; height: 1px; background: linear-gradient(90deg, transparent, #3ec6ff); position: relative; }
.wing::after { content: ""; position: absolute; top: -3px; width: 7px; height: 7px; border: 1px solid #ffd15c; transform: rotate(45deg); }
.wing-left::after { right: -2px; }
.wing-right { transform: scaleX(-1); }
.filters { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-row button, #clearExam {
  min-height: 28px;
  padding: 2px 10px;
  color: var(--ink);
  background: rgba(8, 36, 78, 0.75);
  border: 1px solid var(--line);
  cursor: pointer;
  font-family: inherit;
}
.chip-row button[aria-pressed="true"] { background: #1458c8; border-color: #8fd4ff; }
#clock { text-align: right; font-size: 28px; letter-spacing: 0.04em; }
.banner { margin: 0; padding: 6px 12px; color: var(--gold); background: rgba(255, 209, 92, 0.08); border: 1px solid rgba(255, 209, 92, 0.35); }
.board {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(200px, 16vw) minmax(0, 1.15fr) minmax(0, 0.95fr) minmax(320px, 24vw);
  grid-template-rows: auto minmax(0, 1.15fr) minmax(0, 1fr);
  grid-template-areas:
    "subjects stats stats side"
    "subjects trend trend side"
    "subjects grade dist exams";
  gap: 8px;
}
.subjects-panel { grid-area: subjects; }
.stats { grid-area: stats; }
.trend-panel { grid-area: trend; }
.side-top { grid-area: side; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.side-top .type-panel { flex: 1; min-height: 0; }
.side-top .sex-panel { flex: none; }
.grade-panel { grid-area: grade; }
.dist-panel { grid-area: dist; }
.exam-panel { grid-area: exams; }
.rank-board { grid-area: rank; }
body.mode-exam .board {
  grid-template-columns: minmax(200px, 16vw) minmax(0, 1.35fr) minmax(320px, 24vw);
  grid-template-rows: minmax(200px, 0.72fr) minmax(0, 1fr) minmax(220px, 0.95fr);
  grid-template-areas:
    "subjects class side"
    "subjects rank dist"
    "subjects rank exams";
}
body.mode-exam .stats,
body.mode-exam .trend-panel,
body.mode-exam .grade-panel,
body.mode-exam .type-panel { display: none; }
body.mode-exam .side-top { display: flex; }
body.mode-exam .sex-panel { flex: 1; }
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 8px; align-items: end; margin-bottom: 8px; }
.podium article { text-align: center; padding: 8px; background: rgba(6, 28, 60, 0.55); border: 1px solid var(--line); }
.podium .p1 { order: 2; padding-top: 14px; border-color: #ffd15c; }
.podium .p2 { order: 1; }
.podium .p3 { order: 3; }
.podium strong { display: block; font-size: 28px; color: var(--gold); }
.podium b { display: block; margin-top: 4px; }
.rank-scroll { flex: 1; min-height: 0; overflow: hidden; }
.class-row { margin-bottom: 8px; }
.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-list li { display: grid; grid-template-columns: 42px 1fr auto; gap: 8px; align-items: center; min-height: 36px; border-bottom: 1px solid rgba(90, 170, 230, 0.18); }
.rank-list li.split { grid-template-columns: 42px 52px 1fr auto; }
.rank-list .room { color: var(--cyan); font-size: 13px; }
.rank-list .pos { font-size: 18px; color: var(--cyan); }
.rank-list .mark { color: var(--gold); font-size: 18px; }
.rank-scroll:hover .rank-list { animation-play-state: paused; }
@media (prefers-reduced-motion: no-preference) {
  .rank-list.slide { animation: exam-marquee 36s linear infinite; }
}
.panel {
  min-height: 0;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.rank-board[hidden] { display: none; }
body.mode-exam .rank-board { display: flex; }
.class-panel { grid-area: class; }
.class-panel[hidden] { display: none; }
body.mode-exam .class-panel { display: flex; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; }
h2 { margin: 0; font-size: 15px; letter-spacing: 0.08em; }
.panel-head span, .subject-list small, .exam-list small { color: var(--muted); font-size: 12px; }
.chart { flex: 1; min-height: 0; width: 100%; }
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.stats article { padding: 8px 10px; background: rgba(10, 40, 86, 0.72); border: 1px solid var(--line); }
.stats span { display: block; color: var(--muted); font-size: 12px; }
.stats strong { font-size: 26px; color: var(--gold); line-height: 1.1; }
.subject-list { overflow: auto; min-height: 0; flex: 1; }
.subject-list .meta, .exam-list .meta { display: flex; justify-content: space-between; gap: 8px; }
.subject-list button, .exam-list button {
  width: 100%;
  margin: 0 0 6px;
  padding: 7px 8px;
  text-align: left;
  color: var(--ink);
  background: rgba(6, 28, 60, 0.55);
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
}
.subject-list button[aria-pressed="true"], .exam-list button[aria-pressed="true"] { border-color: var(--cyan); background: rgba(30, 110, 200, 0.28); }
.bar { height: 6px; margin-top: 5px; background: rgba(142, 180, 214, 0.15); }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #1d6dff, #3ec6ff); }
.exam-scroll { flex: 1; min-height: 0; overflow: auto; }
.exam-list { list-style: none; margin: 0; padding: 0; }
.exam-list button small { display: block; line-height: 1.35; white-space: normal; word-break: break-word; }
.exam-list.slide { animation: none; }
.exam-scroll:hover .exam-list { animation-play-state: paused; }
@media (prefers-reduced-motion: no-preference) {
  .title-block h1 { animation: title-glow 3.2s ease-in-out infinite; }
  .illus { animation: floaty 4.6s ease-in-out infinite; }
  .side-clock .illus { animation-delay: -1.4s; }
  .bar i { transition: width 0.8s ease; }
  .exam-list.slide { animation: exam-marquee 26s linear infinite; }
}
@keyframes title-glow {
  50% { text-shadow: 0 0 16px rgba(62, 198, 255, 0.35), 0 0 28px rgba(62, 198, 255, 0.85); }
}
@keyframes floaty {
  50% { transform: translateY(-5px); }
}
@keyframes exam-marquee {
  from { transform: translateY(0); }
  to { transform: translateY(-50%); }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.sex-box { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; flex: 1; }
.sex-box article { padding: 8px; background: rgba(6, 28, 60, 0.55); border: 1px solid var(--line); }
.sex-box strong { display: block; font-size: 28px; color: var(--gold); }
.sex-box em, .sex-box small { display: block; }
.sex-box em { font-style: normal; color: var(--cyan); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }
