/* ==========================================================================
   Overlays and trust UI: toasts, confirm/info, E-E-A-T, cookies, rough pad.
   Loaded after base/exam/dashboard so it never changes their core layout.
   ========================================================================== */

/* ---------- TOASTS ---------- */
.ss-toast-stack {
  position: fixed;
  z-index: 500;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  right: 10px;
  max-width: min(420px, calc(100vw - 20px));
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ss-toast {
  padding: 10px 14px;
  border-radius: 10px;
  color: #fff;
  background: #1e293b;
  border-left: 4px solid #38bdf8;
  box-shadow: 0 10px 30px rgba(0,0,0,.32);
  font-size: 12.5px;
  line-height: 1.45;
  animation: ssToastIn .2s ease-out;
}
.ss-toast.error { border-left-color: #ef4444; }
.ss-toast.success { border-left-color: #22c55e; }
.ss-toast.leaving { opacity: 0; transform: translateY(-8px); transition: .24s ease; }
@keyframes ssToastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- CUSTOM CONFIRM / INFO ---------- */
.ss-confirm-overlay, .ss-trust-overlay, .ss-rough-overlay {
  position: fixed;
  inset: 0;
  z-index: 360;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: rgba(15, 23, 42, .84);
  backdrop-filter: blur(3px);
}
.ss-confirm-card, .ss-trust-card, .ss-rough-card {
  width: 100%;
  max-width: 440px;
  background: #fff;
  border-radius: 13px;
  border-top: 5px solid var(--secondary, #2563eb);
  box-shadow: 0 18px 45px rgba(0,0,0,.38);
  overflow: hidden;
}
.ss-confirm-card { padding: 18px; text-align: center; }
.ss-confirm-card h3 { font-size: 16px; color: var(--primary, #14234a); margin-bottom: 8px; }
.ss-confirm-card p { font-size: 13px; line-height: 1.5; color: var(--text-muted, #475569); margin-bottom: 15px; white-space: pre-line; }
.ss-confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ss-confirm-actions .btn { min-height: 44px; }

/* ---------- E-E-A-T TRUST MODAL + FOOTER ---------- */
.ss-trust-card { max-height: 82vh; display: flex; flex-direction: column; }
.ss-trust-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 11px 14px; color: #fff; background: var(--primary, #14234a);
}
.ss-trust-head h3 { font-size: 14px; font-weight: 800; }
.ss-trust-body { padding: 14px; overflow-y: auto; font-size: 12.5px; line-height: 1.6; color: #334155; }
.ss-trust-body p { margin-bottom: 9px; }
.ss-trust-body a { color: #1d4ed8; text-decoration: underline; }
.ss-trust-footer {
  border-top: 1px solid #e2e8f0;
  padding: 11px 4px 4px;
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
}
.ss-trust-footer button {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #f8fafc;
  color: #1e40af;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.ss-trust-footer small { width: 100%; text-align: center; color: #64748b; font-size: 10.5px; margin-top: 3px; }

/* ---------- COOKIE CONSENT ---------- */
.ss-cookie-banner {
  position: fixed;
  z-index: 430;
  left: 10px;
  right: 10px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 11px 13px;
  border: 1px solid #334155;
  border-radius: 11px;
  background: #0f172a;
  color: #e2e8f0;
  box-shadow: 0 12px 30px rgba(0,0,0,.35);
}
.ss-cookie-banner span { flex: 1 1 100%; font-size: 11.5px; line-height: 1.45; }
.ss-cookie-banner .btn { min-height: 38px; font-size: 11px; }

/* ---------- ROUGH WORK PAD ---------- */
.ss-rough-card { max-width: 620px; }
.ss-rough-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: var(--primary, #14234a); color: #fff;
}
.ss-rough-head h3 { font-size: 14px; font-weight: 800; }
.ss-rough-note { margin: 8px 12px 0; font-size: 11px; color: #64748b; }
.ss-rough-canvas {
  display: block;
  width: calc(100% - 24px);
  height: min(54vh, 430px);
  margin: 9px 12px;
  border: 1.5px dashed #94a3b8;
  border-radius: 8px;
  background: #fff;
  touch-action: none;
}
.ss-rough-tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 12px 13px; }
.ss-rough-tools .btn { min-height: 44px; font-size: 12px; }
.ss-rough-tools .btn.active { outline: 2px solid #16a34a; outline-offset: -2px; }

/* KaTeX display blocks must not push the exam buttons around. */
.katex-display { margin: .35em 0; overflow-x: auto; overflow-y: hidden; }
.katex { font-size: 1.02em; }
