.library-shell {
  width: min(100% - 28px, 1040px);
  margin: 0 auto;
  padding: clamp(44px, 7vw, 78px) 0 clamp(54px, 9vw, 88px);
}

.library-subject-hero,
.library-detail-problem {
  display: grid;
  gap: 14px;
  margin-bottom: 36px;
}

.library-subject-hero {
  text-align: center;
}

.library-subject-hero h1 {
  margin: 0;
  color: #101828;
  font-size: clamp(2.2rem, 6vw, 4.2rem);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.08;
}

.library-detail-problem h1 {
  margin: 0;
  color: #101828;
  font-size: 1.08rem;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.08;
}

.library-subject-hero p,
.library-detail-problem p,
.library-subject-hero span {
  max-width: 720px;
  margin: 0 auto;
  color: #667085;
  font-size: 1.05rem;
  line-height: 1.65;
}

.library-back-link {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  margin-left: -6px;
  border-radius: 999px;
  color: #101828;
  justify-self: start;
  text-decoration: none;
  transform: translateY(-18px);
}

.library-back-link:hover {
  background: #f8fafc;
}

.library-back-link svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.library-problem-list {
  display: grid;
  gap: 16px;
}

.library-problem-list h2 {
  margin: 0 0 6px;
  color: #101828;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 500;
}

.library-problem-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 8px;
  background: #ffffff;
  color: #101828;
  padding: 18px 20px;
  text-decoration: none;
  box-shadow: 0 10px 28px rgba(16, 24, 40, 0.055);
}

.library-problem-card:hover,
.library-problem-card:focus-visible {
  border-color: rgba(23, 105, 232, 0.32);
  transform: translateY(-1px);
}

.library-problem-question {
  min-width: 0;
  font-size: 1.06rem;
  line-height: 1.6;
}

.library-problem-chevron {
  color: #98a2b3;
  font-size: 1.05rem;
  line-height: 1;
}

.library-problem-meta {
  color: #667085;
  font-size: 0.9rem;
  font-weight: 700;
}

.library-empty {
  margin: 0;
  border: 1px dashed rgba(15, 23, 42, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: #667085;
  padding: 16px;
}

.library-detail-shell {
  max-width: 920px;
}

.library-detail-problem {
  margin-top: 18px;
  box-sizing: border-box;
  padding-inline: 28px;
}

.library-solution-box {
  margin-top: 24px;
}

.library-solution-box .solution-heading h2 {
  font-size: 1.35rem;
}

.library-solution-meta {
  flex: 0 1 auto;
  color: #94a3b8;
  font-size: 0.88rem;
  font-weight: 650;
  line-height: 1.3;
  text-align: right;
}

.library-solution-content,
.library-result-content,
.library-preview-content {
  color: #253041;
  font-size: 1.04rem;
  line-height: 1.7;
}

.library-solution-content p,
.library-solution-content ul,
.library-solution-content ol,
.library-result-content p,
.library-result-content ul,
.library-result-content ol,
.library-preview-content p,
.library-preview-content ul,
.library-preview-content ol {
  margin: 0 0 1rem;
}

.library-solution-content ul,
.library-solution-content ol,
.library-result-content ul,
.library-result-content ol,
.library-preview-content ul,
.library-preview-content ol {
  padding-left: 1.35rem;
}

.library-solution-content li,
.library-result-content li,
.library-preview-content li {
  margin: 0 0 0.55rem;
}

.library-solution-content .math-line:has(.math-frac),
.library-result-content .math-line:has(.math-frac),
.library-preview-content .math-line:has(.math-frac),
.library-solution-content .math-line-katex:has(.mfrac),
.library-result-content .math-line-katex:has(.mfrac),
.library-preview-content .math-line-katex:has(.mfrac) {
  display: inline-block;
  min-height: 2.75em;
  line-height: 2.35;
}

.library-result-section {
  margin-top: 28px;
  border-top: 1px solid rgba(15, 23, 42, 0.1);
  padding-top: 18px;
}

.library-result-section h3 {
  margin: 0 0 8px;
  color: #667085;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.2;
  text-transform: uppercase;
}

.library-result-content > :last-child,
.library-solution-content > :last-child,
.library-preview-content > :last-child {
  margin-bottom: 0;
}

.library-result-content {
  overflow-wrap: anywhere;
}

.library-solution-content img,
.library-result-content img,
.library-preview-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1rem 0;
  border-radius: 8px;
}

.library-graph-panel {
  margin: 0 0 24px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 8px;
  background: #ffffff;
  padding: 18px;
}

.library-graph-panel canvas {
  display: block;
  width: 100%;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 8px;
}

.library-admin-problem-table .help-admin-table-head,
.library-admin-problem-table .help-admin-row {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) 120px 120px 150px;
}

.library-admin-subject-table .help-admin-table-head,
.library-admin-subject-table .help-admin-row {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) 100px 150px;
}

.library-admin-subtabs {
  margin: 0 0 20px;
}

.library-admin-title-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.library-admin-title-actions .pricing-button,
.library-import-submit {
  width: auto;
}

.library-import-trigger {
  min-height: 46px;
  border-radius: 12px;
  padding: 0 18px;
  font-size: 1rem;
}

