/* Standalone CBRN study surface. Long readings and enlarged text remain scrollable. */
.jcbrn-study {
  --jcbrn-navy: #0a2235;
  --jcbrn-ink: #183446;
  --jcbrn-muted: #587081;
  --jcbrn-olive: #5d7040;
  --jcbrn-cyan: #24d8db;
  --jcbrn-teal: #087580;
  --jcbrn-line: #d5e2e7;
  --jcbrn-paper: #f3f7f8;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  min-height: 100vh;
  min-height: 100svh;
  isolation: isolate;
  color: var(--jcbrn-ink);
  background: var(--jcbrn-paper);
  font: inherit;
  font-family: JCInter, Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  overflow-wrap: anywhere;
  -webkit-text-size-adjust: 100%;
}

.jcbrn-study *, .jcbrn-study *::before, .jcbrn-study *::after { box-sizing: border-box; }
.jcbrn-study button { font: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.jcbrn-study button:disabled { cursor: default; }
.jcbrn-study [hidden] { display: none !important; }
.jcbrn-study :where(button, a, summary):focus-visible { outline: 3px solid var(--jcbrn-teal); outline-offset: 4px; }
.jcbrn-study :where(h1, h2, h3)[tabindex="-1"]:focus { outline: none; box-shadow: none; }
.jcbrn-study :where(button, a, summary, h1, h2, h3) { scroll-margin-block: 100px 100px; }

/* The sticky chrome stays in document flow, leaving every control reachable. */
.jcbrn-top {
  position: sticky;
  top: 0;
  z-index: 15;
  flex: 0 0 auto;
  padding-top: env(safe-area-inset-top, 0px);
  border-bottom: 1px solid var(--jcbrn-line);
  background: rgba(247, 250, 251, .98);
  backdrop-filter: blur(14px);
}
.jcbrn-top-inner { display: flex; align-items: center; gap: 16px; max-width: 980px; margin: auto; padding: 14px 26px; }
.jcbrn-exit { display: inline-flex; align-items: center; justify-content: center; gap: 7px; flex: 0 0 auto; min-width: 44px; min-height: 44px; padding: 9px 12px; border: 1px solid #cbdde5; border-radius: 13px; background: #fff; color: #315568; font-size: .81rem !important; font-weight: 750 !important; line-height: 1.3; }
.jcbrn-route { flex: 1; min-width: 0; }
.jcbrn-route small { display: block; color: var(--jcbrn-teal); font-size: .64rem; font-weight: 850; letter-spacing: .1em; line-height: 1.4; }
.jcbrn-route h1 { margin: 4px 0 0; font-size: 1.08rem; font-weight: 800; line-height: 1.25; letter-spacing: -.025em; }
.jcbrn-counter { flex: 0 0 auto; max-width: 108px; color: var(--jcbrn-muted); font-size: .76rem; font-weight: 750; line-height: 1.35; text-align: right; font-variant-numeric: tabular-nums; }
.jcbrn-track { height: 4px; background: #e0e9e9; }
.jcbrn-track > span { display: block; height: 100%; max-width: 100%; background: linear-gradient(90deg, #577445, #087b82 55%, #24d8db); transition: width .18s ease; }

.jcbrn-body { flex: 1 0 auto; width: 100%; min-width: 0; max-width: 780px; margin: 0 auto; padding: 30px 28px 28px; }
.jcbrn-kicker { display: block; margin: 0 0 7px; color: var(--jcbrn-teal); font-size: .66rem; font-weight: 850; line-height: 1.5; letter-spacing: .1em; text-transform: uppercase; }
.jcbrn-heading { margin: 0 0 14px; color: var(--jcbrn-navy); font-size: clamp(1.6rem, 3.5vw, 2.15rem); font-weight: 800; line-height: 1.18; letter-spacing: -.04em; text-wrap: pretty; }
.jcbrn-lead { max-width: 630px; margin: 0 0 22px; color: var(--jcbrn-muted); font-size: .94rem; line-height: 1.7; }
.jcbrn-tiles { display: flex; align-items: center; gap: 7px; margin: 0 0 21px; }
.jcbrn-tiles > span { display: grid; place-items: center; width: 43px; height: 43px; border: 1px solid #243e50; border-radius: 13px; color: #fff; background: var(--jcbrn-navy); font-size: 1.02rem; font-weight: 850; line-height: 1; }
.jcbrn-tiles > span:nth-child(2) { background: var(--jcbrn-olive); border-color: var(--jcbrn-olive); }
.jcbrn-tiles > span:nth-child(3) { background: #dceae2; border-color: #c6d8cc; color: #385642; }
.jcbrn-tiles > span:nth-child(4) { background: #c2f3f2; border-color: #9fe2e3; color: #075561; }

/* Overview cards expose a clear next step without looking like a dashboard. */
.jcbrn-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 23px 0; }
.jcbrn-lesson { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-width: 0; min-height: 110px; padding: 17px 15px; border: 1px solid var(--jcbrn-line); border-radius: 18px; background: #fff; color: var(--jcbrn-ink); text-align: left; box-shadow: 0 5px 18px rgba(17, 43, 59, .025); }
.jcbrn-number { display: grid; place-items: center; width: 36px; min-height: 36px; padding: 5px; border-radius: 11px; background: #eaf0e2; color: #506338; font-size: .8rem; font-weight: 850; font-variant-numeric: tabular-nums; }
.jcbrn-lesson > div, .jcbrn-lesson > span { min-width: 0; }
.jcbrn-lesson strong { display: block; font-size: .92rem; font-weight: 800; line-height: 1.35; letter-spacing: -.015em; }
.jcbrn-lesson small { display: block; margin-top: 5px; color: var(--jcbrn-muted); font-size: .73rem; line-height: 1.5; }
.jcbrn-lesson-status { display: block; margin-top: 5px; color: var(--jcbrn-teal); font-size: .69rem; font-weight: 800; line-height: 1.4; }
.jcbrn-lesson.is-complete, .jcbrn-lesson.is-done { border-color: #b6d7c7; background: #fbfefc; }
.jcbrn-lesson:is(.is-complete, .is-done) .jcbrn-number { color: #2b664a; background: #dff1e7; }
.jcbrn-continue { display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: 16px 19px; text-align: left; }
.jcbrn-continue small { font-size: .76rem; font-weight: 600; opacity: .85; }
.jcbrn-groups { display: grid; gap: 9px; margin-top: 22px; }
.jcbrn-group { min-width: 0; border: 1px solid var(--jcbrn-line); border-radius: 14px; background: #fff; }
.jcbrn-group > summary { min-height: 54px; padding: 15px 17px; color: var(--jcbrn-navy); font-size: .9rem; font-weight: 800; cursor: pointer; }
.jcbrn-group > summary small { margin-left: 10px; color: var(--jcbrn-muted); font-size: .73rem; font-weight: 600; }
.jcbrn-group .jcbrn-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; margin: 0; }
.jcbrn-group .jcbrn-lesson { min-height: 76px; border: 0; border-top: 1px solid var(--jcbrn-line); border-radius: 0; box-shadow: none; padding: 12px 15px; background: transparent; }
.jcbrn-group .jcbrn-lesson:last-child { border-radius: 0 0 14px 14px; }
.jcbrn-scope { margin-top: 14px; color: var(--jcbrn-muted); font-size: .75rem; }
.jcbrn-scope > summary { min-height: 44px; padding: 11px 2px; cursor: pointer; }
.jcbrn-scope .jcbrn-boundary { margin-top: 0; }

/* Reading pages intentionally have no fixed height or clipped text. */
.jcbrn-reading { padding: 25px 27px; border: 1px solid var(--jcbrn-line); border-radius: 22px; background: #fff; box-shadow: 0 8px 24px rgba(17, 43, 59, .025); }
.jcbrn-reading h2 { margin: 0 0 17px; color: var(--jcbrn-navy); font-size: clamp(1.5rem, 3.4vw, 1.95rem); line-height: 1.2; letter-spacing: -.035em; }
.jcbrn-text { color: #3e596a; font-size: .96rem; line-height: 1.8; }
.jcbrn-text p { margin: 0 0 16px; }
.jcbrn-text p:last-child { margin-bottom: 0; }
.jcbrn-text strong { color: var(--jcbrn-ink); font-weight: 750; }
.jcbrn-illustration { width: 100%; min-width: 0; margin: 14px 0; text-align: center; }
.jcbrn-illustration img { display: block; width: auto; height: auto; max-width: 100%; max-height: 120px; margin: 0 auto; object-fit: contain; }
.jcbrn-illustration figcaption, .jcbrn-credit { margin: 7px 0 0; color: var(--jcbrn-muted); font-size: .7rem; line-height: 1.5; overflow-wrap: anywhere; }
.jcbrn-feedback .jcbrn-credit { margin-top: 7px; font-size: .7rem; }
.jcbrn-takeaways { margin: 21px 0 0; padding: 16px 18px; border: 1px solid #d7e2cd; border-left: 3px solid #718650; border-radius: 0 14px 14px 0; background: #f2f6eb; color: #3d5535; font-size: .88rem; line-height: 1.65; }
.jcbrn-takeaways > strong, .jcbrn-takeaways h3 { display: block; margin: 0 0 8px; font-size: .87rem; font-weight: 800; }
.jcbrn-takeaways ul { margin: 0; padding-left: 20px; }
.jcbrn-takeaways li + li { margin-top: 6px; }
ul.jcbrn-takeaways { padding-left: 35px; }

/* Question, all four choices, and short feedback fit ordinary phone viewports. */
.jcbrn-question { min-width: 0; padding: 25px; border: 1px solid var(--jcbrn-line); border-radius: 22px; background: #fff; box-shadow: 0 8px 24px rgba(17, 43, 59, .025); }
.jcbrn-question .jcbrn-heading { font-size: clamp(1.4rem, 3.1vw, 1.85rem); line-height: 1.25; }
.jcbrn-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 20px; }
.jcbrn-option { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 84px; padding: 13px; border: 1px solid #cddde4; border-radius: 14px; color: var(--jcbrn-ink); background: #fbfdfe; font-size: .88rem !important; font-weight: 700 !important; line-height: 1.45; text-align: left; }
.jcbrn-option > span:not(.jcbrn-letter):not(.jcbrn-option-state) { flex: 1; min-width: 0; }
.jcbrn-letter { display: grid; place-items: center; flex: 0 0 25px; width: 25px; min-height: 27px; border-radius: 8px; color: #536f81; background: #e9f0f4; font-size: .68rem; font-weight: 850; line-height: 1; }
.jcbrn-option-state { flex: 0 0 auto; font-size: 1rem; font-weight: 850; line-height: 1; }
.jcbrn-option-state:empty { display: none; }
.jcbrn-option.is-correct { border-color: #7db498; color: #245e43; background: #e8f5ed; }
.jcbrn-option.is-correct .jcbrn-letter { color: #245e43; background: #cfe8d9; }
.jcbrn-option.is-wrong { border-color: #ce9c89; color: #843f2b; background: #fff1e9; }
.jcbrn-option.is-wrong .jcbrn-letter { color: #843f2b; background: #f6dccc; }
.jcbrn-study .jcbrn-option:disabled { opacity: 1; }
.jcbrn-option:disabled:not(.is-correct):not(.is-wrong) { color: #687d8a; background: #f4f7f8; }
.jcbrn-feedback { margin-top: 14px; padding: 14px 16px; border: 1px solid #c5ddd1; border-radius: 13px; color: #2c5d47; background: #eaf5ee; font-size: .84rem; line-height: 1.55; }
.jcbrn-feedback:empty { display: none; }
.jcbrn-feedback strong { display: block; font-size: .88rem; font-weight: 800; }
.jcbrn-feedback p { margin: 4px 0 0; }
.jcbrn-feedback.is-wrong { color: #7b4933; border-color: #ead2c0; background: #fff4e9; }
.jcbrn-prompt { margin: 13px 0 0; color: var(--jcbrn-muted); font-size: .8rem; line-height: 1.5; }

.jcbrn-bottom { position: sticky; bottom: 0; z-index: 12; flex: 0 0 auto; width: 100%; margin-top: auto; padding: 12px 25px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--jcbrn-line); background: rgba(247, 250, 251, .98); box-shadow: 0 -6px 22px rgba(17, 43, 59, .025); backdrop-filter: blur(14px); }
.jcbrn-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; width: 100%; max-width: 724px; margin: 0 auto; }
.jcbrn-primary, .jcbrn-secondary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 0; min-height: 48px; padding: 11px 20px; border: 1px solid transparent; border-radius: 13px; font-size: .84rem !important; font-weight: 800 !important; line-height: 1.4; text-align: center; }
.jcbrn-primary { min-width: 180px; color: #07323b; border-color: #16c6cd; background: var(--jcbrn-cyan); box-shadow: 0 5px 13px rgba(21, 178, 185, .09); }
.jcbrn-secondary { color: #3c5b6f; border-color: #cbdce4; background: #fff; }
.jcbrn-primary:disabled, .jcbrn-secondary:disabled { opacity: .55; box-shadow: none; }
.jcbrn-actions > .jcbrn-prompt { flex: 1; margin: 0; text-align: center; }

.jcbrn-result { text-align: center; }
.jcbrn-result .jcbrn-lead { margin-inline: auto; }
.jcbrn-score { width: max-content; max-width: 100%; margin: 24px auto; padding: 20px 31px; border: 1px solid #cbdedc; border-radius: 21px; color: var(--jcbrn-navy); background: #fff; }
.jcbrn-score strong { display: block; font-size: 2.6rem; font-weight: 850; line-height: 1.15; letter-spacing: -.055em; font-variant-numeric: tabular-nums; }
.jcbrn-score span { display: block; margin-top: 6px; color: var(--jcbrn-muted); font-size: .78rem; line-height: 1.45; }
.jcbrn-mistakes { display: grid; gap: 11px; margin-top: 23px; text-align: left; }
.jcbrn-mistakes article { min-width: 0; padding: 18px 20px; border: 1px solid var(--jcbrn-line); border-radius: 16px; background: #fff; }
.jcbrn-mistakes h3 { margin: 0 0 7px; color: var(--jcbrn-ink); font-size: .99rem; line-height: 1.4; letter-spacing: -.015em; }
.jcbrn-mistakes p { margin: 0; color: var(--jcbrn-muted); font-size: .84rem; line-height: 1.65; }
.jcbrn-mistakes p + p { margin-top: 7px; }
.jcbrn-boundary { margin: 22px 0 0; padding: 12px 15px; border-left: 2px solid #9bb0b9; color: #526c7d; background: #eaf1f3; border-radius: 0 11px 11px 0; font-size: .75rem; line-height: 1.65; text-align: left; }
.jcbrn-sources { margin-top: 16px; color: var(--jcbrn-muted); font-size: .75rem; line-height: 1.65; text-align: left; }
.jcbrn-sources summary { min-height: 44px; padding: 11px 2px; cursor: pointer; font-weight: 750; }
.jcbrn-sources ul { margin: 7px 0 10px; padding-left: 20px; }
.jcbrn-sources li + li { margin-top: 8px; }
.jcbrn-sources a { color: #076b77; text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }

@media (hover: hover) {
  .jcbrn-exit:hover, .jcbrn-secondary:not(:disabled):hover { background: #eaf3f6; border-color: #a9c6d2; }
  .jcbrn-primary:not(:disabled):hover { background: #54e5e6; }
  .jcbrn-lesson:not(:disabled):hover { border-color: #88b8c2; background: #f8fcfc; }
  .jcbrn-option:not(:disabled):hover { border-color: #6eabb7; background: #f0f9fa; }
}

@media (max-width: 600px) {
  .jcbrn-top-inner { gap: 10px; padding: 10px 13px; }
  .jcbrn-exit { padding: 8px 10px; font-size: .74rem !important; }
  .jcbrn-route small { font-size: .58rem; letter-spacing: .075em; }
  .jcbrn-route h1 { margin-top: 3px; font-size: .93rem; }
  .jcbrn-counter { max-width: 73px; font-size: .68rem; }
  .jcbrn-body { padding: 19px 14px 18px; }
  .jcbrn-kicker { margin-bottom: 6px; font-size: .62rem; letter-spacing: .075em; }
  .jcbrn-heading { margin-bottom: 11px; font-size: 1.65rem; line-height: 1.2; }
  .jcbrn-lead { margin-bottom: 17px; font-size: .87rem; line-height: 1.65; }
  .jcbrn-tiles { gap: 6px; margin-bottom: 17px; }
  .jcbrn-tiles > span { width: 37px; height: 37px; border-radius: 11px; font-size: .88rem; }
  .jcbrn-cards { grid-template-columns: minmax(0, 1fr); gap: 9px; margin: 18px 0; }
  .jcbrn-lesson { min-height: 88px; padding: 14px; gap: 11px; border-radius: 16px; }
  .jcbrn-lesson strong { font-size: .89rem; }
  .jcbrn-lesson small { font-size: .73rem; line-height: 1.4; }
  .jcbrn-lesson-status { font-size: .67rem; }
  .jcbrn-reading { padding: 20px 18px; border-radius: 19px; }
  .jcbrn-reading h2 { margin-bottom: 13px; font-size: 1.47rem; }
  .jcbrn-text { font-size: .91rem; line-height: 1.75; }
  .jcbrn-text p { margin-bottom: 13px; }
  .jcbrn-illustration { margin: 11px 0; }
  .jcbrn-illustration img { max-height: 100px; }
  .jcbrn-illustration figcaption, .jcbrn-credit, .jcbrn-feedback .jcbrn-credit { font-size: .67rem; }
  .jcbrn-takeaways { margin-top: 17px; padding: 13px 14px; font-size: .83rem; line-height: 1.6; }
  .jcbrn-takeaways > strong, .jcbrn-takeaways h3 { font-size: .82rem; }
  .jcbrn-question { padding: 16px 13px; border-radius: 19px; }
  .jcbrn-question .jcbrn-heading { margin-bottom: 11px; font-size: 1.34rem; line-height: 1.25; letter-spacing: -.025em; }
  .jcbrn-options { gap: 8px; margin-top: 14px; }
  .jcbrn-option { min-height: 76px; padding: 11px 9px; gap: 7px; border-radius: 12px; font-size: .82rem !important; line-height: 1.4; }
  .jcbrn-letter { flex-basis: 22px; width: 22px; min-height: 24px; border-radius: 7px; font-size: .64rem; }
  .jcbrn-option-state { font-size: .83rem; }
  .jcbrn-feedback { margin-top: 10px; padding: 11px 12px; font-size: .8rem; line-height: 1.5; }
  .jcbrn-feedback strong { font-size: .83rem; }
  .jcbrn-feedback p { margin-top: 3px; }
  .jcbrn-prompt { margin-top: 11px; font-size: .75rem; }
  .jcbrn-bottom { padding: 9px 13px calc(9px + env(safe-area-inset-bottom, 0px)); }
  .jcbrn-actions { gap: 8px; }
  .jcbrn-primary, .jcbrn-secondary { min-width: 0; min-height: 46px; padding: 10px 13px; border-radius: 12px; font-size: .8rem !important; }
  .jcbrn-primary { flex: 1 1 0; }
  .jcbrn-secondary { flex: 0 1 auto; }
  .jcbrn-score { margin: 20px auto; padding: 18px 27px; }
  .jcbrn-score strong { font-size: 2.3rem; }
  .jcbrn-score span { font-size: .74rem; }
  .jcbrn-mistakes { gap: 9px; margin-top: 19px; }
  .jcbrn-mistakes article { padding: 15px 16px; border-radius: 14px; }
  .jcbrn-mistakes h3 { font-size: .92rem; }
  .jcbrn-mistakes p { font-size: .8rem; line-height: 1.6; }
  .jcbrn-boundary { margin-top: 17px; padding: 10px 12px; font-size: .72rem; }
  .jcbrn-sources { margin-top: 10px; font-size: .72rem; }
}

@media (max-width: 600px) and (max-height: 700px) {
  .jcbrn-study:is([data-jcbrn-view="quiz"], [data-jcbrn-view="checkpoint"]) .jcbrn-body { padding-top: 13px; padding-bottom: 13px; }
  .jcbrn-study:is([data-jcbrn-view="quiz"], [data-jcbrn-view="checkpoint"]) .jcbrn-tiles { margin-bottom: 11px; }
  .jcbrn-study:is([data-jcbrn-view="quiz"], [data-jcbrn-view="checkpoint"]) .jcbrn-tiles > span { width: 31px; height: 31px; border-radius: 9px; font-size: .8rem; }
  .jcbrn-question { padding: 14px 12px; }
  .jcbrn-question .jcbrn-heading { font-size: 1.25rem; }
  .jcbrn-options { margin-top: 12px; }
  .jcbrn-option { min-height: 68px; padding: 9px 8px; }
  .jcbrn-feedback { padding: 9px 11px; font-size: .78rem; line-height: 1.45; }
}

/* Narrow layouts and zoom trade compactness for readable, untruncated text. */
@media (max-width: 340px) {
  .jcbrn-top-inner { gap: 7px; padding-inline: 10px; }
  .jcbrn-route h1 { font-size: .86rem; }
  .jcbrn-counter { max-width: 58px; font-size: .63rem; }
  .jcbrn-body { padding-inline: 10px; }
  .jcbrn-options { grid-template-columns: minmax(0, 1fr); }
  .jcbrn-option { min-height: 52px; }
  .jcbrn-actions { flex-wrap: wrap; }
  .jcbrn-primary, .jcbrn-secondary { flex: 1 1 110px; }
}

@media (prefers-reduced-motion: reduce) {
  .jcbrn-study *, .jcbrn-study *::before, .jcbrn-study *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* At high zoom or in a short landscape viewport, chrome must not cover content. */
@media (max-width: 340px), (max-height: 450px) {
  .jcbrn-top, .jcbrn-bottom { position: static; }
}

@media (forced-colors: active) {
  .jcbrn-study button, .jcbrn-reading, .jcbrn-question, .jcbrn-feedback, .jcbrn-score { border: 1px solid CanvasText; }
  .jcbrn-study :where(button, a, summary):focus-visible { outline-color: Highlight; }
  .jcbrn-option.is-correct { outline: 2px solid Highlight; outline-offset: -3px; }
  .jcbrn-option.is-wrong { border-style: dashed; border-width: 2px; }
  .jcbrn-track { border-block: 1px solid CanvasText; }
  .jcbrn-track > span { background: Highlight; }
  .jcbrn-takeaways, .jcbrn-boundary { border-color: CanvasText; }
}
