/* ==========================================================
   StatsCalc calculator foundation
========================================================== */

.statscalc-tool-frame {
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.statscalc-tool-frame .card,
.statscalc-tool-frame .card-body,
.statscalc-tool-frame .row,
.statscalc-tool-frame [class*="col-"],
.statscalc-tool-frame input,
.statscalc-tool-frame textarea,
.statscalc-tool-frame select,
.statscalc-tool-frame button {
  box-sizing: border-box;
}

.statscalc-tool-frame .card,
.statscalc-tool-frame .card-body,
.statscalc-tool-frame .row,
.statscalc-tool-frame [class*="col-"] {
  min-width: 0;
  max-width: 100%;
}

.statscalc-tool-frame .card {
  border-radius: 1rem;
}

.statscalc-tool-frame .card-body {
  overflow: hidden;
}

.statscalc-tool-frame input,
.statscalc-tool-frame textarea,
.statscalc-tool-frame select {
  max-width: 100%;
}

.statscalc-tool-frame .form-label {
  color: var(--sc-primary, #138439);
}

.statscalc-tool-frame .form-text {
  color: #64748b;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ==========================================================
   Result section
========================================================== */

.statscalc-tool-frame .statcalc-result,
.statscalc-tool-frame .statscalc-result,
.statscalc-tool-frame [id*="result"] {
  max-width: 100%;
  overflow-wrap: break-word;
}

.statscalc-tool-frame .alert-success {
  border-color: rgba(19, 132, 57, 0.22);
  background: #e8f7ee;
  color: #0f5132;
}

.statscalc-tool-frame .alert-danger {
  border-color: rgba(220, 53, 69, 0.25);
}

.statscalc-tool-frame .display-6 {
  line-height: 1.1;
}

/* ==========================================================
   Step-by-step explanation
========================================================== */

.statscalc-tool-frame .statcalc-steps,
.statscalc-tool-frame .statscalc-steps,
.statscalc-tool-frame [id*="steps"] {
  max-width: 100%;
}

.statscalc-tool-frame .statcalc-steps-card,
.statscalc-tool-frame .statscalc-steps-card {
  border-radius: 1rem;
  background: #ffffff;
  overflow: hidden;
}

.statscalc-tool-frame .statcalc-steps-card > .card-body,
.statscalc-tool-frame .statscalc-steps-card > .card-body {
  padding: 1.5rem;
}

.statscalc-tool-frame .statcalc-step,
.statscalc-tool-frame .statscalc-step {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 4px solid var(--sc-primary, #138439);
  border-radius: 0.85rem;
  padding: 1rem;
  margin-bottom: 1rem;
  max-width: 100%;
  overflow: hidden;
}

.statscalc-tool-frame .statcalc-step:last-child,
.statscalc-tool-frame .statscalc-step:last-child {
  margin-bottom: 0;
}

.statscalc-tool-frame .statcalc-step h3,
.statscalc-tool-frame .statscalc-step h3,
.statscalc-tool-frame .statcalc-step h4,
.statscalc-tool-frame .statscalc-step h4 {
  color: #172033;
  margin-bottom: 0.55rem;
}

.statscalc-tool-frame .statcalc-step p,
.statscalc-tool-frame .statscalc-step p {
  color: #334155;
  line-height: 1.7;
  margin-bottom: 0.75rem;
  overflow-wrap: break-word;
  word-break: normal;
}

.statscalc-tool-frame .statcalc-step p:last-child,
.statscalc-tool-frame .statscalc-step p:last-child {
  margin-bottom: 0;
}

/* Clean list style for calculator explanations */
.statscalc-tool-frame .statcalc-clean-list,
.statscalc-tool-frame .statscalc-clean-list {
  padding-left: 1.15rem;
  margin-bottom: 0;
}

.statscalc-tool-frame .statcalc-clean-list li,
.statscalc-tool-frame .statscalc-clean-list li {
  margin-bottom: 0.45rem;
  line-height: 1.65;
}

.statscalc-tool-frame .statcalc-clean-list li:last-child,
.statscalc-tool-frame .statscalc-clean-list li:last-child {
  margin-bottom: 0;
}

.statscalc-tool-frame .statcalc-clean-list strong,
.statscalc-tool-frame .statscalc-clean-list strong {
  color: #172033;
  font-weight: 700;
  white-space: nowrap;
}

/* Inline formula style without MathJax */
.statscalc-tool-frame .statcalc-inline-formula,
.statscalc-tool-frame .statscalc-inline-formula {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 0.65rem;
  padding: 0.75rem 0.9rem;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}

/* Better separators when calculators use hr */
.statscalc-tool-frame .statcalc-steps-card hr,
.statscalc-tool-frame .statscalc-steps-card hr {
  margin: 1rem 0;
  border-color: #e2e8f0;
  opacity: 1;
}

/* Note box */
.statscalc-tool-frame .statcalc-note,
.statscalc-tool-frame .statscalc-note,
.statscalc-tool-frame .statcalc-steps-card .alert-success,
.statscalc-tool-frame .statscalc-steps-card .alert-success {
  border-radius: 0.85rem;
  border-color: rgba(19, 132, 57, 0.22);
  background: #e8f7ee;
  color: #14532d;
  line-height: 1.65;
}

/* Copy button area */
.statscalc-copy-explanation-wrap {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.statscalc-copy-note {
  color: #64748b;
  font-size: 0.875rem;
}

/* ==========================================================
   MathJax / LaTeX handling
========================================================== */

/*
Keep inline MathJax inline. Use Unicode/plain HTML for short expressions
when possible, such as α, df₁, df₂, H₀, and F-subscript notation.
*/
.statscalc-tool-frame mjx-container:not([display="true"]) {
  display: inline !important;
  max-width: 100%;
  overflow-x: visible !important;
  overflow-y: hidden !important;
  vertical-align: baseline;
}

/* Display MathJax should only be used for long standalone equations */
.statscalc-tool-frame mjx-container[display="true"] {
  display: block !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  padding: 0.35rem 0;
  -webkit-overflow-scrolling: touch;
}

/* Use only around long formulas */
.statscalc-math-scroll,
.statcalc-math-scroll {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.35rem 0;
  -webkit-overflow-scrolling: touch;
}

.statscalc-math-scroll mjx-container,
.statcalc-math-scroll mjx-container {
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
}

/* ==========================================================
   Tables, code, charts
========================================================== */

.statscalc-tool-frame table,
.statscalc-tool-frame .table {
  max-width: 100%;
  margin-bottom: 0;
}

.statscalc-tool-frame .table-responsive,
.statscalc-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.statscalc-tool-frame pre {
  max-width: 100%;
  overflow-x: auto;
  white-space: pre-wrap;
}

.statscalc-tool-frame code {
  overflow-wrap: anywhere;
}

.statscalc-tool-frame canvas,
.statscalc-tool-frame svg {
  max-width: 100%;
}

/* ==========================================================
   Ad safety
========================================================== */

.statscalc-tool-frame .adsbygoogle,
.statscalc-tool-frame ins.adsbygoogle,
.statscalc-tool-frame iframe[src*="googlesyndication"],
.statscalc-tool-frame iframe[src*="doubleclick"] {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
}

.statscalc-ad-after-tool {
  width: 100%;
  min-height: 90px;
  margin: 1.5rem 0;
  overflow: hidden;
}

/* ==========================================================
   Mobile refinements
========================================================== */

@media (max-width: 575.98px) {
  .statscalc-tool-frame .card-body {
    padding: 1.25rem !important;
  }

  .statscalc-tool-frame .btn {
    white-space: normal;
  }

  .statscalc-tool-frame form .btn[id$="_calc_btn"],
  .statscalc-tool-frame form .btn[id$="_reset_btn"],
  .statscalc-tool-frame form [data-cochran-action="calculate"],
  .statscalc-tool-frame form [data-cochran-action="reset"],
  .statscalc-tool-frame form [data-fcrit-action="calculate"],
  .statscalc-tool-frame form [data-fcrit-action="reset"] {
    width: 100%;
  }

  .statscalc-tool-frame h2,
  .statscalc-tool-frame .h4,
  .statscalc-tool-frame .statcalc-tool-title {
    font-size: 1.25rem;
  }

  .statscalc-tool-frame .display-6 {
    font-size: 2rem;
  }

  .statscalc-tool-frame .statcalc-steps-card > .card-body,
  .statscalc-tool-frame .statscalc-steps-card > .card-body {
    padding: 1rem;
  }

  .statscalc-tool-frame .statcalc-step,
  .statscalc-tool-frame .statscalc-step {
    padding: 0.9rem;
  }
}
/* StatCalc standardized tool heading + ad-safe wrapper. This does not hide or alter original calculator markup. */
.statscalc-tool-frame {
  position: relative;
  margin: 1.5rem 0;
  background: #fff;
  border: 1px solid rgba(19,132,57,.16);
  border-radius: 1rem;
  box-shadow: 0 .65rem 1.75rem rgba(15,23,42,.08);
  overflow: hidden;
}
.statscalc-tool-heading { padding: 1.35rem 1.35rem 0; }
@media (min-width: 992px){ .statscalc-tool-heading { padding: 1.75rem 1.75rem 0; } }
.statscalc-tool-main-title { font-size: clamp(1.65rem,3vw,2.35rem); line-height:1.15; color:#0f172a; font-weight:800; letter-spacing:-.025em; }
.statscalc-tool-main-intro { max-width:900px; color:#475569; font-size:1.02rem; line-height:1.65; }
.statscalc-tool-main-badge { display:inline-flex; align-items:center; border:1px solid rgba(19,132,57,.2); background:rgba(19,132,57,.08); color:#138439; border-radius:999px; font-weight:700; font-size:.78rem; padding:.4rem .7rem; white-space:nowrap; }
.statscalc-tool-frame > .card,
.statscalc-tool-frame > .statcalc-tool { margin-top:0!important; margin-bottom:0!important; border-left:0!important; border-right:0!important; border-bottom:0!important; border-radius:0!important; box-shadow:none!important; }
.statscalc-tool-frame [class*="step"], .statscalc-tool-frame [id*="steps"], .statscalc-tool-frame [data-output*="steps"] { overflow-wrap:anywhere; }
.statscalc-tool-frame .formula, .statscalc-tool-frame .statcalc-formula, .statscalc-tool-frame pre, .statscalc-tool-frame code { white-space:pre-wrap; word-break:break-word; }
.statscalc-tool-frame table { max-width:100%; }
.statscalc-tool-frame .table-responsive { overflow-x:auto; }
.statscalc-ad-exclude, .statscalc-tool-frame, .no-auto-ads, .ezoic-adpicker-ignore { break-inside:avoid; }
.statscalc-tool-frame ins.adsbygoogle, .statscalc-tool-frame .adsbygoogle, .statscalc-tool-frame [id^="google_ads"], .statscalc-tool-frame iframe[src*="googlesyndication"], .statscalc-tool-frame iframe[src*="doubleclick"] { display:none!important; visibility:hidden!important; height:0!important; min-height:0!important; max-height:0!important; margin:0!important; padding:0!important; overflow:hidden!important; }
