/* exam-tools: styles (see exam-tools.js). Classes are prefixed xt-. */

/* ---------- sections on a results page */
.ex-hook:has(> .xt-sec) { display: block; }
.xt-sec { display: block; background: #fff; border-radius: 18px; box-shadow: var(--shadow-sm); padding: 18px 20px; margin-top: 14px; }
.xt-sec-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 14px; margin-bottom: 12px; }
.xt-sec-head h3 { font-family: var(--font-display); font-size: 1.12rem; margin: 0; }
.xt-sec-head p { color: var(--muted); font-size: .85rem; margin: 0; }
.xt-note { color: var(--muted); font-size: .84rem; margin-top: 8px; }
.xt-advice { color: var(--ink-soft); font-size: .88rem; margin-top: 8px; }

/* timing chart: CSS bars, one per question */
.xt-chart { --cols: 10; }
.xt-plot { position: relative; height: 130px; border-bottom: 1px solid var(--line); }
.xt-bars { list-style: none; margin: 0; padding: 0; height: 100%; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 3px; align-items: end; }
.xt-bar { height: 100%; display: flex; align-items: flex-end; min-width: 0; }
.xt-bar-fill { display: block; width: 100%; border-radius: 3px 3px 0 0; background: var(--coral); }
.xt-bar.is-right .xt-bar-fill { background: var(--go); }
.xt-bar.is-part .xt-bar-fill { background: var(--sun); }
.xt-med { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--ink-soft); pointer-events: none; }
.xt-med span { position: absolute; right: 0; top: -17px; font-size: .68rem; color: var(--ink-soft); background: rgba(255, 255, 255, .85); padding: 0 4px; border-radius: 3px; }
.xt-labels { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 3px; margin-top: 4px; }
.xt-labels span { font-size: .66rem; color: var(--muted); text-align: center; overflow: hidden; white-space: nowrap; }
.xt-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: .78rem; color: var(--ink-soft); }
.xt-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; background: var(--coral); }
.xt-legend .is-right::before { background: var(--go); }
.xt-legend .is-part::before { background: var(--sun); }
.xt-tcols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 22px; margin-top: 16px; }
.xt-tcols h4 { font-size: .92rem; margin: 0 0 6px; }
.xt-tlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.xt-tlist li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; border-radius: var(--r-sm); background: #f6f8fb; font-size: .86rem; }
.xt-tlist li span { color: var(--ink-soft); }

