.chem-page {
  background: #f5f8fa;
  color: #163547;
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.75;
}
.chem-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 5%;
  border-bottom: 1px solid #d8e4e9;
  gap: 18px;
  background: white;
}
.chem-topbar a {
  font-weight: 750;
  color: #176d86;
}
.chem-topbar > span:last-child {
  font-size: 14px;
  color: #4c6d7a;
}
.chem-shell {
  max-width: 1240px;
  margin: auto;
  padding: 36px 26px 80px;
}
.chem-heading {
  margin-bottom: 32px;
}
.chem-heading h1 {
  font-size: 48px;
  line-height: 1.12;
  letter-spacing: -1px;
  margin: 14px 0;
}
.chem-heading > p {
  max-width: 780px;
  color: #557280;
}
.subject-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 20px 0;
}
.subject-nav a {
  padding: 11px 18px;
  border: 1px solid #bfced7;
  border-radius: 12px;
  background: white;
  font-weight: 700;
  color: #176c82;
}
.subject-nav a[aria-current] {
  background: #174865;
  color: white;
  border-color: #174865;
}
.chem-layout {
  display: grid;
  grid-template-columns: 265px minmax(0, 1fr);
  gap: 28px;
}
.chem-rail {
  align-self: start;
  position: sticky;
  top: 20px;
  border: 1px solid #d3e1e7;
  border-radius: 18px;
  background: white;
  padding: 22px;
}
.chem-rail > progress {
  width: 100%;
  accent-color: #197d96;
}
.chem-rail p {
  font-size: 14px;
  color: #607985;
}
.chem-rail button {
  display: flex;
  align-items: start;
  gap: 10px;
  width: 100%;
  padding: 13px 9px;
  border: 0;
  border-radius: 10px;
  text-align: left;
  margin: 7px 0;
  background: transparent;
  line-height: 1.5;
  font-size: 15px;
  color: #254c60;
}
.chem-rail button > span:first-child {
  font-weight: 800;
  color: #167e8f;
}
.chem-rail button small {
  display: block;
  font-size: 13px;
  margin-top: 4px;
  color: #5d7785;
}
.chem-rail .selected {
  background: #e8f4f7;
}
.chem-main {
  min-width: 0;
}
.chem-card {
  border: 1px solid #cedfe6;
  border-radius: 22px;
  background: white;
  padding: 30px;
  margin: 18px 0;
  box-shadow: 0 3px 14px #103c5410;
}
.chem-card h2 {
  font-size: 28px;
  line-height: 1.45;
  white-space: pre-line;
  margin: 12px 0 22px;
}
.chem-card h3 {
  font-size: 23px;
  margin: 30px 0 15px;
}
.chem-card > p {
  margin: 17px 0;
}
.chem-goal {
  font-size: 18px;
  color: #27708a;
}
.chem-terms {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 24px 0;
}
.chem-terms > div {
  background: #f1f7fa;
  padding: 16px;
  border-radius: 12px;
}
.chem-terms dt {
  font-weight: 800;
  color: #1c5873;
}
.chem-terms dd {
  margin: 6px 0 0;
}
.chem-stage-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chem-stage-nav button {
  padding: 11px 14px;
  border: 1px solid #bed4de;
  border-radius: 10px;
  background: white;
  font-size: 14px;
}
.chem-stage-nav button.selected {
  background: #174865;
  color: white;
}
.chem-steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 20px 0;
}
.chem-steps li {
  counter-increment: step;
  position: relative;
  padding: 22px 22px 20px 60px;
  margin: 15px 0;
  background: #f4f8fa;
  border: 1px solid #deeaef;
  border-radius: 16px;
}
.chem-steps li:before {
  content: counter(step);
  position: absolute;
  left: 18px;
  top: 23px;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: #1c788a;
  color: #fff;
  text-align: center;
  font-size: 14px;
  line-height: 25px;
}
.chem-steps p {
  margin: 9px 0;
  white-space: pre-line;
}
.chem-equation {
  font-size: 19px;
  font-weight: 650;
  color: #154a60;
  background: #e8f1f6;
  padding: 12px;
  border-radius: 9px;
  overflow-wrap: anywhere;
  white-space: pre-line;
}
.chem-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 22px 0;
}
.chem-actions button,
.chem-primary,
.chem-notes nav button {
  padding: 13px 18px;
  border: 1px solid #a8c4d1;
  border-radius: 12px;
  background: white;
  color: #175b74;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.chem-actions .chem-primary,
.chem-primary {
  background: #185b79;
  color: white;
  border-color: #185b79;
}
.chem-actions button:disabled {
  opacity: 0.55;
  cursor: default;
}
.chem-input {
  display: grid;
  gap: 12px;
  font-weight: 700;
  margin: 22px 0;
}
.chem-input input,
.chem-input textarea {
  width: 100%;
  border: 2px solid #a9c4d1;
  border-radius: 12px;
  padding: 15px;
  font-size: 18px;
  line-height: 1.6;
  background: #fff;
  font-weight: 400;
}
.chem-choices {
  border: 0;
  padding: 0;
  margin: 20px 0;
  display: grid;
  gap: 12px;
}
.chem-choices legend {
  font-weight: 700;
  margin: 10px 0;
}
.chem-choices label {
  display: flex;
  align-items: start;
  gap: 14px;
  padding: 18px;
  border: 1px solid #cadde6;
  border-radius: 14px;
  background: #fbfdfe;
  cursor: pointer;
}
.chem-choices input {
  margin-top: 8px;
  accent-color: #1c7c91;
}
.chem-feedback {
  background: #edf6f7;
  border-left: 4px solid #398392;
  padding: 15px 18px;
}
.chem-help {
  border-top: 2px solid #cce2e8;
  margin-top: 24px;
  padding-top: 15px;
}
.chem-final {
  background: #e3f1ec;
  padding: 18px;
  border-radius: 12px;
  color: #165545;
  white-space: pre-line;
}
.chem-recap summary {
  font-weight: 750;
  color: #1b6b82;
  cursor: pointer;
}
.chem-visual {
  margin: 28px 0;
  padding: 20px;
  background: #fff;
  border: 1px solid #d5e4eb;
  border-radius: 16px;
}
.chem-visual svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 620px;
  font-family: inherit;
  overflow: visible;
}
.chem-visual figcaption {
  color: #456d80;
  font-size: 14px;
  line-height: 1.65;
  margin-top: 14px;
}
.chem-small {
  font-size: 14px;
  line-height: 1.8;
  color: #5b7684;
}
.chem-home-memory {
  padding: 25px 30px;
  border-radius: 20px;
  background: #e9f3f8;
  margin: 30px 0;
}
.chem-home-memory h2 {
  font-size: 25px;
}
.chem-home-memory ul {
  padding-left: 20px;
}
.chem-home-memory li {
  margin: 8px 0;
}
.chem-topic-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.chem-topic-grid > a {
  background: white;
  border: 1px solid #cfdee6;
  border-radius: 20px;
  padding: 25px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.2s;
}
.chem-topic-grid > a:hover {
  border-color: #17869a;
}
.chem-topic-grid h2 {
  font-size: 25px;
  line-height: 1.25;
  margin: 4px 0;
}
.chem-topic-grid p {
  font-size: 15px;
  line-height: 1.75;
  color: #557280;
  flex: 1;
}
.chem-topic-grid progress {
  width: 100%;
  accent-color: #218797;
}
.chem-topic-grid div {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 14px;
}
.chem-topic-grid small {
  font-size: 13px;
  color: #5a7582;
}
.chem-topic-grid strong {
  color: #16728b;
}
.chem-daily {
  max-width: 950px;
}
.chem-notes {
  max-width: 960px;
  margin: auto;
  padding: 35px 28px;
  font-size: 17px;
  line-height: 1.8;
  color: #1b3c4c;
}
.chem-notes nav {
  display: flex;
  justify-content: space-between;
  gap: 15px;
}
.chem-notes section {
  margin: 30px 0;
  border-top: 1px solid #d4e1e7;
  padding-top: 22px;
}
.chem-notes dt {
  font-weight: 750;
}
.chem-notes dd {
  margin: 4px 0 15px;
}
.chem-notes h1 {
  font-size: 36px;
  line-height: 1.25;
}
.study-guide-panel {
  margin: 22px 0;
  padding: 24px;
  border: 1px solid #cadddf;
  border-radius: 18px;
  background: white;
  font-size: 16px;
  line-height: 1.85;
}
.study-guide-panel summary {
  font-weight: 800;
  color: #156d79;
  cursor: pointer;
}
.study-guide-panel ol {
  padding-left: 26px;
}
.study-guide-panel li {
  margin: 20px 0;
}
.study-guide-panel p {
  margin: 10px 0;
}
.study-guide-panel .study-why {
  background: #f0f6f5;
  padding: 13px;
  border-radius: 10px;
}
.study-free-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.study-free-nav button {
  padding: 12px;
  border: 1px solid #b9ced0;
  border-radius: 10px;
  background: #f6fafb;
  color: #195c68;
  font-weight: 700;
}
.study-full-help {
  margin-top: 20px;
  border-top: 1px solid #d5e2e4;
}
.study-expression {
  font-size: 23px;
}
.chem-page button:focus-visible,
.subject-nav a:focus-visible,
.teacher-page button:focus-visible {
  outline: 3px solid #df9a25;
  outline-offset: 3px;
}
@media (max-width: 850px) {
  .chem-topic-grid {
    grid-template-columns: 1fr 1fr;
  }
  .chem-layout {
    grid-template-columns: 1fr;
  }
  .chem-rail {
    position: static;
  }
  .chem-rail button {
    display: inline-flex;
    width: calc(50% - 4px);
    vertical-align: top;
  }
  .chem-heading h1 {
    font-size: 38px;
  }
  .chem-topbar {
    flex-wrap: wrap;
    font-size: 14px;
  }
  .chem-shell {
    padding: 24px 17px 60px;
  }
}
@media (max-width: 540px) {
  .chem-topic-grid,
  .chem-terms {
    grid-template-columns: 1fr;
  }
  .chem-card {
    padding: 22px 18px;
  }
  .chem-card h2 {
    font-size: 24px;
  }
  .chem-rail button {
    width: 100%;
  }
  .chem-steps li {
    padding: 18px 15px 18px 48px;
  }
  .chem-steps li:before {
    left: 12px;
    top: 20px;
  }
  .chem-visual {
    padding: 10px;
  }
  .chem-stage-nav button {
    flex: 1;
  }
  .chem-topbar > span:last-child {
    width: 100%;
  }
  .chem-heading h1 {
    font-size: 34px;
  }
  .chem-home-memory {
    padding: 22px;
  }
  .study-guide-panel {
    padding: 18px;
  }
}
@media print {
  .chem-notes nav,
  .learning-presence-notice {
    display: none !important;
  }
  .chem-notes {
    padding: 0;
    font-size: 11pt;
    line-height: 1.5;
  }
  .chem-notes h1 {
    font-size: 24pt;
  }
  .chem-notes section {
    break-before: auto;
  }
  .chem-steps li,
  .chem-visual {
    break-inside: avoid;
  }
  .chem-notes h2,
  .chem-notes h3 {
    break-after: avoid;
  }
  .chem-visual svg {
    max-height: 300px;
  }
}