.library-import-submit {
  min-height: 46px;
  align-self: start;
  border-radius: 12px;
  font-size: 1rem;
}

.library-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  color: #667085;
  font-size: 0.92rem;
}

.library-pagination p {
  margin: 0;
}

.library-pagination-controls,
.library-pagination-pages {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.library-pagination-link {
  display: inline-flex;
  min-height: 36px;
  min-width: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(17, 24, 39, 0.14);
  border-radius: 8px;
  background: #ffffff;
  color: #111827;
  padding: 0 12px;
  text-decoration: none;
}

.library-pagination-link.is-active {
  border-color: rgba(15, 23, 42, 0.16);
  background: var(--help-slate-soft, #edf2f7);
  color: #111827;
  font-weight: 800;
}

.library-pagination-link.is-disabled {
  color: #98a2b3;
}

.library-pagination-step {
  min-width: auto;
  min-height: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0 10px;
}

.library-import-dialog .help-article-preview-dialog-shell {
  display: grid;
  gap: 18px;
}

.library-import-form {
  gap: 16px;
}

@media (max-width: 760px) {
  .library-admin-problem-table {
    width: max(100%, 760px);
  }

  .library-admin-subject-table {
    width: max(100%, 620px);
  }

  .library-subject-hero {
    text-align: left;
  }

  .library-subject-hero p,
  .library-subject-hero span {
    margin-left: 0;
  }

  .library-detail-problem {
    padding-inline: 20px;
  }

  .library-solution-box .solution-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .library-solution-meta {
    text-align: left;
  }

  .library-admin-title-actions {
    justify-content: flex-start;
  }
}

/* Library problem form actions */
.help-admin-button.library-problem-preview-button {
  border: 1px solid #cbd5e1;
}

.help-admin-button.library-problem-preview-button:hover,
.help-admin-button.library-problem-preview-button:focus-visible {
  border-color: #94a3b8;
}

.help-admin-submit.account-primary-button.library-problem-save-button {
  min-height: 2.5rem;
  border: 0;
  border-radius: 999px;
  background: #dbeafe;
  color: #1e40af;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0 18px;
}

.help-admin-submit.account-primary-button.library-problem-save-button:hover,
.help-admin-submit.account-primary-button.library-problem-save-button:focus-visible {
  background: #bfdbfe;
}

.library-solution-content .math-frac,
.library-result-content .math-frac,
.library-preview-content .math-frac {
  display: inline-grid;
  align-items: center;
  justify-content: center;
  justify-items: center;
  grid-template-rows: auto auto;
  min-width: 1.25em;
  margin: 0 0.14em;
  vertical-align: middle;
  font-size: 0.92em;
  line-height: 1.14;
  text-align: center;
}

.library-solution-content .math-frac .math-frac,
.library-result-content .math-frac .math-frac,
.library-preview-content .math-frac .math-frac {
  font-size: 1em;
}

.library-solution-content .math-num,
.library-solution-content .math-den,
.library-result-content .math-num,
.library-result-content .math-den,
.library-preview-content .math-num,
.library-preview-content .math-den {
  display: block;
  width: 100%;
  padding: 0 0.28em;
  box-sizing: border-box;
  line-height: 1.18;
  white-space: nowrap;
}

.library-solution-content .math-num,
.library-result-content .math-num,
.library-preview-content .math-num {
  border-bottom: 1.5px solid currentColor;
  padding-bottom: 0.26em;
}

.library-solution-content .math-den,
.library-result-content .math-den,
.library-preview-content .math-den {
  padding-top: 0.28em;
}

.library-solution-content .math-frac sup,
.library-result-content .math-frac sup,
.library-preview-content .math-frac sup {
  position: relative;
  top: -0.18em;
  font-size: 0.58em;
  line-height: 0;
}

.library-solution-content .math-subscript .math-base,
.library-result-content .math-subscript .math-base,
.library-preview-content .math-subscript .math-base {
  font-style: italic;
}

.library-solution-content .math-subscript-letter sub,
.library-result-content .math-subscript-letter sub,
.library-preview-content .math-subscript-letter sub {
  font-style: italic;
}

.library-solution-content .math-subscript-number sub,
.library-result-content .math-subscript-number sub,
.library-preview-content .math-subscript-number sub {
  font-style: normal;
}

.library-solution-content sup,
.library-solution-content sub,
.library-result-content sup,
.library-result-content sub,
.library-preview-content sup,
.library-preview-content sub {
  position: relative;
  font-size: 0.68em;
  line-height: 0;
}

.library-solution-content sup,
.library-result-content sup,
.library-preview-content sup {
  top: -0.45em;
}

.library-solution-content sub,
.library-result-content sub,
.library-preview-content sub {
  bottom: -0.2em;
}

.library-solution-content .math-line-katex .mfrac,
.library-result-content .math-line-katex .mfrac,
.library-preview-content .math-line-katex .mfrac {
  font-size: 0.92em;
}

.library-solution-content .math-line-katex .mfrac .mfrac,
.library-result-content .math-line-katex .mfrac .mfrac,
.library-preview-content .math-line-katex .mfrac .mfrac {
  font-size: 1em;
}
