/* ================================================================
   analytics.css — Modern dark dashboard for the exam analysis page.

   Deliberately NOT styled like the exam screen: this is a data
   report, so it uses its own dark glass surface and accent palette.
   ================================================================ */

#screen-analytics {
  --an-bg: #0a0e1a;
  --an-card: rgba(255, 255, 255, .045);
  --an-card-2: rgba(255, 255, 255, .028);
  --an-line: rgba(255, 255, 255, .09);
  --an-text: #e8eefb;
  --an-muted: #8b98b4;
  --an-blue: #4f8cff;
  --an-cyan: #22d3ee;
  --an-violet: #a78bfa;
  --an-green: #34d399;
  --an-amber: #fbbf24;
  --an-red: #f87171;

  position: relative;
  min-height: 100vh;
  background:
    radial-gradient(1100px 620px at 12% -8%, rgba(79, 140, 255, .22), transparent 62%),
    radial-gradient(900px 520px at 92% 4%, rgba(167, 139, 250, .18), transparent 60%),
    radial-gradient(760px 520px at 60% 108%, rgba(34, 211, 238, .13), transparent 62%),
    var(--an-bg);
  color: var(--an-text);
  font-family: "Inter", "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  overflow-y: auto;
}

/* ---------------- top bar ---------------- */
.an-topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 16px 28px;
  background: rgba(10, 14, 26, .72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--an-line);
}
.an-back {
  padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 13px;
  border: 1px solid var(--an-line); background: var(--an-card); color: var(--an-text);
  transition: all .18s ease;
}
.an-back:hover { background: rgba(79, 140, 255, .18); border-color: var(--an-blue); }
.an-title { font-size: 17px; font-weight: 700; letter-spacing: .3px; }
.an-sub { margin-left: auto; font-size: 12px; color: var(--an-muted); }

/* ---------------- layout ---------------- */
.an-body {
  max-width: 1240px; margin: 0 auto; padding: 26px 28px 64px;
  display: flex; flex-direction: column; gap: 22px;
}
.an-row { display: grid; gap: 18px; }
.an-row.cols-3 { grid-template-columns: repeat(3, 1fr); }
.an-row.cols-2 { grid-template-columns: 1.15fr .85fr; }
.an-row.cols-2b { grid-template-columns: 1fr 1fr; }

.an-card {
  background: var(--an-card);
  border: 1px solid var(--an-line);
  border-radius: 16px;
  padding: 20px 22px;
  backdrop-filter: blur(10px);
}
.an-card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.an-card-title { font-size: 14px; font-weight: 700; letter-spacing: .4px; }
.an-card-hint { font-size: 11px; color: var(--an-muted); }

