/* exam.4ab.in — Question Paper Analyser (app/analyse.html).
   Loads after tokens.css and app.css. Every colour comes from a token so
   light/dark both work with nothing new to define here. New classes are
   prefixed `.an-` so nothing here can collide with app.css/topic.css/check.css. */

body { background: var(--bg); }

.an-source { padding: 16px; margin-bottom: 16px; }
.an-source h2 { margin: 0 0 10px; font-size: 18px; }

.an-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.an-srctab {
  padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted);
}
.an-srctab:hover { background: var(--chip-bg); color: var(--ink); }
.an-srctab[aria-selected="true"] { background: var(--navy); border-color: var(--navy); color: var(--on-navy); }

.an-srcpanel { min-height: 40px; }

.an-picklist { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow: auto; margin-bottom: 10px; }
.an-pickrow { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; padding: 4px 0; }
.an-pickrow input { accent-color: var(--navy-2); flex: none; }

/* ------------------------------------------------------------------ cards */
.an-source + .card,
#resultsOut > .card,
#resultsOut > .an-blueprint,
#resultsOut > .an-ai {
  padding: 16px 18px; margin-bottom: 16px;
}
#resultsOut h2 { font-size: 18px; margin: 0 0 10px; }
#resultsOut h3 { font-size: 14px; margin: 16px 0 8px; color: var(--ink); }
#resultsOut h3:first-of-type { margin-top: 0; }
#resultsOut h4 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 14px 0 6px; }

/* ------------------------------------------------------------------ tables */
table.an-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 6px; }
table.an-table th, table.an-table td {
  padding: 7px 9px; text-align: left; border-bottom: 1px solid var(--line-2); vertical-align: middle;
}
table.an-table th {
  color: var(--muted); font-weight: 700; font-size: 11px; letter-spacing: .04em; text-transform: uppercase;
}
table.an-table td.num, table.an-table th.num { text-align: right; font-family: var(--mono); }

/* An inline bar drawn with plain CSS, next to the numbers it visualises —
   the "inline SVG bars" for the year chart live separately below; this is the
   lighter-weight per-row bar used in the topic/exam/difficulty mix tables. */
.an-barcell { width: 140px; }
.an-bar {
  display: block; height: 8px; border-radius: 5px;
  background: linear-gradient(90deg, var(--navy-2), var(--navy));
  min-width: 2px;
}

.an-over { color: var(--red); font-weight: 700; }
.an-under { color: var(--amber); font-weight: 700; }

.an-list { margin: 0; padding-left: 18px; font-size: 13px; color: var(--body); }
.an-list li { margin-bottom: 4px; }

/* ------------------------------------------------------------------- chart */
.an-chart { padding: 4px 0 0; }
.an-chart svg { width: 100%; height: auto; display: block; }
.an-chart__bar { fill: var(--navy-2); }
.an-chart__axis { stroke: var(--line); stroke-width: 1; }
.an-chart__label { font: 10.5px var(--sans); fill: var(--muted); }

/* ---------------------------------------------------------------- blueprint */
.an-blueprint h3 { margin-top: 0; }
.an-bprows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.an-bprow { grid-template-columns: minmax(0, 1fr) 120px; }

/* --------------------------------------------------------------------- AI */
.an-ai-banner {
  display: inline-block; padding: 4px 10px; border-radius: 999px; margin-bottom: 8px;
  background: rgba(27, 42, 94, .1); border: 1px solid var(--chip-line);
  font-size: 11px; letter-spacing: .05em; color: var(--navy-2);
}
.an-ai-banner b { font-weight: 800; }
.an-ai-text { font-size: 13.5px; color: var(--body); white-space: pre-wrap; line-height: 1.55; }
.an-err { color: var(--red); font-size: 13.5px; font-weight: 600; }

/* ------------------------------------------------------------------- print */
@media print {
  .an-noprint, .an-source, .top, .an-ai, #boot { display: none !important; }
  body { background: #fff; }
  .card, .an-blueprint { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  table.an-table { font-size: 11px; }
}

/* QA F4 — on a phone a wide table scrolls inside its card instead of widening the page. */
@media (max-width: 760px) {
  .an-table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .an-table thead, .an-table tbody, .an-table tr { display: table; width: 100%; table-layout: fixed; }
  .an-table td, .an-table th { word-break: break-word; }
}
