:root {
  --ink: #14202e;
  --muted: #5d6a78;
  --line: #d9e1e7;
  --bg: #f6f8f7;
  --panel: #ffffff;
  --blue: #1769aa;
  --teal: #117b72;
  --red: #ba3f3f;
  --gold: #b37b22;
  --green: #2d7d46;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
}

.app-header {
  min-height: 280px;
  padding: 36px clamp(18px, 4vw, 56px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 28px;
  align-items: end;
  color: white;
  background:
    linear-gradient(120deg, rgba(10, 32, 54, .88), rgba(12, 84, 103, .70)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 380'%3E%3Crect width='1200' height='380' fill='%23161f2e'/%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.35' stroke-width='5'%3E%3Cpath d='M0 205h120l35-95 58 190 44-117h110l32-55 36 55h102l44-124 56 210 42-125h120l26 39h155l52-79 38 79h129'/%3E%3Cpath d='M0 265h160l20-35 26 35h170l25-42 35 42h280l30-48 35 48h420' opacity='.45'/%3E%3C/g%3E%3Cg fill='%23ffffff' fill-opacity='.22'%3E%3Ccircle cx='138' cy='110' r='8'/%3E%3Ccircle cx='258' cy='300' r='7'/%3E%3Ccircle cx='594' cy='60' r='9'/%3E%3Ccircle cx='880' cy='250' r='8'/%3E%3C/g%3E%3C/svg%3E") center/cover;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .78rem;
  font-weight: 800;
  color: var(--teal);
}

.app-header .eyebrow { color: #9ce5dc; }

h1, h2, h3 { line-height: 1.1; margin: 0; letter-spacing: 0; }
h1 { font-size: clamp(2.4rem, 6vw, 5.4rem); max-width: 900px; }
h2 { font-size: clamp(1.7rem, 3vw, 2.6rem); }
h3 { font-size: 1.05rem; margin-bottom: 10px; }
p { line-height: 1.6; color: var(--muted); }

.lede {
  max-width: 760px;
  color: #e9f7f5;
  font-size: 1.15rem;
}

.version-line {
  display: inline-block;
  margin: 10px 0 0;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 6px;
  color: #e9f7f5;
  background: rgba(255, 255, 255, .12);
  font-size: .9rem;
  font-weight: 800;
}

.progress-card {
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 8px;
  padding: 18px;
  backdrop-filter: blur(8px);
}

.progress-label { display: block; font-size: .85rem; color: #d8f5f0; }
.progress-card strong { display: block; font-size: 2.3rem; margin: 5px 0 12px; }
.meter { height: 10px; background: rgba(255,255,255,.25); border-radius: 999px; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: #8ce0a7; transition: width .25s ease; }
.mini-reset {
  width: 100%;
  margin-top: 12px;
  min-height: 36px;
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 6px;
  background: rgba(255,255,255,.16);
  color: white;
  font-weight: 800;
  cursor: pointer;
}
.mini-reset:hover { background: rgba(255,255,255,.25); }

.layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 24px;
  padding: 24px clamp(14px, 3vw, 40px);
}

.sidebar {
  position: sticky;
  top: 16px;
  align-self: start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.nav-link {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 13px 12px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
}

.nav-link:hover, .nav-link.active { background: #e8f3f2; color: #075a55; }

.content { min-width: 0; }
.panel {
  display: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(20px, 4vw, 42px);
  min-height: 620px;
}
.panel.active { display: block; }
.section-head { margin-bottom: 24px; }

.objective-grid, .cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.learner-panel {
  display: grid;
  grid-template-columns: minmax(0, .75fr) minmax(320px, 1fr);
  gap: 18px;
  align-items: end;
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: 8px;
  padding: 18px;
  background: #f8fbfd;
  margin-bottom: 22px;
}

.learner-fields {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  gap: 10px;
  align-items: end;
}

.learner-fields label {
  display: grid;
  gap: 6px;
  font-weight: 800;
  color: var(--ink);
}

.learner-fields span {
  font-size: .82rem;
}

.learner-fields input {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  font: inherit;
}

.learner-status {
  grid-column: 1 / -1;
  margin: 0;
  font-weight: 800;
  color: var(--teal);
}

.objective-grid div, .cards section, .callout, .knowledge-check {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fbfcfc;
}

.focus-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, .85fr);
  gap: 18px;
  margin: 22px 0;
  padding: 20px;
  border: 1px solid #c7d8df;
  border-left: 5px solid var(--blue);
  border-radius: 8px;
  background: #f3f8fb;
}

.focus-panel h3 { font-size: 1.35rem; }
.focus-panel p { margin-bottom: 0; }

.focus-list {
  display: grid;
  gap: 10px;
}

.focus-list div {
  padding: 12px;
  border: 1px solid #d7e5eb;
  border-radius: 8px;
  background: white;
}

.focus-list span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.focus-list strong {
  display: block;
  color: var(--ink);
  line-height: 1.35;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 24px 0;
}

.summary-grid section {
  border: 1px solid var(--line);
  border-left: 5px solid var(--teal);
  border-radius: 8px;
  padding: 18px;
  background: #fbfcfc;
}

.infographic-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 24px 0;
}

.infographic-grid section {
  min-height: 210px;
  border: 1px solid var(--line);
  border-top: 6px solid var(--blue);
  border-radius: 8px;
  padding: 16px;
  background: #fbfcfc;
  break-inside: avoid;
}

.infographic-grid span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  margin-bottom: 12px;
  background: var(--blue);
  color: white;
  font-weight: 900;
}

.flashcard-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  margin: 22px 0 14px;
}

.flashcard {
  display: grid;
  gap: 16px;
  place-items: center;
  width: min(760px, 100%);
  min-height: 280px;
  margin: 0 auto 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(22px, 5vw, 48px);
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  cursor: pointer;
  text-align: center;
}

.flashcard span {
  text-transform: uppercase;
  font-size: .78rem;
  font-weight: 900;
  color: #c9f2ed;
}

.flashcard b {
  max-width: 680px;
  font-size: clamp(1.3rem, 3vw, 2rem);
  line-height: 1.25;
}

.source-list {
  display: grid;
  gap: 12px;
  margin: 24px 0;
}

.source-list section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfcfc;
}

