@scope (#original-content) {

/* ===== RESET & SCOPE ===== */
#kst-page *, #kst-page *::before, #kst-page *::after { box-sizing: border-box; margin: 0; padding: 0; }
#kst-page {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #ffffff;
  color: #1a1a2e;
  line-height: 1.75;
  max-width: 980px;
  margin: 0 auto;
  padding: 0 16px 56px;
}

/* ===== HEADER ===== */
#kst-page .kst-header {
  text-align: center;
  padding: 40px 20px 32px;
  border-bottom: 3px solid #2563eb;
  margin-bottom: 28px;
}
#kst-page .kst-header h1 {
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  font-weight: 900;
  color: #1e3a8a;
  letter-spacing: -0.5px;
  line-height: 1.2;
  margin-bottom: 10px;
}
#kst-page .kst-header p.subtitle {
  font-size: 1.05rem;
  color: #374151;
  font-weight: 600;
  max-width: 700px;
  margin: 0 auto 16px;
}
#kst-page .badge-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
#kst-page .badge {
  background: #eff6ff;
  border: 1.5px solid #2563eb;
  color: #1d4ed8;
  font-size: 0.77rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== TOC ===== */
#kst-page .kst-toc {
  background: #eff6ff;
  border-left: 4px solid #2563eb;
  border-radius: 0 8px 8px 0;
  padding: 18px 22px;
  margin-bottom: 30px;
}
#kst-page .kst-toc h2 { font-size: 0.88rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: #1d4ed8; margin-bottom: 10px; }
#kst-page .kst-toc ol { padding-left: 20px; }
#kst-page .kst-toc li { margin-bottom: 5px; font-size: 0.92rem; font-weight: 600; }
#kst-page .kst-toc a { color: #2563eb; text-decoration: none; }
#kst-page .kst-toc a:hover { text-decoration: underline; }

/* ===== SECTIONS ===== */
#kst-page .kst-section {
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  padding: 28px 30px;
  margin-bottom: 28px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
#kst-page .kst-section h2 {
  font-size: 1.45rem;
  font-weight: 800;
  color: #1e3a8a;
  border-bottom: 2.5px solid #2563eb;
  padding-bottom: 10px;
  margin-bottom: 18px;
}
#kst-page .kst-section h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1d4ed8;
  margin: 20px 0 10px;
}
#kst-page .kst-section h4 { font-size: 1rem; font-weight: 700; color: #374151; margin: 14px 0 8px; }
#kst-page .kst-section p { font-size: 0.97rem; font-weight: 600; color: #1f2937; margin-bottom: 12px; }
#kst-page .kst-section ul, #kst-page .kst-section ol { padding-left: 22px; margin-bottom: 14px; }
#kst-page .kst-section li { font-size: 0.95rem; font-weight: 600; color: #1f2937; margin-bottom: 6px; }

/* ===== INFO / WARN BOXES ===== */
#kst-page .info-box { background: #eff6ff; border-left: 4px solid #2563eb; border-radius: 0 8px 8px 0; padding: 14px 18px; margin: 14px 0; }
#kst-page .info-box p { margin: 0; }
#kst-page .warn-box { background: #fefce8; border-left: 4px solid #ca8a04; border-radius: 0 8px 8px 0; padding: 14px 18px; margin: 14px 0; }

/* ===== MATH BLOCKS ===== */
#kst-page .math-block {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px 22px;
  margin: 16px 0;
  text-align: center;
  overflow-x: auto;
  font-size: 1.05rem;
  line-height: 1.8;
}
#kst-page .math-block .label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: #6b7280;
  text-align: left;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== MATHJAX WORDPRESS GUARDS ===== */
/* Force CHTML containers to display correctly regardless of theme CSS */
#kst-page mjx-container {
  display: inline-block !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  max-width: 100% !important;
  vertical-align: middle !important;
}
#kst-page mjx-container[display="true"] {
  display: block !important;
  margin: 10px auto !important;
  text-align: center !important;
}
#kst-page .MJX-TEX {
  font-size: inherit !important;
}
/* Prevent theme SVG/img resets from scaling MathJax down */
#kst-page mjx-container svg {
  max-width: none !important;
  min-height: unset !important;
  height: auto !important;
  vertical-align: middle !important;
}
#kst-page .math-block mjx-container {
  font-size: 1.15rem !important;
  padding: 4px 0;
}

/* ===== TABLES ===== */
#kst-page .kst-table-wrap { overflow-x: auto; margin: 16px 0; }
#kst-page .kst-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
#kst-page .kst-table th { background: #2563eb; color: #fff; padding: 10px 14px; text-align: left; font-weight: 700; }
#kst-page .kst-table td { padding: 9px 14px; border-bottom: 1px solid #e5e7eb; font-weight: 600; color: #1f2937; }
#kst-page .kst-table tr:nth-child(even) td { background: #f9fafb; }
#kst-page .kst-table tr:hover td { background: #eff6ff; }
#kst-page .kst-table td.hl { color: #1d4ed8; font-weight: 800; }

