/* 武成小学 · 打字练习排行榜 —— 全站样式 */

:root {
  --bg: #f2f6fc;
  --bg-deep: #e8eefb;
  --card: #ffffff;
  --ink: #17233d;
  --ink-2: #34415f;
  --muted: #66738f;
  --line: #e2e8f4;
  --brand: #2f6fed;
  --brand-dark: #1c50b8;
  --brand-soft: #e8f0ff;
  --accent: #ff8a3d;
  --accent-soft: #fff1e6;
  --ok: #149a66;
  --ok-soft: #e3f7ee;
  --err: #d93a3f;
  --err-soft: #fdecec;
  --gold: #f5a524;
  --silver: #8fa3ba;
  --bronze: #c97b46;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 12px 32px rgba(26, 51, 110, 0.09);
  --shadow-sm: 0 4px 14px rgba(26, 51, 110, 0.07);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 8% -10%, #dbe8ff 0%, rgba(219, 232, 255, 0) 60%),
    radial-gradient(800px 500px at 100% 0%, #ffe9d8 0%, rgba(255, 233, 216, 0) 55%),
    linear-gradient(180deg, #f7f9fd 0%, var(--bg) 100%);
  background-attachment: fixed;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; }
p { margin: 0; }

.container { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.container-narrow { width: min(880px, calc(100% - 40px)); margin: 0 auto; }
.stack-8 > * + * { margin-top: 8px; }
.stack-12 > * + * { margin-top: 12px; }
.stack-16 > * + * { margin-top: 16px; }
.stack-24 > * + * { margin-top: 24px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }

/* ---------------------------------------------------------------- 顶部栏 */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  background: rgba(250, 252, 255, 0.82);
  border-bottom: 1px solid rgba(226, 232, 244, 0.9);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0.2px;
  text-decoration: none;
}
.brand:hover { text-decoration: none; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: linear-gradient(145deg, #4c86ff, #2456c9);
  color: #fff;
  box-shadow: 0 6px 16px rgba(47, 111, 237, 0.35);
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 16px; }
.brand-text span { font-size: 11px; color: var(--muted); font-weight: 500; letter-spacing: 1.4px; }

.topbar-links {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.topbar-links a {
  padding: 7px 14px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}
.topbar-links a:hover { background: var(--brand-soft); color: var(--brand-dark); text-decoration: none; }
.topbar-links a.active { background: var(--brand); color: #fff; }

.who {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 6px 14px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 14px;
  font-weight: 600;
}
.who button {
  border: 0;
  background: rgba(255, 255, 255, 0.75);
  color: var(--brand-dark);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
.who button:hover { background: #fff; }

/* ---------------------------------------------------------------- 通用组件 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: #eef2fa;
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}
.btn:hover { background: #e5ebf7; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(145deg, #4a86ff, #2563e6);
  color: #fff;
  box-shadow: 0 8px 20px rgba(47, 111, 237, 0.3);
}
.btn-primary:hover { background: linear-gradient(145deg, #3d7bfa, #1e56d2); }
.btn-accent { background: linear-gradient(145deg, #ffa15c, #f9791f); color: #fff; box-shadow: 0 8px 20px rgba(249, 121, 31, 0.28); }
.btn-accent:hover { background: linear-gradient(145deg, #ff9446, #ec6c12); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-ghost:hover { background: var(--brand-soft); border-color: #cfdcf8; }
.btn-danger { background: var(--err-soft); color: var(--err); }
.btn-danger:hover { background: #fbdcdc; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn-lg { padding: 14px 28px; font-size: 17px; border-radius: 14px; }
.btn-block { width: 100%; }

.card {
  background: var(--card);
  border: 1px solid rgba(226, 232, 244, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
}
.card-tight { padding: 18px; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--ink-2); letter-spacing: 0.3px; }

.input, .select, .textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fbfcff;
  color: var(--ink);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: #8fb0f5;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(47, 111, 237, 0.12);
}
.textarea { resize: vertical; min-height: 110px; line-height: 1.8; }
.select { cursor: pointer; appearance: none; background-image: linear-gradient(45deg, transparent 50%, #7a86a2 50%), linear-gradient(135deg, #7a86a2 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 34px; }

.tabs { display: flex; gap: 6px; padding: 5px; background: #eef2fa; border-radius: 999px; width: fit-content; }
.tab {
  border: 0;
  background: transparent;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.tab:hover { color: var(--ink-2); }
.tab.active { background: #fff; color: var(--brand-dark); box-shadow: var(--shadow-sm); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--brand-soft);
  color: var(--brand-dark);
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.warn { background: var(--accent-soft); color: #c2611a; }
.badge.mode-en { background: #eef7ff; color: #1e6ea8; }

.stat-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
#overviewStats { grid-template-columns: repeat(3, 1fr); }
.stat {
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  background: #f7f9fe;
  border: 1px solid var(--line);
}
.stat .label { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: 0.4px; }
.stat .value { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; color: var(--ink); margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 3px; }

.empty {
  padding: 42px 20px;
  text-align: center;
  color: var(--muted);
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-sm);
  background: #fbfcff;
}

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table td .badge, .table td.student, .table td.nowrap { white-space: nowrap; }
.table th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  padding: 11px 14px;
  background: #f5f8fe;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.table td { padding: 11px 14px; border-bottom: 1px solid #eef2f9; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafcff; }
.table .num { font-variant-numeric: tabular-nums; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translate(-50%, 20px);
  z-index: 90;
  padding: 12px 22px;
  border-radius: 999px;
  background: rgba(23, 35, 61, 0.92);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 12px 30px rgba(23, 35, 61, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: rgba(196, 38, 43, 0.95); }
.toast.ok { background: rgba(15, 128, 84, 0.95); }

.footer { padding: 34px 0 44px; text-align: center; color: #8b97b1; font-size: 12.5px; }

/* ---------------------------------------------------------------- 学生入口 */

.hero { padding: 48px 0 26px; }
.hero-grid { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 34px; align-items: center; }
.hero h1 { font-size: clamp(30px, 4vw, 46px); letter-spacing: -1px; line-height: 1.15; }
.hero h1 em { font-style: normal; color: var(--brand); }
.hero p.lead { margin-top: 14px; color: var(--muted); font-size: 16px; max-width: 460px; }
.hero-points { margin-top: 24px; display: grid; gap: 12px; }
.hero-point { display: flex; gap: 12px; align-items: flex-start; }
.hero-point .dot {
  flex: none;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 16px;
}
.hero-point b { display: block; font-size: 14.5px; }
.hero-point span { font-size: 13px; color: var(--muted); }

.login-card { padding: 30px; }
.login-card h2 { font-size: 21px; }
.login-card .hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.login-actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.login-actions .btn-primary { flex: 1; }

.welcome-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  background: linear-gradient(120deg, #eaf2ff, #f7fbff);
  border: 1px solid #d7e4ff;
}
.welcome-strip .avatar {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  border-radius: 14px;
  background: var(--brand);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
}
.welcome-strip b { font-size: 16px; }

.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 18px; }
.quick-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
  transition: all 0.15s ease;
  color: var(--ink);
}
.quick-card:hover { text-decoration: none; border-color: #c2d6fb; box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.quick-card .ico { font-size: 24px; }
.quick-card b { font-size: 15.5px; }
.quick-card span { font-size: 13px; color: var(--muted); }

/* ---------------------------------------------------------------- 练习页 */

.practice-page { padding: 26px 0 40px; }
.practice-shell { display: grid; grid-template-columns: minmax(0, 1fr) 318px; gap: 20px; align-items: start; }

.practice-main { padding: 0; overflow: hidden; }
.practice-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  background: #fbfcff;
}
.practice-toolbar .spacer { flex: 1; }
.practice-toolbar .meta { font-size: 13px; color: var(--muted); }

.mode-switch { display: flex; gap: 6px; padding: 4px; background: #eef2fa; border-radius: 999px; }
.mode-switch button {
  border: 0; background: transparent; padding: 7px 16px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.mode-switch button.active { background: #fff; color: var(--brand-dark); box-shadow: var(--shadow-sm); }

.practice-body { padding: 26px 28px 28px; }

.text-meta { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.text-meta h2 { font-size: 19px; }
.text-meta .progress-text { margin-left: auto; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

.target-text {
  font-size: 23px;
  line-height: 2;
  letter-spacing: 0.5px;
  word-break: break-word;
  white-space: pre-wrap;
  padding: 22px 24px;
  border-radius: var(--radius-sm);
  background: #f8faff;
  border: 1px solid #e6ecf9;
  min-height: 150px;
  user-select: none;
}
.target-text.en { font-size: 21px; letter-spacing: 0.2px; font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif; }

.char { color: #97a2b8; border-radius: 4px; transition: color 0.08s linear, background 0.08s linear; }
.char.done { color: #0c7d55; background: #e3f7ee; }
.char.wrong { color: #c62c31; background: #fdeaea; text-decoration: underline wavy rgba(198, 44, 49, 0.55); text-underline-offset: 4px; }
.char.cur { color: var(--ink); background: #dbe7ff; box-shadow: inset 0 -3px 0 var(--brand); }
.char.space.done { background: #d8f3e6; }
.char.space.wrong { background: #f9d7d7; }
.char.newline { display: inline; }
.char.newline::after { content: "↵"; font-size: 13px; color: #c3ccdd; }

.typing-label { display: flex; align-items: center; justify-content: space-between; margin: 20px 0 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.typing-label .hint { font-weight: 500; color: var(--muted); font-size: 12.5px; }

.typing-area {
  width: 100%;
  min-height: 118px;
  padding: 16px 18px;
  border: 2px solid #d7e2f6;
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 21px;
  line-height: 1.8;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  caret-color: var(--brand);
}
.typing-area:focus { border-color: #7fa6f7; box-shadow: 0 0 0 5px rgba(47, 111, 237, 0.1); }
.typing-area::placeholder { color: #b3bdd0; }

.practice-actions { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.practice-actions .hint { font-size: 13px; color: var(--muted); }

.side-card { padding: 20px; }
.side-card + .side-card { margin-top: 16px; }
.side-title { font-size: 13px; font-weight: 700; letter-spacing: 0.5px; color: var(--muted); margin-bottom: 12px; }

.live-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.live-stat { padding: 12px 14px; border-radius: 12px; background: #f7f9fe; border: 1px solid var(--line); }
.live-stat .k { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.live-stat .v { font-size: 25px; font-weight: 800; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.live-stat .v small { font-size: 12px; font-weight: 600; color: var(--muted); }
.live-stat.wide { grid-column: span 2; }

.progress-bar { height: 10px; border-radius: 999px; background: #e9eef9; overflow: hidden; margin-top: 12px; }
.progress-bar > i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #63a0ff, #2f6fed); transition: width 0.12s linear; }

.tips { font-size: 13px; color: var(--muted); line-height: 1.8; }
.tips li { margin-left: -8px; }

.result-panel {
  margin-top: 22px;
  padding: 26px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #f4f9ff, #eef5ff);
  border: 1px solid #d9e6ff;
}
.result-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.result-score { display: flex; flex-direction: column; }
.result-score .big { font-size: 46px; font-weight: 800; letter-spacing: -1.5px; color: var(--brand-dark); line-height: 1; font-variant-numeric: tabular-nums; }
.result-score .cap { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: 1px; }
.result-rank { padding: 10px 18px; border-radius: 12px; background: #fff; border: 1px solid var(--line); }
.result-rank b { font-size: 22px; color: var(--accent); }
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 10px; margin-top: 18px; }
.result-grid .item { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.result-grid .item .k { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.result-grid .item .v { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.result-note { margin-top: 14px; font-size: 13px; color: var(--muted); }

/* ---------------------------------------------------------------- 排行榜 */

.rank-page { padding: 28px 0 44px; }
.rank-head { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; margin-bottom: 20px; }
.rank-head h1 { font-size: 30px; letter-spacing: -0.6px; }
.rank-head .live-dot {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px; border-radius: 999px; background: var(--ok-soft); color: var(--ok);
  font-size: 12px; font-weight: 600;
}
.rank-head .live-dot i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: pulse 1.8s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.8); } }

.filters {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 14px 16px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); margin-bottom: 18px;
}
.filters .select { width: auto; min-width: 104px; padding: 8px 32px 8px 12px; font-size: 13.5px; border-radius: 9px; }
.filters .spacer { flex: 1; }
.filters .refresh { font-size: 12.5px; color: var(--muted); }

.podium { display: flex; justify-content: center; align-items: flex-end; gap: 14px; margin-bottom: 18px; }
.podium-card {
  flex: 1 1 0;
  max-width: 360px;
  position: relative;
  text-align: center;
  padding: 22px 14px 18px;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.podium-card.first { order: 2; padding-top: 30px; padding-bottom: 26px; border-color: #ffdcae; background: linear-gradient(180deg, #fffaef, #fff); }
.podium-card.second { order: 1; }
.podium-card.third { order: 3; }
.podium-medal { font-size: 30px; line-height: 1; }
.podium-avatar {
  width: 58px; height: 58px; margin: 10px auto 8px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-dark);
  font-size: 22px; font-weight: 800;
}
.podium-card.first .podium-avatar { width: 68px; height: 68px; font-size: 25px; background: #ffefd6; color: #b9740a; }
.podium-name { font-size: 17px; font-weight: 700; }
.podium-class { font-size: 12.5px; color: var(--muted); }
.podium-score { margin-top: 8px; font-size: 22px; font-weight: 800; color: var(--brand-dark); font-variant-numeric: tabular-nums; }
.podium-score small { font-size: 12px; color: var(--muted); font-weight: 600; }
.podium-sub { margin-top: 4px; font-size: 12px; color: var(--muted); }

.rank-table .rank-no { font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.rank-table .rank-no.top { color: var(--brand); }
.rank-table .student { font-weight: 600; }
.rank-table .big-num { font-weight: 800; font-size: 15.5px; font-variant-numeric: tabular-nums; }
.rank-table tr.me td { background: #f0f6ff; }

/* ---------------------------------------------------------------- 教师后台 */

.admin-page { padding: 24px 0 44px; }
.admin-shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); gap: 20px; align-items: start; }
.admin-nav { position: sticky; top: 84px; padding: 14px; }
.admin-nav button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 14px; margin-bottom: 4px;
  border: 0; border-radius: 10px; background: transparent;
  font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; text-align: left;
}
.admin-nav button:hover { background: #f3f7ff; }
.admin-nav button.active { background: var(--brand-soft); color: var(--brand-dark); }
.admin-nav .sep { height: 1px; background: var(--line); margin: 10px 6px; }

.panel-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.panel-head h2 { font-size: 20px; }
.panel-head .spacer { flex: 1; }

.chart-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; align-items: end; height: 150px; padding-top: 10px; }
.chart-day { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart-day .bar { width: 100%; max-width: 46px; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, #79a7ff, #2f6fed); min-height: 4px; transition: height 0.3s ease; }
.chart-day .cap { font-size: 11px; color: var(--muted); white-space: nowrap; }
.chart-day .val { font-size: 12px; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.admin-login { width: min(420px, calc(100% - 40px)); margin: 9vh auto 0; }

.modal-mask {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center;
  background: rgba(20, 32, 58, 0.42);
  backdrop-filter: blur(3px);
  padding: 20px;
}
.modal {
  width: min(560px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(20, 32, 58, 0.28);
  padding: 24px;
}
.modal h3 { font-size: 18px; margin-bottom: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

.pagination { display: flex; align-items: center; gap: 10px; justify-content: flex-end; padding: 12px 2px 0; font-size: 13px; color: var(--muted); }

/* ---------------------------------------------------------------- 响应式 */

@media (max-width: 980px) {
  .hero-grid, .practice-shell, .admin-shell { grid-template-columns: 1fr; }
  .admin-nav { position: static; display: flex; flex-wrap: wrap; }
  .admin-nav button { width: auto; }
  .admin-nav .sep { display: none; }
  .podium { flex-direction: column; align-items: stretch; }
  .podium-card { max-width: none; }
  .podium-card.first, .podium-card.second, .podium-card.third { order: 0; }
}

@media (max-width: 640px) {
  .container, .container-narrow { width: calc(100% - 24px); }
  .brand-text { display: none; }
  .brand-mark { width: 36px; height: 36px; border-radius: 11px; }
  .topbar-links { gap: 2px; }
  .topbar-links a { padding: 6px 9px; font-size: 13px; }
  .topbar-links a:nth-child(4) { display: none; }
  .who { padding: 0; background: transparent; }
  .who span { display: none; }
  .who button { background: var(--brand-soft); padding: 6px 10px; }
  .brand-sub { display: none; }
  .brand-text b { font-size: 15px; }
  .card { padding: 18px; }
  .practice-body { padding: 18px; }
  .target-text { font-size: 19px; padding: 16px; }
  .typing-area { font-size: 18px; }
  .live-stats { grid-template-columns: 1fr 1fr; }
  .form-row, .form-grid { grid-template-columns: 1fr; }
  .hero { padding: 28px 0 16px; }
  .rank-head h1 { font-size: 24px; }
  .topbar-inner { height: 58px; gap: 10px; }
  .who span { max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .table-wrap table.table { min-width: 620px; }
  .filters .select { min-width: 0; flex: 1 1 120px; }
  #overviewStats { grid-template-columns: repeat(2, 1fr); }
}

/* ---------------------------------------------------------------- 12 分钟课堂练习 */

.run-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 13.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.run-chip b { font-size: 15px; letter-spacing: 0.3px; }
.run-chip .run-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand);
  animation: pulse 1.8s infinite;
}
.run-chip .run-rounds { font-size: 12px; font-weight: 600; color: var(--muted); }
.run-chip.urgent { background: var(--err-soft); color: var(--err); }
.run-chip.urgent .run-dot { background: var(--err); }

.start-options { display: grid; gap: 12px; margin-top: 20px; }
.start-option {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 18px 20px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fbfcff;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--ink);
}
.start-option:hover { border-color: #b9cffa; background: #fff; box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.start-option.run {
  border-color: #b9cffa;
  background: linear-gradient(120deg, #eef5ff, #f9fcff);
}
.start-option.run:hover { border-color: var(--brand); }
.start-ico {
  flex: none;
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: var(--brand-soft);
  font-size: 23px;
}
.start-option.run .start-ico { background: linear-gradient(145deg, #4c86ff, #2456c9); color: #fff; }
.start-body { display: flex; flex-direction: column; gap: 3px; }
.start-body b { font-size: 16.5px; }
.start-body em { font-style: normal; font-size: 13px; color: var(--muted); line-height: 1.5; }
.start-arrow { margin-left: auto; font-size: 20px; color: var(--brand); font-weight: 700; }

.intro-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: center;
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--muted);
}
.link-btn {
  border: 0; background: transparent; padding: 0;
  color: var(--brand); font-size: inherit; font-weight: 600;
  cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.link-btn:hover { color: var(--brand-dark); }

.resume-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  margin-bottom: 18px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid #ffd9b8;
}
.resume-text { display: flex; flex-direction: column; gap: 2px; }
.resume-text b { font-size: 15px; color: #a9550f; }
.resume-text span { color: #b46a2d; }

.auto-next {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px dashed #b9cffa;
  font-size: 14px;
  color: var(--brand-dark);
  font-weight: 600;
}
.auto-next .btn { margin-left: auto; }

.mini-tabs { display: inline-flex; gap: 4px; padding: 3px; background: #eef2fa; border-radius: 999px; }
.mini-tabs button {
  border: 0; background: transparent; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.mini-tabs button.active { background: #fff; color: var(--brand-dark); box-shadow: var(--shadow-sm); }

.mini-stat-row { display: flex; gap: 12px; justify-content: space-between; margin-bottom: 8px; }
.mini-stat-row > div { display: flex; flex-direction: column; }
.mini-stat-row span { font-size: 11px; color: var(--muted); }
.mini-stat-row b { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; }
.mini-stat-row em { font-style: normal; font-size: 11px; color: var(--muted); }
.spark-wrap { min-height: 34px; }
.spark-wrap svg { width: 100%; height: 34px; display: block; }
.mini-note { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.6; }
.mini-note b { color: var(--ink-2); }

.mini-board-list { display: flex; flex-direction: column; gap: 4px; }
.mini-board-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 6px; border-radius: 8px; font-size: 13px;
}
.mini-board-row.me { background: var(--brand-soft); }
.mini-rank { width: 24px; text-align: center; flex: none; font-weight: 700; color: var(--muted); }
.mini-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-score { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.mini-empty { padding: 12px 0; font-size: 12.5px; color: var(--muted); }

.recent-item { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.recent-item:last-child { border-bottom: 0; }
.recent-main { min-width: 0; flex: 1; }
.recent-title { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-meta { font-size: 11.5px; color: var(--muted); }
.recent-score { text-align: right; font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- 指法键位图 */

.keyboard-section { margin-top: 22px; border-top: 1px dashed var(--line); padding-top: 16px; }
.keyboard-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.keyboard-mount { overflow-x: auto; padding: 6px 0 2px; }
.kbd-board { min-width: 560px; display: flex; flex-direction: column; gap: 4px; }
.kbd-row { display: flex; gap: 4px; }
.kbd-key {
  flex: 1 1 0;
  min-width: 0;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  color: #23304a;
  background: #eef2fa;
  border: 1px solid rgba(23, 35, 61, 0.06);
  position: relative;
  transition: outline 0.1s ease, box-shadow 0.1s ease, transform 0.1s ease;
}
.kbd-key.w-15 { flex-grow: 1.5; }
.kbd-key.w-175 { flex-grow: 1.75; }
.kbd-key.w-2 { flex-grow: 2; }
.kbd-key.w-225 { flex-grow: 2.25; }
.kbd-key.w-space { flex-grow: 9; }
.kbd-key.f-lp { background: #f7c6d3; }
.kbd-key.f-lr { background: #f9d9a8; }
.kbd-key.f-lm { background: #cdecc3; }
.kbd-key.f-li { background: #c3dcff; }
.kbd-key.f-ri { background: #b9d9ff; }
.kbd-key.f-rm { background: #c8edc0; }
.kbd-key.f-rr { background: #f9d9a8; }
.kbd-key.f-rp { background: #f7c6d3; }
.kbd-key.f-thumb { background: #e2d4f7; }
.kbd-key.home-key::after {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 8px; height: 2px;
  border-radius: 1px;
  background: rgba(23, 35, 61, 0.28);
}
.kbd-key.next {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
  box-shadow: 0 0 0 4px rgba(47, 111, 237, 0.2);
  transform: translateY(-1px);
}
.kbd-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 11.5px; color: var(--muted); }
.kbd-legend-group { display: inline-flex; align-items: center; gap: 5px; }
.kbd-legend .sw { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.kbd-legend .sw.f-lp, .kbd-legend .sw.f-rp { background: #f7c6d3; }
.kbd-legend .sw.f-lr, .kbd-legend .sw.f-rr { background: #f9d9a8; }
.kbd-legend .sw.f-lm, .kbd-legend .sw.f-rm { background: #cdecc3; }
.kbd-legend .sw.f-li { background: #c3dcff; }
.kbd-legend .sw.f-ri { background: #b9d9ff; }
.kbd-legend .sw.f-thumb { background: #e2d4f7; }
.kbd-tip { margin-top: 8px; font-size: 12.5px; font-weight: 600; color: var(--brand-dark); min-height: 18px; }

/* ---------------------------------------------------------------- 帮助弹窗 */

.help-modal { width: min(820px, 100%); max-height: 86vh; }
.help-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.help-head h3 { margin: 0; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 24px; }
.help-block h4 { font-size: 14.5px; margin-bottom: 8px; color: var(--ink); }
.help-block ul { margin: 0; padding-left: 18px; }
.help-block li { font-size: 13.5px; color: var(--ink-2); line-height: 1.85; margin-bottom: 4px; }
.help-block kbd {
  display: inline-block;
  padding: 0 5px;
  min-width: 18px;
  border-radius: 4px;
  background: #f0f3fa;
  border: 1px solid #d7deee;
  border-bottom-width: 2px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-2);
  text-align: center;
}

/* ---------------------------------------------------------------- 进步图表 */

.viz-chart { position: relative; width: 100%; }
.viz-svg { display: block; width: 100%; height: auto; }
.viz-empty { padding: 22px 16px; text-align: center; font-size: 13px; color: var(--muted); border: 1.5px dashed var(--line); border-radius: var(--radius-sm); background: #fbfcff; }
.viz-tooltip {
  position: absolute;
  z-index: 5;
  min-width: 128px;
  padding: 9px 12px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 10px 26px rgba(23, 35, 61, 0.16);
  pointer-events: none;
}
.viz-tip-value { font-size: 17px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.viz-tip-name { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.viz-tip-meta { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.viz-hit { cursor: crosshair; }
.viz-spark { display: block; width: 100%; height: 34px; }

/* ---------------------------------------------------------------- 我的进步页 */

.progress-page { padding: 28px 0 44px; }
.progress-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.progress-head h1 { font-size: 30px; letter-spacing: -0.6px; }
.progress-head .who-mini { display: flex; align-items: center; gap: 10px; padding: 7px 14px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-dark); font-size: 13.5px; font-weight: 600; }
.progress-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.progress-summary .stat .value { font-size: 26px; }
.mode-tabs { margin-bottom: 14px; }
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.chart-card { padding: 18px 20px; }
.chart-card h3 { font-size: 15px; margin-bottom: 2px; }
.chart-card .chart-sub { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.chart-card .chart-wrap { position: relative; }
.progress-callout {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 16px 20px; margin-bottom: 18px;
  border-radius: var(--radius-sm);
  background: linear-gradient(120deg, #eef5ff, #f8fbff);
  border: 1px solid #d7e4ff;
}
.progress-callout .big { font-size: 30px; font-weight: 800; color: var(--brand-dark); line-height: 1; font-variant-numeric: tabular-nums; }
.progress-callout .cap { font-size: 12px; color: var(--muted); font-weight: 600; }
.progress-callout .arrow { font-size: 22px; color: var(--brand); }
.delta-up { color: var(--ok); font-weight: 700; }
.delta-down { color: var(--err); font-weight: 700; }
.progress-table-wrap { margin-top: 4px; }

@media (max-width: 980px) {
  .chart-grid { grid-template-columns: 1fr; }
  .help-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .start-option { padding: 14px; gap: 12px; }
  .start-ico { width: 40px; height: 40px; font-size: 19px; border-radius: 12px; }
  .start-body b { font-size: 15px; }
  .start-body em { font-size: 12px; }
  .progress-head h1 { font-size: 24px; }
  .kbd-board { min-width: 520px; }
  .kbd-key { height: 28px; font-size: 11px; }
}

/* ---------------------------------------------------------------- 名单校验 */

.name-check { min-height: 18px; font-size: 12.5px; font-weight: 600; }
.name-check.ok { color: var(--ok); }
.name-check.err { color: var(--err); }
.name-check.loading { color: var(--muted); }
.roster-error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--err-soft);
  color: var(--err);
  font-size: 12.5px;
  line-height: 1.6;
}