.source-list span {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--teal);
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.source-list a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 6px;
  padding: 0 16px;
  color: white;
  background: var(--blue);
  font-weight: 900;
  text-decoration: none;
}

.feedback-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: 8px;
  padding: 18px;
  background: #f8fbfd;
  margin-bottom: 22px;
}

.feedback-panel label {
  display: grid;
  gap: 6px;
  font-weight: 800;
  color: var(--ink);
}

.feedback-panel span {
  font-size: .82rem;
}

.feedback-panel input,
.feedback-panel select,
.feedback-panel textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: white;
}

.feedback-wide,
.feedback-actions,
.feedback-panel .learner-status {
  grid-column: 1 / -1;
}

.feedback-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.callout {
  margin: 22px 0;
  border-left: 5px solid var(--teal);
  color: var(--muted);
  line-height: 1.55;
}

.course-map {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 24px 0;
}

.course-map div {
  border-top: 4px solid var(--blue);
  padding: 12px;
  background: #edf4fa;
  min-height: 120px;
}
.course-map span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--blue);
  color: white;
  font-weight: 800;
  margin-bottom: 10px;
}
.course-map b, .course-map small { display: block; }
.course-map small { color: var(--muted); line-height: 1.35; margin-top: 6px; }

.primary, .secondary {
  border: 0;
  border-radius: 6px;
  min-height: 44px;
  padding: 0 18px;
  font-weight: 800;
  cursor: pointer;
}
.primary { background: var(--blue); color: white; }
.secondary { background: #e7edf1; color: var(--ink); }
.primary:hover { background: #0f568c; }
.secondary:hover { background: #d8e1e7; }

.split, .two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, .8fr);
  gap: 24px;
  align-items: start;
}

.check-list {
  padding: 0;
  margin: 18px 0;
  list-style: none;
}
.check-list li {
  position: relative;
  padding-left: 28px;
  margin: 12px 0;
  color: var(--muted);
  line-height: 1.5;
}
.check-list li:before {
  content: "";
  position: absolute;
  left: 0;
  top: .38em;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: inset 0 0 0 4px white;
  border: 1px solid var(--teal);
}

.infographic {
  border-radius: 8px;
  padding: 20px;
  border: 1px solid var(--line);
  background: #f2f8f7;
}
.rings {
  position: relative;
  min-height: 320px;
  display: grid;
  place-items: center;
}
.rings strong {
  display: grid;
  place-items: center;
  width: 124px;
  height: 124px;
  border-radius: 50%;
  background: var(--teal);
  color: white;
  text-align: center;
  padding: 14px;
}
.rings span {
  position: absolute;
  display: grid;
  place-items: center;
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: white;
  border: 2px solid #79bbb4;
  font-weight: 800;
  color: #0d615b;
}
.rings span:nth-child(1) { top: 6px; left: calc(50% - 59px); }
.rings span:nth-child(2) { top: 118px; right: 4px; }
.rings span:nth-child(3) { bottom: 8px; left: calc(50% - 59px); }
.rings span:nth-child(4) { top: 118px; left: 4px; }

.knowledge-check { margin-top: 24px; }
.knowledge-check button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px;
  margin: 8px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  cursor: pointer;
}
.knowledge-check button.correct { border-color: var(--green); background: #eef8f0; }
.knowledge-check button.wrong { border-color: var(--red); background: #fff0f0; }
.feedback { font-weight: 800; }

.chain, .flow, .return-play {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 24px 0;
}
.chain div, .flow div, .return-play div {
  min-height: 150px;
  border-radius: 8px;
  padding: 16px;
  color: white;
  background: var(--blue);
}
.chain div:nth-child(2), .flow div:nth-child(2), .return-play div:nth-child(2) { background: var(--teal); }
.chain div:nth-child(3), .flow div:nth-child(3), .return-play div:nth-child(3) { background: var(--gold); }
.chain div:nth-child(4), .flow div:nth-child(4), .return-play div:nth-child(4) { background: var(--red); }
.chain div:nth-child(5), .flow div:nth-child(5), .return-play div:nth-child(5) { background: #49586a; }
.chain b, .flow strong, .return-play strong { display: block; margin-bottom: 10px; }
.chain span, .flow span, .return-play span { font-size: .92rem; line-height: 1.4; color: rgba(255,255,255,.92); }

.matrix {
  display: grid;
  grid-template-columns: 1fr 1fr 1.1fr;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin-top: 24px;
}
.matrix div { padding: 14px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); color: var(--muted); }
.matrix div:nth-child(3n) { border-right: 0; }
.matrix .matrix-head { background: #e8f3f2; color: #0d615b; font-weight: 900; }

.cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cards section { min-height: 150px; }

.risk-scale {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 24px 0;
  color: white;
  font-weight: 900;
}
.risk-scale div {
  min-width: 0;
  min-height: 120px;
  border-radius: 8px;
  padding: 16px;
  background: var(--green);
  overflow-wrap: anywhere;
}
.risk-scale div:nth-child(2) { background: var(--teal); }
.risk-scale div:nth-child(3) { background: var(--gold); }
.risk-scale div:nth-child(4) { background: var(--red); }
.risk-scale span {
  display: block;
  margin-bottom: 8px;
  font-size: .82rem;
  line-height: 1.3;
  color: rgba(255,255,255,.88);
}
.risk-scale b {
  display: block;
  font-size: clamp(1rem, 2vw, 1.25rem);
  line-height: 1.2;
}

.exam-form { display: grid; gap: 18px; margin-top: 20px; }
.question {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fbfcfc;
}
.question legend { font-weight: 900; margin-bottom: 10px; }
.question label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 0;
  color: var(--muted);
  line-height: 1.45;
}
.question.correct { border-color: var(--green); }
.question.incorrect { border-color: var(--red); }
.rationale {
  margin: 12px 0 0;
  padding: 12px;
  border-radius: 6px;
  background: #eef4f8;
  color: var(--ink);
}
.exam-actions { display: flex; gap: 10px; margin: 20px 0; }
.result {
  display: none;
  padding: 18px;
  border-radius: 8px;
  background: #e8f3f2;
  border: 1px solid #a7d2cc;
  font-weight: 900;
}

.credential {
  display: none;
  margin-top: 20px;
  border: 2px solid var(--blue);
  border-radius: 8px;
  padding: 32px;
  text-align: center;
  background: #fff;
}

.credential strong {
  display: block;
  font-size: clamp(1.8rem, 5vw, 3rem);
  margin: 10px 0;
  color: var(--blue);
}

.credential-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 24px;
}

.credential-grid span {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.credential-grid b {
  color: var(--muted);
  font-size: .8rem;
  text-transform: uppercase;
}

.credential-grid em {
  font-style: normal;
  font-weight: 900;
}

.records {
  margin-top: 28px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.records-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.records-table-wrap {
  overflow-x: auto;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

th, td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  background: #e8f3f2;
  color: #0d615b;
}

footer {
  padding: 24px clamp(18px, 4vw, 56px) 40px;
  color: var(--muted);
  font-size: .9rem;
}

@media (max-width: 980px) {
  .app-header, .layout, .split, .two-col { grid-template-columns: 1fr; }
  .sidebar { position: static; display: grid; grid-template-columns: repeat(2, 1fr); }
  .objective-grid, .summary-grid, .infographic-grid, .course-map, .chain, .flow, .return-play, .risk-scale, .learner-panel, .learner-fields, .focus-panel { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .app-header { min-height: 360px; align-items: end; }
  .sidebar, .objective-grid, .summary-grid, .infographic-grid, .course-map, .chain, .flow, .return-play, .cards, .risk-scale, .matrix, .learner-panel, .learner-fields, .credential-grid, .source-list section, .feedback-panel, .focus-panel {
    grid-template-columns: 1fr;
  }
  .matrix div { border-right: 0; }
  .panel { min-height: auto; }
  .rings { min-height: 420px; }
  .rings span:nth-child(1) { top: 0; left: calc(50% - 59px); }
  .rings span:nth-child(2) { top: 102px; right: calc(50% - 59px); transform: translateX(88px); }
  .rings span:nth-child(3) { bottom: 0; left: calc(50% - 59px); }
  .rings span:nth-child(4) { top: 102px; left: calc(50% - 59px); transform: translateX(-88px); }
}

@media print {
  body { background: white; }
  .app-header, .layout > .sidebar, .panel, .exam-form, .exam-actions, #examResult, .records, footer {
    display: none !important;
  }
  .layout { display: block; padding: 0; }
  body.print-credential #exam,
  body.print-credential .credential,
  body.print-infographics #infographics {
    display: block !important;
  }
  .content, .panel, #exam, #infographics, .credential {
    border: 0;
    min-height: 0;
    padding: 0;
  }
  body.print-credential .section-head { display: none; }
  #printCredential,
  #printInfographics,
  #infographics .next-panel {
    display: none !important;
  }
  .infographic-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
  .infographic-grid section {
    min-height: 190px;
    page-break-inside: avoid;
  }
  .credential {
    margin: 1in auto;
    padding: .75in;
    width: 100%;
    border: 3px solid #1769aa;
  }
}


/* Preserve infographic colors when printing from Chrome/Safari/Edge. The print dialog may still need Background graphics enabled. */
* {
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
@media print {
  body, .infographic-grid section, .risk-scale div, .chain div, .flow div, .return-play div, .course-map span, .course-map em {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}
