/* Approved solution styles — scoped under .solution only (Kalam/Caveat never leak to site chrome). */
@font-face {
  font-family: "Kalam";
  src: url(/solution-assets/fonts/Kalam-Regular.ttf) format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Kalam";
  src: url(/solution-assets/fonts/Kalam-Bold.ttf) format("truetype");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Caveat";
  src: url(/solution-assets/fonts/Caveat-VariableFont_wght.ttf) format("truetype");
  font-weight: 400 700;
  font-display: swap;
}

.solution {
  --paper: #fffdf6;
  --ink: #1c3a8a;
  --black: #111827;
  --muted: #5b6170;
  --red: #d62828;
  --blue: #0a78b5;
  --green: #1f7a3a;
  --purple: #6b2fa3;
  --orange: #c2570c;
  --hl: rgba(255, 242, 122, 0.6);
  --line: #e6e1d3;
  --f-body: "Kalam", "DejaVu Sans", sans-serif;
  --f-head: "Caveat", "Kalam", "DejaVu Sans", sans-serif;
  box-sizing: border-box;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 18.5px/1.65 var(--f-body);
  overflow-wrap: break-word;
  max-width: 100%;
  overflow-x: hidden;
  padding-top: 0.5em;
  padding-bottom: 0.35em;
}

.solution *,
.solution *::before,
.solution *::after {
  box-sizing: border-box;
}

.solution main {
  max-width: 420px;
  margin: 0 auto;
  padding: 20px 18px 48px;
}

.solution header .tag {
  display: inline-block;
  font: 700 13px/1 var(--f-body);
  color: #fff;
  background: var(--black);
  border-radius: 8px;
  padding: 5px 9px;
  letter-spacing: 0.3px;
}
.solution header .exam {
  font-size: 14px;
  color: var(--muted);
  margin-top: 8px;
}
.solution h1 {
  font: 700 34px/1.15 var(--f-head);
  color: var(--black);
  margin: 10px 0 0;
}
.solution h1 span {
  background: linear-gradient(transparent 55%, var(--hl) 55% 92%, transparent 92%);
}
.solution h2 {
  font: 700 28px/1.2 var(--f-head);
  color: var(--black);
  margin: 0 0 6px;
}
.solution section {
  margin-top: 34px;
}
.solution p {
  margin: 0 0 14px;
}
.solution b,
.solution strong {
  color: var(--black);
}
.solution .q {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 16px 16px 6px;
  margin-top: 18px;
}
.solution .q .lbl {
  font: 700 22px var(--f-head);
  color: var(--muted);
}
.solution .opts {
  list-style: none;
  padding: 0;
  margin: 6px 0 10px;
}
.solution .opts li {
  padding: 3px 0;
}
.solution .step-no {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--black);
  color: #fff;
  font: 700 17px var(--f-body);
  margin-right: 8px;
  vertical-align: 3px;
}
.solution .step {
  border-top: 1.5px dashed var(--line);
  padding-top: 26px;
}
.solution .why {
  margin: 10px 0 0;
  color: var(--ink);
}
.solution .fig {
  margin: 16px 0 6px;
}
/* Only the diagram. KaTeX radicals inside a caption are also svg, and width 100%
   on those stretches the surd until the glyph is gone (MAT Q04 caption). */
.solution .fig > svg {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
}
.solution .fig figcaption {
  font-size: 15px;
  color: var(--muted);
  text-align: center;
  margin-top: 4px;
}
.solution .key {
  background: #eef6ff;
  border-left: 5px solid var(--blue);
  border-radius: 0 14px 14px 0;
  padding: 14px 16px;
  font-size: 20px;
  color: var(--black);
}
.solution .key .lbl {
  display: block;
  font: 700 22px var(--f-head);
  color: var(--blue);
  margin-bottom: 2px;
}
.solution .math {
  margin: 10px 0 16px;
  max-width: 100%;
  overflow-x: auto;
  padding: 0.85em 0 0.65em;
}
.solution .math .katex-display {
  margin: 12px 0;
  text-align: left;
}
/* One line when it fits. A wide display scrolls inside this block; it does not wrap mid-term. */
.solution .mathFit:has(> .mathBlock),
.solution .mathScroll {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}
.solution .mathBlock .katex-display > .katex,
.solution .math .katex-display > .katex {
  text-align: left;
  white-space: nowrap;
}
/* Official question text shown inside a solution (question card, pills, key dispute) may wrap at KaTeX break points; it is never rewritten. */
.solution :is(.q, .opts, .choice, .pill, .key-dispute) .mathBlock .katex-display > .katex,
.solution :is(.q, .opts, .choice, .pill, .key-dispute) .mathBlock .katex-html {
  white-space: normal;
}
.solution .katex {
  font-size: 1.08em;
  color: var(--black);
}
.solution .answer {
  background: #fbfffa;
  border: 2px dashed var(--green);
  border-radius: 18px;
  padding: 18px 16px;
}
.solution .pill {
  display: inline-block;
  border: 2.5px solid var(--green);
  color: var(--green);
  border-radius: 999px;
  padding: 4px 18px;
  font: 700 22px var(--f-body);
  background: #fff;
  white-space: normal;
  overflow-wrap: break-word;
  box-sizing: border-box;
}
.solution .check {
  margin-top: 14px;
  color: var(--black);
}
.solution .ok {
  color: var(--green);
  font-weight: 700;
}
.solution details {
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: #fff;
  margin-top: 14px;
  padding: 0 16px;
}
.solution summary {
  cursor: pointer;
  font: 700 23px/1.3 var(--f-head);
  color: var(--purple);
  padding: 14px 0;
  list-style: none;
}
.solution summary::-webkit-details-marker {
  display: none;
}
.solution summary::before {
  content: "+";
  display: inline-block;
  width: 22px;
  font-family: var(--f-body);
}
.solution details[open] summary::before {
  content: "−";
}
.solution details[open] {
  padding-bottom: 8px;
}
.solution details.trap summary {
  color: var(--red);
}
.solution .item {
  padding: 10px 0;
  border-top: 1px dashed var(--line);
}
.solution .item:first-of-type {
  border-top: 0;
}
.solution .item .head {
  color: var(--black);
  font-weight: 700;
}
.solution .x {
  color: var(--red);
  font-weight: 700;
}
.solution footer {
  margin-top: 40px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}
