/* exam.4ab.in — answer checker (check.html) + "My papers" additions (docs.js).
   Loads after tokens.css and app.css. Every colour is a token, same rule as
   the rest of the site, so light/dark both work with nothing new to define
   here. New classes are prefixed `.chk-` (checker) or `.docs-` (My papers)
   so nothing here can collide with app.css/print.css. */

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

/* ---------------------------------------------------------------- shell */
.chk-shell { max-width: 980px; margin: 0 auto; padding: 18px 18px 60px; }

.chk-top {
  position: sticky; top: 0; z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 10px 18px;
  background: var(--card); border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.chk-top__title { font-family: var(--serif); font-size: 15px; color: var(--ink); margin-right: auto; }
.chk-top__sub { font-size: 11.5px; color: var(--muted); flex: 1 0 100%; }

.chk-honest {
  margin: 14px 0; padding: 11px 14px; border-radius: var(--r-md);
  background: var(--chip-bg); border: 1px solid var(--chip-line);
  font-size: 13px; color: var(--body);
}

/* ---------------------------------------------------------------- tabs */
.chk-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; }
.chk-tab {
  padding: 8px 15px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--muted);
}
.chk-tab:hover { background: var(--chip-bg); color: var(--ink); }
.chk-tab[aria-selected="true"] { background: var(--navy); border-color: var(--navy); color: var(--on-navy); }

.chk-panel[hidden] { display: none; }

/* --------------------------------------------------------------- timer */
.chk-timer {
  display: inline-flex; align-items: center; gap: 6px;
  font: 700 13px/1 var(--mono); padding: 6px 11px; border-radius: 999px;
  background: var(--chip-bg); border: 1px solid var(--chip-line); color: var(--navy);
}
.chk-timer--low { color: var(--red); border-color: rgba(220, 38, 38, .3); background: rgba(220, 38, 38, .1); }

/* ------------------------------------------------------------- attempt */
.chk-q { padding: 14px 16px 16px; margin-bottom: 14px; }
.chk-q__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.chk-q__marks { margin-left: auto; font-size: 11.5px; color: var(--muted); white-space: nowrap; }

.chk-opts { display: flex; flex-direction: column; gap: 7px; margin-top: 12px; }
.chk-opt {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: 9px; border: 1px solid var(--line); background: var(--card-2);
  cursor: pointer; font-size: 14px; min-height: 44px;
}
.chk-opt:has(input:checked) { border-color: var(--navy-2); background: var(--chip-bg); }
.chk-opt input { accent-color: var(--navy-2); flex: none; width: 18px; height: 18px; }
.chk-opt__letter { font: 700 13px/1 var(--mono); color: var(--navy); flex: none; width: 20px; }

.chk-numwrap { margin-top: 12px; max-width: 260px; }

.chk-sp-note {
  padding: 10px 13px; border-radius: var(--r-md); font-size: 13px;
  background: rgba(217, 119, 6, .1); border: 1px solid rgba(217, 119, 6, .28);
  color: var(--amber); margin: 20px 0 12px;
}

/* ----------------------------------------------------------- responses grid */
.chk-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 8px; margin: 14px 0;
}
.chk-cell { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.chk-cell__n { font-size: 10.5px; color: var(--muted); font-family: var(--mono); }
.chk-cell input {
  width: 100%; min-height: 44px; text-align: center; text-transform: uppercase;
  border-radius: 8px; border: 1px solid var(--line); background: var(--card-2);
  color: var(--ink); font: 700 15px/1 var(--mono);
}
.chk-cell input:focus { border-color: var(--focus); }
.chk-cell--sp input { border-style: dashed; opacity: .75; }

/* --------------------------------------------------------------- CSV mode */
.chk-csv-input {
  width: 100%; min-height: 160px; padding: 10px 12px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--card-2); color: var(--ink);
  font: 13px/1.5 var(--mono); resize: vertical;
}
.chk-csv-input:focus { border-color: var(--focus); }
.chk-filerow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0; }

.chk-table-wrap { overflow-x: auto; margin: 12px 0; border-radius: var(--r-md); border: 1px solid var(--line); }
.chk-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 480px; }
.chk-table th, .chk-table td {
  padding: 8px 10px; border-bottom: 1px solid var(--line-2); text-align: left; white-space: nowrap;
}
.chk-table th {
  background: var(--card-2); font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); position: sticky; top: 0;
}
.chk-table tr:last-child td { border-bottom: 0; }
.chk-table td.chk-num { font-family: var(--mono); text-align: right; }
.chk-status--correct { color: var(--green); font-weight: 700; }
.chk-status--wrong { color: var(--red); font-weight: 700; }
.chk-status--unattempted { color: var(--muted); }
.chk-status--unscored { color: var(--muted); font-style: italic; }

/* --------------------------------------------------------------- result */
.chk-score {
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  padding: 18px 20px; margin-bottom: 16px;
}
.chk-score__big { font: 700 40px/1 var(--serif); color: var(--navy); }
.chk-score__big span { font-size: 20px; color: var(--muted); font-weight: 400; }
.chk-score__pct { font: 700 22px/1 var(--serif); color: var(--ink); }

.chk-review-toggle { display: flex; align-items: center; gap: 8px; margin: 4px 0 14px; font-size: 13.5px; }

.chk-review { margin-top: 10px; padding: 12px 14px; }
.chk-review .q__crop { margin-top: 10px; }
.chk-review__row { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; font-size: 13px; }
.chk-review__row b { color: var(--ink); }
.chk-explain {
  margin-top: 10px; padding: 10px 12px; border-radius: var(--r-sm);
  background: var(--chip-bg); border: 1px dashed var(--chip-line);
  font-size: 13px; color: var(--body); white-space: pre-wrap;
}
.chk-explain b { display: block; font: 700 10.5px/1 var(--sans); letter-spacing: .06em;
  text-transform: uppercase; margin-bottom: 6px; color: var(--muted); }

@media (max-width: 760px) {
  .chk-shell { padding: 12px 12px 48px; }
  .chk-score { flex-direction: column; align-items: flex-start; gap: 8px; }
  .chk-grid { grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); }
  .chk-opt { min-height: 44px; }
}

/* ------------------------------------------------------- print (report) */
@media print {
  .chk-top, .chk-tabs, .chk-noprint { display: none !important; }
  .chk-shell { max-width: none; padding: 0; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border-color: #ccc; }
}

/* =====================================================================
   MY PAPERS (docs.js) — everything below is `.docs-` prefixed and is the
   only stylesheet docs.js has (it injects the <link> to this file itself,
   since BRIEF-B does not allow editing app/index.html to add one).
   ===================================================================== */

.docs-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.docs-import-msg { font-size: 12.5px; }

.docs-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.docs-card { padding: 16px; }
.docs-card__head { margin-bottom: 8px; }
.docs-card__title { font-size: 16px; margin: 0; }
.docs-card__sub { font-size: 12.5px; color: var(--muted); font-style: italic; margin: 2px 0 0; }
.docs-card__filters { font-size: 12.5px; margin: 6px 0 0; }
.docs-card__saved { font-size: 11.5px; margin: 6px 0 0; }
.docs-warn {
  margin: 8px 0 0; padding: 8px 10px; border-radius: var(--r-sm); font-size: 12px;
  background: rgba(217, 119, 6, .1); border: 1px solid rgba(217, 119, 6, .28); color: var(--amber);
}

@media (max-width: 760px) {
  .docs-grid { grid-template-columns: minmax(0, 1fr); }
}