/* ---------------- hero ---------------- */
.an-hero { display: grid; grid-template-columns: 300px 1fr; gap: 26px; align-items: center; }
.an-hero-score { display: flex; flex-direction: column; align-items: center; }
.an-score-num {
  font-size: 68px; font-weight: 800; line-height: 1;
  background: linear-gradient(135deg, #7cb0ff 0%, #a78bfa 55%, #22d3ee 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.an-score-meta { margin-top: 8px; font-size: 12px; color: var(--an-muted); text-align: center; }
.an-pct-pill {
  margin-top: 12px; padding: 4px 14px; border-radius: 20px; font-size: 12px; font-weight: 700;
  background: rgba(52, 211, 153, .14); color: var(--an-green);
  border: 1px solid rgba(52, 211, 153, .3);
}
.an-secs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.an-sec {
  background: var(--an-card-2); border: 1px solid var(--an-line);
  border-radius: 14px; padding: 16px; text-align: center;
}
.an-sec-name { font-size: 12px; color: var(--an-muted); margin-bottom: 8px; }
.an-sec-val { font-size: 30px; font-weight: 800; }
.an-sec-bar { margin-top: 10px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.08); overflow: hidden; }
.an-sec-bar > i { display: block; height: 100%; border-radius: 3px; }
.an-sec-sub { margin-top: 8px; font-size: 11px; color: var(--an-muted); }

/* ---------------- KPI tiles ---------------- */
.an-kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.an-kpi {
  background: var(--an-card); border: 1px solid var(--an-line);
  border-radius: 14px; padding: 16px 18px;
}
.an-kpi-lbl { font-size: 11px; color: var(--an-muted); letter-spacing: .5px; text-transform: uppercase; }
.an-kpi-val { margin-top: 8px; font-size: 26px; font-weight: 800; }
.an-kpi-note { margin-top: 4px; font-size: 11px; color: var(--an-muted); }

/* ---------------- charts ---------------- */
.an-chart-wrap { display: flex; justify-content: center; }
.gauge { width: 190px; height: 190px; }
.g-track { fill: none; stroke: rgba(255,255,255,.08); stroke-width: 12; }
.g-bar { fill: none; stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset 1s ease; }
.g-val { fill: #fff; font-size: 34px; font-weight: 800; text-anchor: middle; }
.g-lbl { fill: #8b98b4; font-size: 12px; text-anchor: middle; }
.g-sub { fill: #8b98b4; font-size: 11px; text-anchor: middle; }

.radar { width: 100%; max-width: 330px; height: auto; }
.radar-grid { fill: none; stroke: rgba(255,255,255,.09); stroke-width: 1; }
.radar-axis { stroke: rgba(255,255,255,.12); stroke-width: 1; }
.radar-area { fill: rgba(79,140,255,.26); stroke: #4f8cff; stroke-width: 2; }
.radar-dot { fill: #22d3ee; }
.radar-lbl { fill: #a9b5cc; font-size: 11px; }
.radar-val { fill: #6d7a93; font-size: 9px; }

/* horizontal bars (per question type) */
.an-bars { display: flex; flex-direction: column; gap: 12px; }
.an-bar-row { display: grid; grid-template-columns: 92px 1fr 78px; align-items: center; gap: 10px; }
.an-bar-name { font-size: 12px; color: var(--an-text); }
.an-bar-track { height: 9px; border-radius: 5px; background: rgba(255,255,255,.07); overflow: hidden; }
.an-bar-fill { height: 100%; border-radius: 5px; transition: width .8s ease; }
.an-bar-meta { font-size: 11px; color: var(--an-muted); text-align: right; }

/* vertical bars (difficulty) */
.an-vbars { display: flex; align-items: flex-end; gap: 12px; height: 168px; padding-top: 8px; }
.an-vbar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.an-vbar-col { width: 100%; max-width: 46px; border-radius: 6px 6px 0 0; background: rgba(255,255,255,.06); position: relative; }
.an-vbar-fill { position: absolute; bottom: 0; left: 0; right: 0; border-radius: 6px 6px 0 0; }
.an-vbar-val { font-size: 11px; font-weight: 700; }
.an-vbar-lbl { font-size: 11px; color: var(--an-muted); }

/* pacing */
.an-pace { display: flex; align-items: flex-end; gap: 3px; height: 150px; overflow-x: auto; padding-bottom: 4px; }
.an-pace-bar { flex: 1 0 14px; min-width: 12px; border-radius: 3px 3px 0 0; position: relative; }
.an-pace-avg {
  position: absolute; left: 0; right: 0; height: 1px;
  background: rgba(255,255,255,.35); border-top: 1px dashed rgba(255,255,255,.5);
}
.an-legend { display: flex; gap: 16px; margin-top: 12px; font-size: 11px; color: var(--an-muted); }
.an-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------------- advice ---------------- */
.an-advice { display: flex; flex-direction: column; gap: 12px; }
.an-adv {
  display: flex; gap: 12px; padding: 13px 15px; border-radius: 12px;
  background: var(--an-card-2); border: 1px solid var(--an-line);
  border-left: 3px solid var(--an-blue);
}
.an-adv.warn { border-left-color: var(--an-amber); }
.an-adv.bad { border-left-color: var(--an-red); }
.an-adv.good { border-left-color: var(--an-green); }
.an-adv-icon { font-size: 15px; line-height: 1.3; }
.an-adv-body { flex: 1; }
.an-adv-title { font-size: 13px; font-weight: 700; margin-bottom: 3px; }
.an-adv-text { font-size: 12px; color: var(--an-muted); line-height: 1.6; }

/* ---------------- weak-question list ---------------- */
.an-weak { display: flex; flex-direction: column; gap: 10px; }
.an-weak-item {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center;
  padding: 11px 14px; border-radius: 10px;
  background: var(--an-card-2); border: 1px solid var(--an-line);
}
.an-weak-no {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; background: rgba(248,113,113,.16); color: var(--an-red);
}
.an-weak-stem {
  font-size: 12px; color: var(--an-muted); line-height: 1.5;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.an-weak-meta { font-size: 11px; color: var(--an-muted); white-space: nowrap; }

.an-empty { padding: 26px; text-align: center; color: var(--an-muted); font-size: 13px; }

.an-actions { display: flex; gap: 12px; justify-content: center; margin-top: 4px; }
.an-btn {
  padding: 11px 26px; border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 600;
  border: 1px solid var(--an-line); background: var(--an-card); color: var(--an-text);
  transition: all .18s ease;
}
.an-btn:hover { background: rgba(79,140,255,.2); border-color: var(--an-blue); }
.an-btn.primary {
  background: linear-gradient(135deg, #4f8cff, #a78bfa);
  border-color: transparent; color: #fff;
}
.an-btn.primary:hover { filter: brightness(1.1); }

@media (max-width: 1080px) {
  .an-hero { grid-template-columns: 1fr; }
  .an-row.cols-3, .an-row.cols-2, .an-row.cols-2b { grid-template-columns: 1fr; }
  .an-kpis { grid-template-columns: repeat(2, 1fr); }
}