/* "Show me how" list on the results page */
.xt-hows { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.xt-hows li { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 12px; border: 1px solid var(--line); border-radius: var(--r-md); font-size: .88rem; }
.xt-hows-n { font-weight: 600; flex: 1; min-width: 0; }
.xt-hows-m { color: var(--muted); font-size: .82rem; }
.xt-how-btn { margin-top: 10px; }

/* ---------- dialog */
.xt-dialog { margin: auto; border: none; padding: 0; border-radius: var(--r-lg); box-shadow: var(--shadow-lg); width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); color: var(--ink); background: #fff; }
.xt-dialog::backdrop { background: rgba(9, 16, 32, .55); }
.xt-dlg { padding: 20px 22px 24px; }
.xt-dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.xt-dlg-head h2 { font-family: var(--font-display); font-size: 1.3rem; margin: 0; }
.xt-how-kicker { font-size: .76rem; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; margin: 0; }
.xt-how-title { font-size: 1.08rem; margin: 2px 0 10px; }
.xt-how-sec { margin-top: 14px; }
.xt-how-sec h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--violet); margin: 0 0 6px; }
.xt-how-sec p { margin: 0; line-height: 1.6; }
.xt-examples { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; counter-reset: xtex; }
.xt-examples > li { background: #f6f8fb; border-radius: var(--r-md); padding: 12px 14px; }
.xt-ex-q { font-weight: 600; }
.xt-steps { margin: 8px 0 0; padding-left: 1.3em; display: grid; gap: 3px; color: var(--ink-soft); }
.xt-how-sec .xt-ex-a { margin-top: 8px; }
.xt-how-this { border-top: 1px solid var(--line); padding-top: 12px; }
.xt-how-ms { margin-top: 6px; font-size: .9rem; color: var(--ink-soft); }
.xt-how-ms span { display: block; font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 2px; }

/* ---------- topic insights: heatmap */
.xt-ins { display: grid; gap: 0; }
.xt-ins-intro p { color: var(--ink-soft); max-width: 72ch; margin-top: 4px; }
.xt-ins-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 10px 20px; margin-bottom: 6px; }
.xt-ins-head p { color: var(--muted); font-size: .86rem; max-width: 70ch; margin-top: 2px; }
.xt-group { margin-top: 14px; }
.xt-group h3 { font-size: .95rem; margin: 0 0 8px; color: var(--ink-soft); }
.xt-heat { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.xt-heat > li { display: grid; }
.xt-cell { display: grid; gap: 1px; align-content: start; text-align: left; font: inherit; color: inherit; padding: 10px 12px; border-radius: var(--r-md); border: 1px solid transparent; min-height: 92px; }
button.xt-cell { cursor: pointer; transition: transform .12s, box-shadow .12s; }
button.xt-cell:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
button.xt-cell:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; }
.xt-cell-name { font-weight: 600; font-size: .88rem; line-height: 1.25; }
.xt-cell-sub { font-size: .74rem; opacity: .85; }
.xt-cell-pct { font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; line-height: 1.2; margin-top: 4px; }
.xt-cell-band { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.xt-cell-detail { font-size: .74rem; opacity: .85; margin-top: 2px; }
.xt-cell.is-focus, .xt-key.is-focus i, .xt-chip.is-focus, .xt-mini .is-focus { background: #f7dcdc; border-color: #e7b3b3; color: #7d1f1f; }
.xt-cell.is-developing, .xt-key.is-developing i, .xt-chip.is-developing, .xt-mini .is-developing { background: #f8ead0; border-color: #e6cc98; color: #6e4510; }
.xt-cell.is-good, .xt-key.is-good i, .xt-chip.is-good, .xt-mini .is-good { background: #e3f1e8; border-color: #b6d8c2; color: #1f5a3a; }
.xt-cell.is-secure, .xt-key.is-secure i, .xt-chip.is-secure, .xt-mini .is-secure { background: #c7e4d2; border-color: #8fc4a3; color: #134a2d; }
.xt-heat-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: .8rem; color: var(--ink-soft); }
.xt-key { display: inline-flex; align-items: center; gap: 6px; }
.xt-key i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 1px solid; }
.xt-key small { color: var(--muted); }
.xt-seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.xt-seg button { font: inherit; font-size: .84rem; padding: 7px 12px; background: #fff; color: var(--ink-soft); border: none; cursor: pointer; }
.xt-seg button + button { border-left: 1px solid var(--line); }
.xt-seg button[aria-pressed="true"] { background: var(--violet); color: #fff; }
.xt-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.xt-table th, .xt-table td { text-align: left; padding: 8px 10px; border-top: 1px solid #edf0f4; vertical-align: middle; }
.xt-table thead th { border-top: none; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.xt-table tbody th { font-weight: 600; }
.xt-chip { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: .78rem; font-weight: 600; border: 1px solid; white-space: nowrap; }

/* dashboard / tutor card */
.xt-ins-card { display: flex; flex-direction: column; }
.xt-ins-sum { flex: 1; }
.xt-ins-card .xt-ins-open { align-self: flex-start; margin-top: 12px; }
.xt-card-lead { font-size: .84rem; color: var(--ink-soft); margin: 0 0 8px; }
.xt-mini { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.xt-mini li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-radius: var(--r-md); border: 1px solid; }
.xt-mini li > span { display: grid; min-width: 0; }
.xt-mini strong { font-size: .88rem; font-weight: 600; }
.xt-mini small { font-size: .74rem; opacity: .85; }
.xt-mini b { font-family: var(--font-display); font-size: 1.1rem; }

/* ---------- times tables fluency */
.xt-mtc { display: flex; flex-direction: column; }
.xt-mtc > .btn { align-self: flex-start; margin-top: 12px; }
.xt-rank { display: flex; align-items: center; gap: 14px; }
.xt-rank strong { display: block; font-family: var(--font-display); font-size: 1.5rem; line-height: 1.15; }
.xt-rank small { color: var(--muted); font-size: .82rem; }
.xt-rank-badge { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-weight: 700; color: #fff; background: var(--violet); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .35); }
.xt-rank-badge.is-r0 { background: #6b7789; }
.xt-rank-badge.is-r1 { background: #2b6cb0; }
.xt-rank-badge.is-r2 { background: #1d5c63; }
.xt-rank-badge.is-r3 { background: #2d7a55; }
.xt-rank-badge.is-r4 { background: #b7791f; }
.xt-rank-badge.is-r5 { background: #1f3a68; }
.xt-ladder { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 3px; }
.xt-ladder li { font-size: .68rem; text-align: center; color: var(--muted); padding-top: 9px; position: relative; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xt-ladder li::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; border-radius: 3px; background: #e6eaf0; }
.xt-ladder li.is-past::before { background: #a9b8cf; }
.xt-ladder li.is-now { color: var(--ink); font-weight: 700; }
.xt-ladder li.is-now::before { background: var(--violet); }
.xt-mtc-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 14px 0 0; }
.xt-mtc-stats div { background: #f6f8fb; border-radius: var(--r-md); padding: 8px 10px; }
.xt-mtc-stats dt { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.xt-mtc-stats dd { margin: 2px 0 0; font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; }
.xt-mtc-aim { margin-top: 12px; font-size: .9rem; font-weight: 600; color: var(--violet); }

/* ---------- streak savers */
.xt-saver-row { display: flex; align-items: center; gap: 14px; }
.xt-saver-row p { color: var(--ink-soft); font-size: .88rem; margin: 0; }
.xt-shields { display: flex; gap: 4px; flex-shrink: 0; }
.xt-shield { width: 30px; height: 30px; fill: #eef1f5; stroke: #c3ccd8; stroke-width: 1.5; }
.xt-shield.is-on { fill: var(--violet); stroke: var(--violet); }
.xt-shield .xt-tick { fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.xt-saver-note { margin-top: 10px; font-size: .88rem; padding: 8px 12px; border-radius: var(--r-md); background: var(--go-soft); color: var(--go-deep); }

@media (max-width: 640px) {
  .xt-heat { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .xt-plot { height: 100px; }
  .xt-mtc-stats { grid-template-columns: 1fr 1fr; }
  .xt-table th, .xt-table td { padding: 6px; }
}