.chem-exam-figure {
  margin: 22px 0;
  border: 1px solid #c7d6e1;
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
  break-inside: avoid;
}
.chem-exam-figure > figcaption {
  padding: 15px 18px;
  border-bottom: 1px solid #dfe7ed;
  background: #f1f6fb;
  color: #345368;
  font-size: 14px;
  line-height: 1.65;
}
.chem-diagram-scroll,
.chem-data-scroll {
  overflow-x: auto;
  max-width: 100%;
  padding: 12px;
}
.chem-diagram-scroll > svg {
  display: block;
  width: 100%;
  height: auto;
  max-width: 680px;
  min-width: 420px;
  margin: auto;
}
.chem-exam-figure table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 15px;
  line-height: 1.6;
}
.chem-exam-figure th,
.chem-exam-figure td {
  padding: 11px 13px;
  border-bottom: 1px solid #dce6ed;
  vertical-align: top;
  min-width: 90px;
}
.chem-exam-figure th {
  background: #eef4f9;
  font-weight: 750;
  color: #274b69;
}
.chem-exam-figure tr:last-child td {
  border-bottom: 0;
}
.chem-data-values {
  margin: 0;
  padding: 12px 17px;
  border-top: 1px solid #dfe7ed;
  font-size: 14px;
}
.chem-data-values > summary {
  cursor: pointer;
  font-weight: 700;
  color: #315b7a;
  min-height: 32px;
}
.chem-particle-panels,
.chem-structure-panels {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
}
.chem-particle-panels > div,
.chem-structure-panels > div {
  flex: 1 1 250px;
  max-width: 360px;
  text-align: center;
  min-width: 220px;
}
.chem-particle-panels svg,
.chem-structure-panels svg {
  display: block;
  width: 100%;
  height: auto;
}
.chem-particle-panels > div > strong,
.chem-structure-panels > div > strong {
  display: block;
  padding: 10px;
  color: #314f72;
  font-size: 16px;
}
.chem-particle-key {
  flex-basis: 100%;
  font-size: 14px;
  color: #435f74;
  padding: 0 10px;
}
.chem-notes > nav > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid #cad8e5;
  border-radius: 9px;
  background: #fff;
  color: #315777;
  text-decoration: none;
  font-size: 14px;
  font-weight: 750;
}
@media (max-width: 600px) {
  .chem-exam-figure > figcaption {
    font-size: 14px;
    padding: 12px;
  }
  .chem-data-scroll {
    padding: 5px;
  }
  .chem-exam-figure th,
  .chem-exam-figure td {
    padding: 10px;
    font-size: 14px;
  }
  .chem-diagram-scroll {
    padding: 10px 4px;
  }
  .chem-exam-figure:has(.chem-diagram-scroll > svg):after {
    content: 'Swipe across the diagram if needed';
    display: block;
    padding: 8px 12px;
    background: #f3f7fa;
    color: #506b7c;
    font-size: 12px;
  }
}
@media print {
  .chem-diagram-scroll,
  .chem-data-scroll {
    overflow: visible;
  }
  .chem-diagram-scroll > svg {
    min-width: 0;
  }
  .chem-exam-figure {
    break-inside: avoid;
  }
}
