:root {
  --bg: #0b0f17;
  --panel: #121826;
  --line: #1f2937;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --brand: #6366f1;
  --brand-2: #22d3ee;
  --good: #10b981;
  --info: #38bdf8;
  --warn: #f59e0b;
  --bad: #f43f5e;
  --radius: 14px;
}

* { box-sizing: border-box; }

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

body {
  background:
    radial-gradient(1100px 560px at 15% -10%, rgba(49, 46, 129, 0.38), transparent),
    radial-gradient(900px 500px at 90% 0%, rgba(8, 145, 178, 0.18), transparent),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h1 { font-size: 26px; letter-spacing: 0.3px; }
h2 { font-size: 17px; }
h3 { font-size: 16px; }

.muted { color: var(--muted); font-size: 13px; }
.link { color: var(--brand-2); font-size: 13px; }
.link:hover { text-decoration: underline; }
.empty { color: var(--muted); font-size: 14px; padding: 14px 2px; }

/* ---------------------------------------------------------- 布局 */

.app { display: flex; min-height: 100vh; }

.side {
  width: 216px;
  flex-shrink: 0;
  padding: 22px 14px;
  border-right: 1px solid var(--line);
  background: rgba(13, 18, 28, 0.86);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 0;
  height: 100vh;
  backdrop-filter: blur(8px);
}

.brand {
  font-weight: 700;
  font-size: 17px;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 8px 18px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 0 12px var(--brand);
}

.nav {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}
.nav:hover { background: #182031; color: var(--text); }
.nav.active {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.22), rgba(34, 211, 238, 0.1));
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #fff;
}

.side-foot {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.main { flex: 1; padding: 28px 32px 64px; max-width: 1180px; }

/* ---------------------------------------------------------- 通用块 */

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 22px;
}
.page-head p { margin: 6px 0 0; }
.page-head .link { display: inline-block; margin-bottom: 8px; }

