/* Training area and the public certificate page. Uses the TRACE tokens from trace.css. */
body.training-body { overflow: auto; display: block; height: auto; min-height: 100%; }
.topbar .spacer { flex: 1; }
.tr-open-trace { background: transparent; color: #fff; border-color: rgba(255,255,255,.3); text-decoration: none; }
.tr-open-trace:hover { background: rgba(255,255,255,.1); }

.tr-wrap { max-width: 860px; margin: 0 auto; padding: 28px 16px 64px; outline: none; }
.tr-loading { color: var(--muted); text-align: center; padding: 48px 0; }
.tr-head { margin-bottom: 20px; }
.tr-eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin: 0 0 6px; }
.tr-head h1 { font-size: 26px; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 8px; }
.tr-sub { color: var(--muted); font-size: 15px; line-height: 1.55; margin: 0; max-width: 62ch; }
.tr-back { display: inline-block; margin-bottom: 16px; font-size: 13.5px; }

.tr-card { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 20px 22px; margin-bottom: 16px; }
.tr-card h2 { font-size: 17px; margin: 0 0 6px; }
.tr-card p { color: var(--muted); line-height: 1.55; margin: 0 0 12px; }
.tr-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tr-field { display: block; font-size: 13px; font-weight: 600; margin-bottom: 14px; }
.tr-field input[type="text"], .tr-field input[type="email"] { display: block; width: 100%; height: 40px; margin-top: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; font: inherit; font-weight: 400; background: var(--bg); color: var(--ink); }
.tr-field input[readonly] { background: var(--bg-alt); color: var(--muted); }
.tr-field input:focus-visible, .tr-answer input:focus-visible { outline: 2px solid var(--logo-accent); outline-offset: 1px; border-color: transparent; }
.tr-msg { font-size: 13.5px; border-radius: 8px; padding: 9px 12px; margin: 12px 0 0 !important; color: var(--ink) !important; }
.tr-msg.error { border: 1px solid var(--bad); background: var(--bad-soft); }
.tr-msg.ok { border: 1px solid var(--ok); background: var(--ok-soft); }
.tr-msg.hint { border: 1px solid var(--c-high); background: var(--warn-soft); }
/* The exam start page for a test account. */
.tr-test-banner { font-weight: 700; color: #b91c1c; margin: 0 0 14px; }
/* The optional feedback form after an exam result. */
.tr-feedback .tr-fb { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
.tr-feedback legend { font-size: 13px; font-weight: 600; padding: 0; margin-bottom: 8px; }
.tr-feedback .tr-rating { display: flex; gap: 8px; flex-wrap: wrap; }
.tr-feedback .tr-rating .tr-option { padding: 8px 14px; align-items: center; }
.tr-feedback select, .tr-feedback textarea { display: block; width: 100%; margin-top: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; font: inherit; font-weight: 400; background: var(--bg); color: var(--ink); }
.tr-feedback textarea { resize: vertical; min-height: 96px; }
.tr-feedback .tr-note { display: block; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.tr-feedback .tr-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Module list */
.tr-modules { list-style: none; margin: 0 0 16px; padding: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.tr-modules li + li { border-top: 1px solid var(--line); }
.tr-mod { display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px 20px; background: none; border: 0; text-align: left; color: inherit; text-decoration: none; }
a.tr-mod:hover { background: var(--hover); }
a.tr-mod:focus-visible { outline: 2px solid var(--logo-accent); outline-offset: -2px; }
.tr-dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; border: 1.5px solid var(--line); color: var(--faint); }
.tr-dot .i { width: 15px; height: 15px; stroke-width: 2; }
.tr-mod[data-state="complete"] .tr-dot { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.tr-mod[data-state="open"] .tr-dot { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.tr-mod-text { flex: 1; min-width: 0; }
.tr-mod-title { font-weight: 600; font-size: 15px; }
.tr-mod[data-state="locked"] .tr-mod-title, .tr-mod[data-state="soon"] .tr-mod-title { color: var(--muted); font-weight: 500; }
.tr-mod-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.tr-tag { font-size: 12px; font-weight: 600; border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.tr-tag.complete { background: var(--ok-soft); color: var(--ok); }
.tr-tag.open { background: var(--accent-soft); color: var(--accent-dark); }
.tr-tag.locked, .tr-tag.soon { background: var(--hover); color: var(--muted); }
.tr-tag.free { background: var(--c-exchange-soft); color: var(--c-exchange); margin-left: 8px; }

.tr-exam-card, .tr-buy, .tr-cert { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.tr-exam-card > div, .tr-buy > div, .tr-cert > div { flex: 1; min-width: 240px; }
.tr-exam-card p, .tr-buy p, .tr-cert p { margin: 0; }
.tr-cert { border-color: var(--ok); background: var(--ok-soft); }
.tr-cert p { color: var(--ink); }
.tr-cert .tr-consent { flex: 1 0 100%; min-width: 0; border-top: 1px solid var(--line, rgba(0,0,0,.12)); padding-top: 12px; }
.tr-cert .tr-consent .tr-check { margin-bottom: 4px; }
.tr-cert .tr-note { font-size: 13px; margin: 0 0 0 26px; }
.tr-cert .tr-actions { display: flex; gap: 8px; flex-wrap: wrap; flex: none; min-width: 0; }
/* A test account's certificate: a diagonal SAMPLE across the card and a plain line saying what it is. */
.tr-cert.is-test { position: relative; overflow: hidden; }
.tr-cert.is-test::after { content: "SAMPLE"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  transform: rotate(-12deg); font-size: clamp(48px, 14vw, 96px); font-weight: 800; letter-spacing: .08em; color: #b91c1c; opacity: .18; pointer-events: none; }
.tr-cert .tr-test-note { font-weight: 700; color: #b91c1c; }
a.btn { text-decoration: none; }

/* Lesson text */
.tr-lesson { padding: 26px 30px; font-size: 15.5px; line-height: 1.7; }
.tr-lesson h2 { font-size: 20px; letter-spacing: -0.01em; margin: 30px 0 10px; }
.tr-lesson h2:first-child { margin-top: 0; }
.tr-lesson h3 { font-size: 16.5px; margin: 26px 0 8px; }
.tr-lesson h4, .tr-lesson h5 { font-size: 15px; margin: 20px 0 6px; }
.tr-lesson p { color: var(--ink); margin: 0 0 14px; max-width: 70ch; }
.tr-lesson ul, .tr-lesson ol { margin: 0 0 14px; padding-left: 24px; max-width: 70ch; }
.tr-lesson li { margin-bottom: 4px; }
.tr-lesson code { font-family: var(--mono); font-size: 13.5px; background: var(--bg-alt); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; overflow-wrap: anywhere; }
.tr-lesson img { display: block; max-width: 100%; height: auto; margin: 4px 0 14px; border-radius: 6px; }
.tr-lesson .table-wrap { overflow-x: auto; margin: 0 0 16px; border: 1px solid var(--line); border-radius: 8px; }
.tr-lesson table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.45; }
.tr-lesson th, .tr-lesson td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.tr-lesson tr:last-child td { border-bottom: 0; }
.tr-lesson th { background: var(--bg-alt); font-size: 12.5px; color: var(--muted); }
.tr-video video { width: 100%; border-radius: 12px; background: #000; margin-bottom: 16px; display: block; }

/* Lab */
.tr-wallet { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--bg-alt); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.tr-wallet .mono { overflow-wrap: anywhere; flex: 1; min-width: 200px; font-size: 13px; }
.tr-wallet .btn { height: 30px; font-size: 12.5px; padding: 0 10px; }
.tr-task { border-top: 1px solid var(--line); padding: 18px 0 4px; margin-top: 14px; }
.tr-task-n { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.tr-task-q { font-weight: 600; font-size: 15px; line-height: 1.5; margin: 0 0 12px; color: var(--ink) !important; }
.tr-options { display: grid; gap: 8px; margin: 0 0 12px; padding: 0; border: 0; }
.tr-option { display: flex; align-items: flex-start; gap: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; cursor: pointer; line-height: 1.45; }
.tr-option:hover { background: var(--hover); }
.tr-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.tr-option:has(input:focus-visible) { outline: 2px solid var(--logo-accent); outline-offset: 1px; }
.tr-option input { margin: 3px 0 0; accent-color: var(--accent); flex: none; }
.tr-answer { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.tr-answer input { flex: 1; min-width: 220px; height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; font: inherit; background: var(--bg); color: var(--ink); }
.tr-answer input.mono { font-family: var(--mono); font-size: 13px; }
.tr-done { color: var(--ok); font-weight: 600; font-size: 13.5px; }
.tr-complete { border: 1px solid var(--ok); background: var(--ok-soft); border-radius: 10px; padding: 14px 16px; margin-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tr-complete b { color: var(--ink); }

/* Exam */
.tr-rules { margin: 0 0 14px; padding-left: 20px; color: var(--ink); line-height: 1.7; }
.tr-check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.5; margin-bottom: 16px; }
.tr-check input { margin-top: 3px; accent-color: var(--accent); }
.tr-q { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; margin-bottom: 12px; }
.tr-q legend, .tr-q .tr-task-q { font-weight: 600; font-size: 15px; line-height: 1.5; padding: 0; margin-bottom: 12px; }
.tr-q fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.tr-q .tr-task-n { margin-bottom: 6px; }
.tr-results { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 4px; }
.tr-results th, .tr-results td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
.tr-results th { font-size: 12px; color: var(--muted); }
.tr-timer { position: fixed; top: 70px; right: 16px; z-index: 40; background: var(--navy); color: #fff; border-radius: 999px; padding: 8px 16px; font: 600 14px var(--mono); box-shadow: var(--shadow); }
.tr-timer.low { background: var(--c-sanctioned); }
.tr-submit-bar { position: sticky; bottom: 0; background: var(--bg-alt); border-top: 1px solid var(--line); padding: 14px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.tr-submit-bar span { color: var(--muted); font-size: 13.5px; }
.tr-foot { color: var(--muted); font-size: 12.5px; line-height: 1.6; margin: 28px 0 0; max-width: 70ch; }

/* Public certificate page */
.vf-wrap { max-width: 620px; margin: 0 auto; padding: 36px 16px 64px; }
.vf-card { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 28px 30px; margin-bottom: 16px; }
.vf-status { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; border-radius: 999px; padding: 6px 14px; margin-bottom: 18px; }
.vf-status.valid { background: var(--ok-soft); color: var(--ok); }
.vf-status.expired { background: var(--warn-soft); color: var(--warn); }
.vf-status.revoked { background: var(--bad-soft); color: var(--bad); }
.vf-name { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; margin: 0 0 6px; overflow-wrap: anywhere; }
.vf-title { font-size: 16px; color: var(--accent); font-weight: 600; margin: 0 0 22px; }
.vf-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 0; border-top: 1px solid var(--line); padding-top: 18px; }
.vf-facts dt { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.vf-facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.vf-form { display: flex; gap: 8px; flex-wrap: wrap; }
.vf-form input { flex: 1; min-width: 220px; height: 42px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; font: 14px var(--mono); background: var(--bg); color: var(--ink); text-transform: uppercase; }
.vf-form input:focus-visible { outline: 2px solid var(--logo-accent); outline-offset: 1px; border-color: transparent; }
.vf-note { color: var(--muted); font-size: 13px; line-height: 1.6; }

@media (max-width: 640px) {
  .tr-row, .vf-facts { grid-template-columns: 1fr; }
  .tr-lesson { padding: 20px 18px; font-size: 15px; }
  .tr-head h1 { font-size: 22px; }
  .tr-mod { padding: 14px 14px; gap: 10px; }
  .tr-timer { top: auto; bottom: 76px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