.solution .fig text {
  font-family: var(--f-head);
  font-weight: 700;
}
.solution .fig .dim {
  opacity: 0.28;
}
.solution .fig .focus .hlbg {
  fill: var(--hl);
}
.solution .fig .hlbg {
  fill: none;
}
.solution .fig .ctx {
  opacity: 0.5;
}
.solution p .katex,
.solution .item .head .katex,
.solution .key .katex,
.solution .pill .katex {
  white-space: nowrap;
  max-width: 100%;
}
.solution .endPunct,
.solution .mathGlue,
.solution .mathInline {
  white-space: nowrap;
}
/* a wrapping formula keeps its break points even inside glued prose */
.solution .mathWrap {
  white-space: normal;
}
.solution .hi-toggle {
  border: 0;
  border-top: 1px dashed var(--line);
  border-radius: 0;
  margin: 4px 0 8px;
  padding: 0;
  background: none;
}
.solution .hi-toggle summary {
  font: 700 19px/1.3 var(--f-body);
  color: var(--muted);
  padding: 10px 0;
}
.solution .key .term {
  font-size: 17px;
  color: var(--ink);
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed #b9d3ea;
}
.solution .dropped {
  background: #fff7e6;
  border: 2px dashed var(--orange);
  border-radius: 18px;
  padding: 18px 16px;
}
.solution .dropped h2 {
  color: var(--orange);
}
.solution .q p .katex {
  white-space: normal;
}
.solution .q .math .katex {
  font-size: 0.94em;
}
.solution .qlist {
  margin: 10px 0 6px;
}
.solution .qlist .qlt {
  font-weight: 700;
  color: var(--black);
  margin: 8px 0 2px;
}
.solution .qlist p {
  margin: 4px 0;
}
.solution .osvg {
  display: block;
  max-width: 260px;
  margin: 2px 0 6px;
}
.solution .osvg svg {
  width: 100%;
  height: auto;
  display: block;
}
.solution .q .fig {
  margin: 4px auto 10px;
}
.solution .key-dispute {
  background: #fff7ed;
  border: 2px solid var(--orange);
  border-radius: 16px;
  padding: 14px 16px;
  color: var(--black);
}
.solution .key-dispute h2 {
  color: var(--orange);
  font-size: 25px;
}
.solution .key-dispute p {
  margin: 6px 0;
}
.solution .key-dispute b {
  color: var(--orange);
}
.solution .order-note {
  font-size: 15px;
  line-height: 1.5;
  color: var(--muted);
  border-top: 1px dashed var(--line);
  padding-top: 8px;
  margin: 4px 0 8px;
}

@media (min-width: 600px) and (max-width: 899.98px) {
  .solution main {
    max-width: 540px;
    padding-top: 32px;
  }
}

@media (min-width: 900px) {
  .solution {
    font-size: 20px;
  }
  .solution main {
    max-width: 960px;
    padding: 44px 40px 64px;
  }
  .solution h1 {
    font-size: 46px;
  }
  .solution h2 {
    font-size: 32px;
  }
  .solution header,
  .solution .q,
  .solution .key {
    max-width: 760px;
  }
  .solution .q {
    padding: 20px 24px 10px;
  }
  .solution .opts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 24px;
  }
  .solution .hi-toggle .opts {
    display: grid;
  }
  .solution .picture .fig {
    max-width: 540px;
    margin: 20px auto 10px;
  }
  .solution .pic-text {
    max-width: 760px;
  }
  .solution section {
    margin-top: 44px;
  }
  .solution .step.has-fig {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 48px;
    grid-template-areas: "h fig" "t1 fig" "t2 fig" "why why";
    grid-template-rows: auto auto 1fr;
    align-items: start;
  }
  .solution .step.has-fig > h2 {
    grid-area: h;
  }
  .solution .step.has-fig > .t1 {
    grid-area: t1;
  }
  .solution .step.has-fig > .t2 {
    grid-area: t2;
  }
  .solution .step.has-fig > .why {
    grid-area: why;
  }
  .solution .step.has-fig > .fig {
    grid-area: fig;
    position: sticky;
    top: 24px;
    margin: 0;
    align-self: start;
  }
  .solution .step:not(.has-fig) {
    max-width: 760px;
  }
  .solution .answer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 48px;
    padding: 24px 28px;
  }
  .solution .answer > h2 {
    grid-column: 1 / -1;
  }
  .solution .ans-check .check {
    margin-top: 0;
  }
  .solution .extras details[open] {
    padding-bottom: 14px;
  }
  .solution .extras .item {
    max-width: 760px;
  }
  .solution details {
    padding: 0 24px;
  }
}

.solution .mathInline.mathAccentEnd {
  padding-right: 0.22em;
}