/* ===== CALCULATOR WIDGET ===== */
#kst-page .viz-container {
  background: #f8fafc;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 12px;
}
#kst-page .kst-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 2px solid #e5e7eb;
}
#kst-page .kst-tab {
  padding: 9px 18px;
  cursor: pointer;
  background: #f1f5f9;
  border: 1.5px solid #e5e7eb;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: #374151;
  transition: all 0.2s;
}
#kst-page .kst-tab:hover { background: #dbeafe; }
#kst-page .kst-tab.active { background: #fff; border-bottom: 2px solid #fff; margin-bottom: -2px; color: #1d4ed8; }
#kst-page .kst-tab-content { display: none; }
#kst-page .kst-tab-content.active { display: block; }

#kst-page .ctrl-row { display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 18px; }
#kst-page .ctrl-col { flex: 1; min-width: 220px; }
#kst-page .ctrl-col h4 { margin: 0 0 10px; font-size: 0.9rem; font-weight: 800; color: #1e3a8a; text-transform: uppercase; letter-spacing: 0.5px; }
#kst-page .form-grp { margin-bottom: 12px; }
#kst-page .form-grp label { display: block; font-size: 0.85rem; font-weight: 700; color: #374151; margin-bottom: 4px; }
#kst-page .form-grp select, #kst-page .form-grp input[type="number"], #kst-page .form-grp input[type="range"] {
  width: 100%;
  padding: 7px 10px;
  border: 1.5px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  color: #1f2937;
}
#kst-page .form-grp select:focus, #kst-page .form-grp input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px #bfdbfe; }
#kst-page .kst-btn {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 10px 22px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  transition: background 0.2s, transform 0.1s;
  width: 100%;
  margin-top: 4px;
}
#kst-page .kst-btn:hover { background: #1d4ed8; transform: translateY(-1px); }

#kst-page .kst-legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 10px 0; }
#kst-page .kst-legend-item { display: flex; align-items: center; font-size: 0.85rem; font-weight: 700; }
#kst-page .kst-legend-color { width: 22px; height: 14px; border-radius: 3px; margin-right: 7px; }

#kst-page .viz-area {
  position: relative;
  height: 420px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  margin-top: 16px;
  overflow: hidden;
}
#kst-page .kst-canvas { width: 100%; height: 100%; }

#kst-page .kst-results {
  background: #eff6ff;
  border-left: 4px solid #2563eb;
  border-radius: 0 8px 8px 0;
  padding: 16px 20px;
  margin-top: 18px;
}
#kst-page .kst-results .res-title { font-weight: 800; font-size: 1rem; color: #1e3a8a; margin-bottom: 10px; }
#kst-page .kst-results .res-item { font-size: 0.92rem; font-weight: 600; color: #1f2937; margin-bottom: 6px; }
#kst-page .kst-results .res-item.reject { color: #dc2626; font-weight: 700; }
#kst-page .kst-results .res-item.accept { color: #15803d; font-weight: 700; }

#kst-page .kst-explanation { background: #f0fdf4; border-left: 4px solid #16a34a; border-radius: 0 8px 8px 0; padding: 14px 18px; margin-top: 18px; }
#kst-page .kst-tooltip {
  position: absolute;
  padding: 7px 11px;
  background: rgba(30,58,138,0.92);
  color: #fff;
  border-radius: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s;
  z-index: 100;
}

/* ===== FAQ ===== */
#kst-page .faq-item { border: 1.5px solid #e5e7eb; border-radius: 8px; margin-bottom: 10px; overflow: hidden; }
#kst-page .faq-q { background: #f9fafb; padding: 13px 18px; font-weight: 800; font-size: 0.95rem; color: #1e3a8a; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 8px; user-select: none; }
#kst-page .faq-q::after { content: '+'; font-size: 1.3rem; font-weight: 900; color: #2563eb; flex-shrink: 0; }
#kst-page .faq-item.open .faq-q::after { content: '−'; }
#kst-page .faq-a { display: none; padding: 12px 18px; font-size: 0.93rem; font-weight: 600; color: #374151; border-top: 1px solid #e5e7eb; background: #fff; }
#kst-page .faq-item.open .faq-a { display: block; }

/* ===== FOOTER ===== */
#kst-page .kst-footer { text-align: center; padding: 24px 16px; border-top: 1.5px solid #e5e7eb; margin-top: 32px; font-size: 0.85rem; color: #6b7280; font-weight: 600; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  #kst-page .kst-section { padding: 20px 16px; }
  #kst-page .ctrl-row { flex-direction: column; }
  #kst-page .viz-area { height: 340px; }
}
@media (max-width: 480px) {
  #kst-page .kst-tab { padding: 7px 12px; font-size: 0.78rem; }
  #kst-page .viz-area { height: 280px; }
}

}
