/* ================= Practice exams (js/exams.js) ================= */
.exam-setup, .exam-results { max-width: 900px; margin: 0 auto; }
.exam-setup > .card { margin-top: 18px; }
.exam-hero { grid-template-columns: auto 1fr; }
.exam-live { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; border-color: var(--gold); background: color-mix(in srgb, var(--gold) 10%, var(--panel)); }
.exam-match { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.exam-match.on { border-color: var(--teal); }
.exam-course { font-weight: 900; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink2); margin: 16px 0 6px; }
.exam-opts { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 18px; }
.exam-opts h3 { margin: 0 0 8px; font-size: 16px; }
.exam-go { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 18px; padding-top: 14px; border-top: 2px solid var(--line); }
.exam-go p { margin: 0; flex: 1; min-width: 220px; }
.exam-warn { color: color-mix(in srgb, var(--orange) var(--am), var(--ink)); font-weight: 700; }
.exam-rules ul { margin: 8px 0 0; padding-left: 20px; color: var(--ink2); }
.exam-rules li { margin: 4px 0; }

.exam-grade { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-weight: 900; font-size: 18px; color: #fff; background: var(--c, var(--brand)); }
.g-A { --c: var(--teal); } .g-B { --c: var(--blue); } .g-C { --c: var(--gold-d); } .g-D { --c: var(--orange); } .g-F { --c: var(--red); }
.exam-hist { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.exam-hrow { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 14px; border: 2px solid var(--line); text-decoration: none; color: var(--ink); }
.exam-hrow:hover { border-color: var(--brand); }
.exam-hrow > span:nth-child(2) { flex: 1; min-width: 0; }
.exam-hrow small { display: block; }
.exam-trend { width: 100%; height: auto; display: block; }
.exam-trend .tl { stroke: var(--line); stroke-width: 2; stroke-dasharray: 6 6; }
.exam-trend .tt { fill: var(--ink2); font-size: 13px; font-weight: 900; }
.exam-trend .tp { fill: none; stroke: var(--brand); stroke-width: 3; stroke-linejoin: round; }
.exam-trend .td { fill: var(--panel); stroke: var(--brand); stroke-width: 3; }

/* taking the exam */
.exam-take { max-width: 1060px; }
.ex-top { flex-wrap: nowrap; }
.ex-title { flex: 1; min-width: 0; }
.ex-title b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.ex-title .bar { height: 10px; }
.ex-timer { font-variant-numeric: tabular-nums; }
.ex-timer.low { color: var(--orange); border-color: var(--orange); }
.ex-timer.crit { color: #fff; background: var(--red); border-color: var(--red); animation: shake .4s; }
.ex-layout { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 18px; align-items: start; }
.ex-flag { margin-left: auto; border: 2px solid var(--line); background: var(--panel); color: var(--ink2); border-radius: 99px; padding: 3px 12px; font-weight: 800; font-size: 13px; }
.ex-flag.on { border-color: var(--red); color: var(--red); background: var(--bad-bg); }
.ex-navcard { padding: 16px; position: sticky; top: 90px; }
.ex-navh { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; font-size: 14px; }
.ex-nav { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.ex-nav button { position: relative; aspect-ratio: 1; border-radius: 10px; border: 2px solid var(--line); background: var(--panel); font-weight: 900; font-size: 13px; color: var(--ink2); }
.ex-nav button.done { background: color-mix(in srgb, var(--brand) 16%, var(--panel)); border-color: color-mix(in srgb, var(--brand) 40%, transparent); color: var(--brand); }
.ex-nav button.cur { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand); }
.ex-nav button.flag::after { content: '🚩'; position: absolute; top: -8px; right: -6px; font-size: 11px; }
.ex-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; font-size: 12px; color: var(--ink2); font-weight: 700; }
.ex-legend .lg { display: inline-block; width: 12px; height: 12px; border-radius: 4px; border: 2px solid var(--line); vertical-align: -2px; margin-right: 4px; }
.ex-legend .lg.done { background: color-mix(in srgb, var(--brand) 16%, var(--panel)); border-color: color-mix(in srgb, var(--brand) 40%, transparent); }
.exam-confirm { text-align: center; }
.exam-confirm .row { margin-top: 14px; }
.ex-jump { border: 2px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 8px; min-width: 32px; padding: 2px 6px; margin: 2px; font-weight: 800; }
.ex-jump:hover { border-color: var(--brand); }

/* results */
.exam-bigrade { display: inline-grid; place-items: center; min-width: 96px; height: 96px; padding: 0 14px; border-radius: 28px; font-size: 52px; font-weight: 900; color: #fff; background: var(--c); margin-top: 8px; box-shadow: 0 6px 0 color-mix(in srgb, var(--c) 60%, #000); }
.exam-results .results h1 { margin: 14px 0 4px; }
.exam-carby { text-align: left; }
.exam-delta { font-size: 12px; font-weight: 800; opacity: .85; }
.exam-weak { display: flex; flex-direction: column; gap: 10px; }
.exam-weakrow { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 18px; border-left: 6px solid var(--c); }
.exam-wn { flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--c); color: #fff; font-weight: 900; }
.exam-brow { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; margin-bottom: 12px; font-weight: 700; }
.exam-brow .bar { grid-column: 1 / -1; }
.exam-brow .bar > i { background: var(--c, var(--brand)); }
.exam-topics td.ok { color: var(--teal-d); font-weight: 900; }
.exam-topics td.bad { color: var(--red); font-weight: 900; }
.exam-review { display: flex; flex-direction: column; gap: 10px; }
.exam-ritem { padding: 12px 16px; }
.exam-ritem.bad { border-left: 6px solid var(--red); }
.exam-ritem.ok { border-left: 6px solid var(--teal); }
.exam-ritem summary { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 700; list-style: none; }
.exam-ritem summary::-webkit-details-marker { display: none; }
.exam-rn { flex: none; width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--soft); font-weight: 900; font-size: 13px; }
.exam-rp { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exam-ritem[open] .exam-rp { white-space: normal; }
.exam-rbody { margin-top: 12px; border-top: 2px solid var(--line); padding-top: 12px; }
.exam-rbody .q-prompt { font-size: 18px; }
.exam-rbody .choice { cursor: default; }
.exam-rbody .choice.wrong { animation: none; }
.exam-rbody .explain { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: var(--soft); }
.exam-tag { display: inline-block; margin-left: 8px; font-size: 11.5px; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 99px; }
.exam-tag.ok { background: var(--teal-d); color: #fff; }
.exam-tag.bad { background: var(--red); color: #fff; }
.exam-rank { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.exam-rank h4 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink2); }
.exam-rank ol { margin: 0; padding-left: 22px; font-weight: 700; }

.exam-homecard { flex-direction: row; align-items: center; gap: 16px; margin-top: 18px; }

@media (max-width: 900px) {
  .ex-layout { grid-template-columns: 1fr; }
  .ex-navcard { position: static; padding: 12px; }
  .ex-nav { grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); }
  .ex-legend { display: none; }
}
@media (max-width: 560px) {
  .ex-top { gap: 8px; }
  .ex-top .btn.sm { padding: 8px 10px; }
  .exam-rank { grid-template-columns: 1fr; }
  .exam-homecard { flex-wrap: wrap; }
  .exam-bigrade { font-size: 42px; height: 80px; min-width: 80px; }
}
