/* Scoped static micro-unit. No global layout or security changes. */
#fire-shared-foundations {
  --fcb-navy: #0b2748;
  --fcb-orange: #f37924;
  --fcb-ink: #17334f;
  --fcb-muted: #4b6075;
  --fcb-line: #cbd6e1;
  --fcb-soft: #f3f6fa;
  --fcb-white: #fff;
  color: var(--fcb-ink);
  background: var(--fcb-white);
  border: 1px solid var(--fcb-line);
  border-radius: 20px;
  margin-block: 2rem;
  padding: 0;
  width: 100%;
  overflow: clip;
  line-height: 1.65;
  scroll-margin-top: 6rem;
  font-family: inherit;
}
#fire-shared-foundations,
#fire-shared-foundations * { box-sizing: border-box; }
#fire-shared-foundations [hidden] { display: none !important; }
#fire-shared-foundations h2,
#fire-shared-foundations h3,
#fire-shared-foundations h4,
#fire-shared-foundations p { margin: 0 0 0.85rem; }
#fire-shared-foundations h2 { color: inherit; font-size: clamp(1.5rem, 2.5vw, 2.2rem); line-height: 1.3; }
#fire-shared-foundations h3 { color: var(--fcb-navy); font-size: 1.2rem; line-height: 1.4; }
#fire-shared-foundations h4 { color: var(--fcb-navy); font-size: 1rem; }
#fire-shared-foundations a { color: #104f83; text-decoration: underline; text-underline-offset: 0.2em; overflow-wrap: anywhere; }
#fire-shared-foundations :where(button, input, select, summary, a):focus-visible,
#fire-shared-foundations #fcb-question-title:focus-visible {
  outline: 3px solid #c55409;
  outline-offset: 3px;
}
#fire-shared-foundations .fcb-header {
  padding: clamp(1.3rem, 3vw, 2.2rem);
  color: var(--fcb-white);
  background: var(--fcb-navy);
  border-top: 5px solid var(--fcb-orange);
}
#fire-shared-foundations .fcb-eyebrow { margin-bottom: 0.45rem; font-size: 0.86rem; font-weight: 750; letter-spacing: 0.03em; }
#fire-shared-foundations .fcb-header .fcb-eyebrow { color: #ffd3b3; }
#fire-shared-foundations .fcb-intro { max-width: 68ch; color: #e1eaf4; }
#fire-shared-foundations .fcb-scope-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0 0; padding: 0; list-style: none; }
#fire-shared-foundations .fcb-scope-tags li { padding: 0.3rem 0.7rem; border: 1px solid #637992; border-radius: 999px; font-size: 0.82rem; }
#fire-shared-foundations .fcb-reading,
#fire-shared-foundations .fcb-sources { padding: clamp(1.1rem, 2.5vw, 1.8rem); }
#fire-shared-foundations .fcb-reading { background: var(--fcb-soft); border-bottom: 1px solid var(--fcb-line); }
#fire-shared-foundations .fcb-reading > p { color: var(--fcb-muted); font-size: 0.92rem; }
#fire-shared-foundations details { border: 1px solid var(--fcb-line); background: var(--fcb-white); border-radius: 10px; margin-block: 0.6rem; overflow-wrap: anywhere; }
#fire-shared-foundations details > summary { min-height: 44px; padding: 0.8rem 1rem; cursor: pointer; font-weight: 700; color: var(--fcb-navy); }
#fire-shared-foundations details > :not(summary) { margin-inline: 1rem; }
#fire-shared-foundations details > :last-child { margin-bottom: 1rem; }
#fire-shared-foundations .fcb-notice { margin: 1rem clamp(1.1rem, 2.5vw, 1.8rem); padding: 0.85rem 1rem; background: #fff4e9; border-left: 4px solid var(--fcb-orange); border-radius: 6px; }
#fire-shared-foundations .fcb-reading .fcb-notice { margin-inline: 0; }
#fire-shared-foundations #fcb-app { padding: clamp(1rem, 2.5vw, 1.8rem); }
#fire-shared-foundations .fcb-workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 0.38fr); gap: 1.2rem; align-items: start; }
#fire-shared-foundations .fcb-card { padding: clamp(1rem, 2vw, 1.5rem); min-width: 0; border: 1px solid var(--fcb-line); border-radius: 14px; background: var(--fcb-white); }
#fire-shared-foundations .fcb-question-card { border-top: 4px solid var(--fcb-orange); }
#fire-shared-foundations .fcb-question-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.4rem 1rem; margin-bottom: 0.9rem; color: var(--fcb-muted); font-size: 0.84rem; font-weight: 700; }
#fire-shared-foundations .fcb-question { margin-bottom: 1.1rem; overflow-wrap: anywhere; }
#fire-shared-foundations .fcb-options { display: grid; gap: 0.65rem; margin-bottom: 1rem; }
#fire-shared-foundations .fcb-options label { display: flex; align-items: flex-start; gap: 0.65rem; min-height: 44px; padding: 0.85rem; border: 1px solid var(--fcb-line); border-radius: 10px; cursor: pointer; overflow-wrap: anywhere; }
#fire-shared-foundations .fcb-options label:has(input:checked) { border-color: var(--fcb-navy); background: #edf3f9; box-shadow: inset 3px 0 0 var(--fcb-orange); }
#fire-shared-foundations input[type="radio"],
#fire-shared-foundations input[type="checkbox"] { flex-shrink: 0; width: 1.15rem; height: 1.15rem; accent-color: var(--fcb-navy); margin-top: 0.25rem; }
#fire-shared-foundations .fcb-answer-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(115px, 0.4fr); gap: 0.8rem; margin-bottom: 1rem; }
#fire-shared-foundations .fcb-field { min-width: 0; }
#fire-shared-foundations .fcb-field > label { display: block; margin-bottom: 0.35rem; color: var(--fcb-ink); font-size: 0.92rem; font-weight: 700; }
#fire-shared-foundations input[type="text"],
#fire-shared-foundations select { display: block; width: 100%; min-height: 46px; border: 1px solid #8fa3b8; border-radius: 8px; padding: 0.55rem 0.7rem; background: var(--fcb-white); color: var(--fcb-ink); font: inherit; font-size: 1rem; line-height: 1.4; }
#fire-shared-foundations [aria-invalid="true"] { border-color: #a52c23; }
#fire-shared-foundations .fcb-field-help { color: var(--fcb-muted); font-size: 0.87rem; }
#fire-shared-foundations .fcb-answer-grid > .fcb-field-help { grid-column: 1 / -1; margin-bottom: 0; }
#fire-shared-foundations .fcb-actions,
#fire-shared-foundations .fcb-support-actions { display: flex; flex-wrap: wrap; gap: 0.65rem; }
#fire-shared-foundations .fcb-support-actions { margin-top: 1.1rem; margin-bottom: 0.65rem; }
#fire-shared-foundations button { min-height: 44px; max-width: 100%; padding: 0.65rem 1rem; border: 1px solid var(--fcb-navy); border-radius: 8px; font: inherit; font-weight: 700; line-height: 1.35; cursor: pointer; overflow-wrap: anywhere; }
#fire-shared-foundations .fcb-primary { background: var(--fcb-navy); color: var(--fcb-white); }
#fire-shared-foundations .fcb-secondary { background: var(--fcb-white); color: var(--fcb-navy); }
#fire-shared-foundations button:hover:not(:disabled) { box-shadow: inset 0 -3px 0 var(--fcb-orange); }
#fire-shared-foundations button:disabled { opacity: 0.55; cursor: default; }
#fire-shared-foundations .fcb-navigation { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--fcb-line); }
#fire-shared-foundations .fcb-hints,
#fire-shared-foundations .fcb-errors { padding: 0.85rem 0.85rem 0.85rem 2rem; margin-block: 0.8rem; border-radius: 8px; background: #fff4e9; }
#fire-shared-foundations .fcb-hints:empty,
#fire-shared-foundations .fcb-errors:empty,
#fire-shared-foundations .fcb-status:empty { display: none; }
#fire-shared-foundations .fcb-hints li + li,
#fire-shared-foundations .fcb-errors li + li { margin-top: 0.55rem; }
#fire-shared-foundations .fcb-result,
#fire-shared-foundations .fcb-solution { margin-top: 1rem; padding: 1rem; border: 1px solid var(--fcb-line); border-left: 4px solid var(--fcb-navy); border-radius: 8px; background: var(--fcb-soft); overflow-wrap: anywhere; }
#fire-shared-foundations .fcb-result[data-state="correct"] { border-left-color: #176443; }
#fire-shared-foundations .fcb-result[data-state="incorrect"],
#fire-shared-foundations .fcb-result[data-state="invalid"] { border-left-color: #a52c23; }
#fire-shared-foundations .fcb-result > :last-child,
#fire-shared-foundations .fcb-solution > :last-child { margin-bottom: 0; }
#fire-shared-foundations .fcb-status { margin-top: 0.8rem; color: var(--fcb-muted); font-size: 0.9rem; }
#fire-shared-foundations .fcb-metrics { display: grid; gap: 0.5rem; margin: 1rem 0; }
#fire-shared-foundations .fcb-metrics > div { display: flex; justify-content: space-between; gap: 0.5rem; align-items: baseline; border-bottom: 1px solid #e0e7ee; padding-bottom: 0.5rem; }
#fire-shared-foundations .fcb-metrics dt { color: var(--fcb-muted); font-size: 0.92rem; }
#fire-shared-foundations .fcb-metrics dd { margin: 0; color: var(--fcb-navy); font-size: 1.6rem; font-weight: 750; font-variant-numeric: tabular-nums; }
#fire-shared-foundations #fcb-progress-label { display: block; color: var(--fcb-ink); font-size: 0.9rem; font-weight: 700; }
#fire-shared-foundations progress { display: block; width: 100%; height: 12px; margin: 0.5rem 0 0.8rem; accent-color: var(--fcb-navy); }
#fire-shared-foundations progress::-webkit-progress-bar { background: #e3eaf1; border-radius: 8px; }
#fire-shared-foundations progress::-webkit-progress-value { background: var(--fcb-navy); border-radius: 8px; }
#fire-shared-foundations progress::-moz-progress-bar { background: var(--fcb-navy); border-radius: 8px; }
#fire-shared-foundations .fcb-preferences { margin-block: 1rem; padding-top: 0.8rem; border-top: 1px solid var(--fcb-line); }
#fire-shared-foundations .fcb-check-label { display: flex; gap: 0.65rem; align-items: flex-start; min-height: 44px; padding-block: 0.45rem; cursor: pointer; font-size: 0.92rem; }
#fire-shared-foundations .fcb-full-width { width: 100%; }
#fire-shared-foundations .fcb-model { margin-top: 1.2rem; background: #f8fafc; }
#fire-shared-foundations .fcb-model-heading { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 0.7rem 1rem; }
#fire-shared-foundations .fcb-model .fcb-eyebrow { color: #935012; }
#fire-shared-foundations .fcb-model-tag { padding: 0.25rem 0.6rem; border: 1px solid #e2ba98; border-radius: 7px; background: #fff2e7; color: #743906; font-size: 0.8rem; font-weight: 700; }
#fire-shared-foundations .fcb-mode-field { max-width: 28rem; margin-top: 1rem; margin-bottom: 0.7rem; }
#fire-shared-foundations .fcb-model-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-block: 1rem; }
#fire-shared-foundations .fcb-model-field { display: grid; grid-template-columns: minmax(0, 1fr) minmax(100px, 0.4fr); gap: 0.65rem; align-items: end; min-width: 0; }
#fire-shared-foundations .fcb-model-result { margin-top: 1rem; padding: clamp(1rem, 2vw, 1.4rem); border: 1px solid #a8bacb; border-radius: 10px; background: var(--fcb-white); }
#fire-shared-foundations .fcb-model-output { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.6rem; margin-bottom: 0.65rem; color: var(--fcb-navy); }
#fire-shared-foundations #fcb-model-value { font-size: clamp(1.7rem, 3vw, 2.1rem); font-weight: 750; line-height: 1.2; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
#fire-shared-foundations #fcb-model-unit { font-size: 1rem; font-weight: 700; }
#fire-shared-foundations .fcb-formula { padding: 0.7rem 0.85rem; background: var(--fcb-soft); border-radius: 7px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
#fire-shared-foundations .fcb-model-explanation-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; margin-top: 1rem; }
#fire-shared-foundations .fcb-model-explanation-grid ol { padding-left: 1.4rem; margin: 0; }
#fire-shared-foundations .fcb-model-explanation-grid li + li { margin-top: 0.45rem; }
#fire-shared-foundations .fcb-model-boundary { margin-top: 1.1rem; margin-bottom: 0; padding-top: 1rem; border-top: 1px solid var(--fcb-line); color: var(--fcb-muted); font-size: 0.86rem; }
#fire-shared-foundations .fcb-sources { border-top: 1px solid var(--fcb-line); font-size: 0.9rem; overflow-wrap: anywhere; }
#fire-shared-foundations .fcb-sources ul { padding-left: 1.3rem; }
#fire-shared-foundations .fcb-sources li + li { margin-top: 0.5rem; }
@media (max-width: 760px) {
  #fire-shared-foundations .fcb-workspace,
  #fire-shared-foundations .fcb-model-fields,
  #fire-shared-foundations .fcb-model-explanation-grid { grid-template-columns: minmax(0, 1fr); }
  #fire-shared-foundations .fcb-progress-card { order: 2; }
}
@media (max-width: 440px) {
  #fire-shared-foundations { border-radius: 12px; }
  #fire-shared-foundations .fcb-header { padding: 1.15rem 1rem; }
  #fire-shared-foundations .fcb-reading,
  #fire-shared-foundations .fcb-sources { padding: 1rem; }
  #fire-shared-foundations #fcb-app { padding: 0.75rem; }
  #fire-shared-foundations .fcb-card { padding: 1rem; }
  #fire-shared-foundations .fcb-actions > button,
  #fire-shared-foundations .fcb-support-actions > button { flex: 1 1 100%; width: 100%; }
  #fire-shared-foundations .fcb-model-field { grid-template-columns: minmax(0, 1fr) minmax(95px, 0.48fr); }
  #fire-shared-foundations .fcb-answer-grid { grid-template-columns: minmax(0, 1fr); }
  #fire-shared-foundations .fcb-scope-tags { gap: 0.4rem; }
}
@media (prefers-reduced-motion: reduce) {
  #fire-shared-foundations,
  #fire-shared-foundations * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
#fire-shared-foundations[data-reduced-motion="true"],
#fire-shared-foundations[data-reduced-motion="true"] *,
#fire-shared-foundations[data-fcb-reduced-motion="true"],
#fire-shared-foundations[data-fcb-reduced-motion="true"] * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }

/* Match the existing progress engine UI preference without changing JS. */
#fire-shared-foundations[data-motion="reduced"],
#fire-shared-foundations[data-motion="reduced"] * {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}
#fire-shared-foundations #fcb-result[data-state="retry"] { border-left-color: #c55409; }

/* This learning page keeps the existing cart link in document flow. */
body:has(#fire-shared-foundations) > #qingqiCartLauncher {
  position: static;
  z-index: auto;
  width: max-content;
  max-width: calc(100% - 2rem);
  margin: 1rem auto calc(6rem + env(safe-area-inset-bottom));
}