.panel {
  background: linear-gradient(180deg, rgba(21, 28, 43, 0.92), rgba(16, 22, 34, 0.92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 20px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 12px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.grid-2 .panel { margin-bottom: 0; }

.btn {
  border: 1px solid var(--line);
  background: #172033;
  color: var(--text);
  border-radius: 10px;
  padding: 9px 15px;
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.05s;
}
.btn:hover { border-color: #374151; background: #1c2740; }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(135deg, #4f46e5, #0ea5e9);
  border: none;
  font-weight: 600;
}
.btn.danger { color: #fecdd3; border-color: rgba(244, 63, 94, 0.4); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* ---------------------------------------------------------- 统计 */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.stat {
  background: rgba(18, 24, 38, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat-label { color: var(--muted); font-size: 12px; letter-spacing: 0.4px; }
.stat-value {
  font-size: 24px;
  font-weight: 700;
  margin: 4px 0 2px;
  background: linear-gradient(135deg, #fff, #a5b4fc);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat-hint { color: #64748b; font-size: 12px; }

/* ---------------------------------------------------------- 选题 */

.topics { display: flex; flex-direction: column; gap: 12px; }

.topic {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  background: rgba(15, 21, 33, 0.7);
}
.topic-head { display: flex; align-items: baseline; gap: 10px; }
.topic-head h3 { flex: 1; }
.rank {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  min-width: 18px;
}
.score {
  font-weight: 700;
  font-size: 18px;
  color: #c7d2fe;
  font-variant-numeric: tabular-nums;
}

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 9px 0; }
.tag {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.18);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #c7d2fe;
}
.tag.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}

.angle { margin: 0 0 8px; color: #cbd5e1; font-size: 14px; }
.topic-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

/* ---------------------------------------------------------- 赛道 */

.track-row {
  display: grid;
  grid-template-columns: 110px 1fr 54px 62px;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-radius: 10px;
}
.track-row:hover { background: #161e2f; }
.track-name { font-size: 14px; }
.track-score { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

.bar {
  height: 7px;
  border-radius: 99px;
  background: #1b2435;
  overflow: hidden;
}
.bar span {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
}

.pill {
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 999px;
  text-align: center;
  white-space: nowrap;
  border: 1px solid transparent;
}
.pill.good { color: #6ee7b7; background: rgba(16, 185, 129, 0.14); border-color: rgba(16, 185, 129, 0.4); }
.pill.info { color: #7dd3fc; background: rgba(56, 189, 248, 0.12); border-color: rgba(56, 189, 248, 0.4); }
.pill.warn { color: #fcd34d; background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.4); }
.pill.bad { color: #fda4af; background: rgba(244, 63, 94, 0.12); border-color: rgba(244, 63, 94, 0.4); }

.head-score { display: flex; align-items: center; gap: 12px; }
.big { font-size: 30px; font-weight: 700; color: #c7d2fe; }

.dim { margin-bottom: 12px; }
.dim-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 5px;
  color: #cbd5e1;
}
.dim-weight { color: #64748b; font-size: 11px; margin-top: 3px; }
.advice { margin: 14px 0 0; padding-left: 18px; color: #cbd5e1; font-size: 13px; }
.advice li { margin-bottom: 6px; }

/* ---------------------------------------------------------- 表格 / 文件 */

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.table th { color: var(--muted); font-weight: 500; font-size: 12px; }

.file-list { display: flex; flex-direction: column; gap: 4px; padding: 12px; }
.file-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13px;
  border: 1px solid transparent;
}
.file-row:hover { background: #161e2f; }
.file-row.active { border-color: rgba(99, 102, 241, 0.45); background: #182138; }

.report-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  align-items: start;
}
.report-view { min-height: 420px; overflow-x: auto; }
.report-view pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12.5px;
  color: #cbd5e1;
  margin: 0;
}

.md h1 { font-size: 22px; margin: 4px 0 12px; }
.md h2 { font-size: 17px; margin: 22px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.md h3 { font-size: 15px; margin: 16px 0 6px; }
.md p { margin: 6px 0; color: #cbd5e1; }
.md ul { margin: 6px 0; padding-left: 20px; color: #cbd5e1; }
.md blockquote {
  margin: 14px 0 0;
  padding: 10px 14px;
  border-left: 3px solid var(--brand);
  background: rgba(79, 70, 229, 0.08);
  color: var(--muted);
  font-size: 13px;
}
.md table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13px; }
.md th, .md td { border: 1px solid var(--line); padding: 7px 9px; text-align: left; }
.md th { background: #151d2e; color: var(--muted); font-weight: 500; }

textarea {
  width: 100%;
  min-height: 360px;
  background: #0c1220;
  color: #dbeafe;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12.5px;
  line-height: 1.65;
  resize: vertical;
}
textarea:focus { outline: 1px solid rgba(99, 102, 241, 0.6); }

.alert {
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  margin-bottom: 12px;
}
.alert.bad { background: rgba(244, 63, 94, 0.12); border: 1px solid rgba(244, 63, 94, 0.35); color: #fda4af; }

/* ---------------------------------------------------------- 登录 */

.login-body { display: grid; place-items: center; min-height: 100vh; }
.login-card {
  width: min(380px, 88vw);
  background: rgba(18, 24, 38, 0.94);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 30px 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
.login-card .brand { margin: 0 0 6px; }
.login-card label { display: block; margin-top: 14px; font-size: 13px; color: var(--muted); }
.login-card input {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0c1220;
  color: var(--text);
  font-size: 14px;
}
.login-card input:focus { outline: 1px solid rgba(99, 102, 241, 0.6); }
.login-card .btn { width: 100%; margin-top: 20px; }

/* ---------------------------------------------------------- 提示 */

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 360px;
  padding: 12px 16px;
  border-radius: 12px;
  background: #1b2537;
  border: 1px solid var(--line);
  font-size: 13px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok { border-color: rgba(16, 185, 129, 0.5); }
.toast.err { border-color: rgba(244, 63, 94, 0.5); }

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

@media (max-width: 900px) {
  .app { flex-direction: column; }
  .side {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    padding: 12px 14px;
    overflow-x: auto;
  }
  .brand { margin: 0 12px 0 0; font-size: 15px; }
  .nav { white-space: nowrap; padding: 7px 11px; }
  .side-foot { margin: 0 0 0 auto; border: none; padding: 0; gap: 10px; }
  .main { padding: 18px 16px 48px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .report-layout { grid-template-columns: 1fr; }
  .track-row { grid-template-columns: 86px 1fr 46px 56px; }
  .page-head { flex-direction: column; align-items: flex-start; }
}
