/* ─────────────────────────────────────────────────────────────────────
   QuizLander design system
   Loaded by base.html. Tokens + components share a `sq-` prefix.
   ───────────────────────────────────────────────────────────────────── */

:root {
  /* Brand — Calm Focus palette: deep indigo + warm amber on warm paper.
     Research-backed for sustained reading and exam focus. */
  --sq-primary:        #1E3A5F;        /* deep indigo */
  --sq-primary-soft:   #E4ECF5;        /* indigo tint */
  --sq-primary-hover:  #142A47;        /* darker indigo for hover */
  --sq-accent:         #E8A33D;        /* warm amber */
  --sq-accent-soft:    #FBEFD4;        /* amber tint */
  --sq-accent-hover:   #C7861F;
  --sq-ink:            #0F1419;        /* near-black for headings */

  /* Surfaces — warm off-white reduces eye strain over long sessions */
  --sq-bg:             #F7F4ED;        /* warm paper */
  --sq-surface:        #ffffff;
  --sq-surface-soft:   #FBF8F2;
  --sq-surface-elev:   #ffffff;
  --sq-rule:           #1E3A5F;        /* hairline rule for editorial sections */

  /* Text */
  --sq-text:           #1A2233;
  --sq-text-muted:     #4A5568;
  --sq-text-light:     #788294;
  --sq-text-faint:     #B5BCC8;

  /* Borders */
  --sq-border:         #E4E0D5;
  --sq-border-soft:    #EFEBE0;
  --sq-border-input:   #D4CFC1;

  /* Status — saturation calibrated to the warm paper background */
  --sq-success:        #2D8659;        /* forest green */
  --sq-success-soft:   #E6F2EB;
  --sq-success-text:   #1F5B3D;
  --sq-warning:        #B47517;        /* deep amber */
  --sq-warning-soft:   #FBF0DA;
  --sq-warning-text:   #7A4E0F;
  --sq-danger:         #C0392B;        /* brick red */
  --sq-danger-soft:    #FBE9E7;
  --sq-danger-text:    #862519;
  --sq-info:           #2B7A9E;        /* steel blue */
  --sq-info-soft:      #E1EDF3;
  --sq-info-text:      #1B536D;

  /* Radii */
  --sq-radius-xs:      6px;
  --sq-radius-sm:      8px;
  --sq-radius-md:      10px;
  --sq-radius-lg:      14px;
  --sq-radius-xl:      18px;
  --sq-radius-pill:    999px;

  /* Shadows — tuned to the indigo primary */
  --sq-shadow-xs:      0 1px 2px rgba(15, 20, 25, .04);
  --sq-shadow-sm:      0 2px 6px rgba(15, 20, 25, .05);
  --sq-shadow-md:      0 6px 18px rgba(15, 20, 25, .07);
  --sq-shadow-lg:      0 14px 32px rgba(30, 58, 95, .16);
  --sq-shadow-focus:   0 0 0 3px rgba(232, 163, 61, .28);

  /* Motion */
  --sq-transition:     .18s cubic-bezier(.4, 0, .2, 1);
  --sq-transition-slow:.32s cubic-bezier(.4, 0, .2, 1);

  /* Type scale */
  --sq-text-xs:        12px;
  --sq-text-sm:        13px;
  --sq-text-base:      14px;
  --sq-text-md:        15px;
  --sq-text-lg:        17px;
  --sq-text-xl:        20px;
  --sq-text-2xl:       24px;
  --sq-text-3xl:       clamp(22px, 3.5vw, 30px);
  --sq-text-display:   clamp(28px, 5vw, 42px);

  /* Layout */
  --sq-container:      1200px;
  --sq-container-narrow: 720px;
}

/* ─── Reset ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--sq-bg);
  color: var(--sq-text);
  font-size: var(--sq-text-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  min-height: 100dvh;
  text-rendering: optimizeLegibility;
}
html[lang^="ar"] body { font-family: 'Cairo', 'Inter', system-ui, sans-serif; }
html[lang^="zh"] body { font-family: 'Noto Sans SC', 'Inter', system-ui, sans-serif; }
html[dir="rtl"] .sq-back-link .sq-back-arrow { transform: scaleX(-1); }

img, svg { max-width: 100%; height: auto; }

a {
  color: var(--sq-primary);
  text-decoration: none;
  transition: color var(--sq-transition);
}
a:hover { color: var(--sq-primary-hover); }
a:focus-visible { outline: 2px solid var(--sq-accent); outline-offset: 2px; border-radius: 3px; }

/* Subtle scrollbar polish on WebKit */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cfc8b6; border-radius: 999px; border: 2px solid var(--sq-bg); }
::-webkit-scrollbar-thumb:hover { background: #b3aa94; }

/* ─── Cards ──────────────────────────────────────────────────────────── */
.sq-card {
  background: var(--sq-surface);
  border: 1px solid var(--sq-border);
  border-radius: var(--sq-radius-xl);
  padding: 2rem;
  box-shadow: var(--sq-shadow-xs);
}
@media (max-width: 575.98px) {
  .sq-card { padding: 1.5rem; border-radius: var(--sq-radius-lg); }
}

.sq-card-hover {
  transition: transform var(--sq-transition), box-shadow var(--sq-transition), border-color var(--sq-transition);
  cursor: pointer;
}
.sq-card-hover:hover {
  transform: translateY(-3px);
  box-shadow: var(--sq-shadow-lg);
  border-color: var(--sq-accent-soft);
}

/* ─── Buttons ────────────────────────────────────────────────────────── */
.sq-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--sq-radius-md);
  padding: 11px 20px;
  font-size: var(--sq-text-md);
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
  transition: background var(--sq-transition), opacity var(--sq-transition),
              border-color var(--sq-transition), color var(--sq-transition),
              transform var(--sq-transition), box-shadow var(--sq-transition);
}
.sq-btn:active { transform: scale(.985); }
.sq-btn:focus-visible { box-shadow: var(--sq-shadow-focus); outline: none; }
.sq-btn[disabled], .sq-btn:disabled { opacity: .55; cursor: not-allowed; }

.sq-btn-primary  { background: var(--sq-primary); color: #fff; }
.sq-btn-primary:hover  { background: var(--sq-primary-hover); color: #fff; box-shadow: var(--sq-shadow-md); }

.sq-btn-accent {
  background: linear-gradient(135deg, var(--sq-primary), var(--sq-accent));
  color: #fff;
}
.sq-btn-accent:hover { color: #fff; box-shadow: var(--sq-shadow-lg); transform: translateY(-1px); }

.sq-btn-outline {
  background: var(--sq-surface);
  border-color: var(--sq-border-input);
  color: var(--sq-text);
}
.sq-btn-outline:hover { background: var(--sq-surface-soft); color: var(--sq-text); border-color: var(--sq-accent-soft); }

.sq-btn-soft {
  background: var(--sq-primary-soft);
  color: var(--sq-primary);
  border-color: transparent;
}
.sq-btn-soft:hover { background: #d3deec; color: var(--sq-primary); }

.sq-btn-success {
  background: var(--sq-success-soft);
  color: var(--sq-success-text);
  border-color: #c5dfd0;
}
.sq-btn-success:hover { background: #d6ebde; color: var(--sq-success-text); }

.sq-btn-danger {
  background: var(--sq-danger-soft);
  color: var(--sq-danger);
  border-color: #f0c6c0;
}
.sq-btn-danger:hover { background: #f5d6d1; color: var(--sq-danger); }

.sq-btn-google {
  background: #fff;
  color: #444;
  border-color: var(--sq-border-input);
}
.sq-btn-google:hover { background: var(--sq-surface-soft); color: #444; }

.sq-btn-block { width: 100%; }
.sq-btn-sm { padding: 7px 12px; font-size: var(--sq-text-sm); }
.sq-btn-lg { padding: 14px 26px; font-size: var(--sq-text-lg); border-radius: var(--sq-radius-lg); }

/* ─── Inputs ─────────────────────────────────────────────────────────── */
.sq-input,
.sq-textarea,
.sq-select {
  width: 100%;
  border: 1px solid var(--sq-border-input);
  border-radius: var(--sq-radius-sm);
  padding: 11px 14px;
  font-size: var(--sq-text-base);
  font-family: inherit;
  color: var(--sq-text);
  background: #fff;
  outline: none;
  transition: border-color var(--sq-transition), box-shadow var(--sq-transition);
}
.sq-input:focus,
.sq-textarea:focus,
.sq-select:focus {
  border-color: var(--sq-accent);
  box-shadow: var(--sq-shadow-focus);
}
.sq-input::placeholder, .sq-textarea::placeholder { color: var(--sq-text-faint); }
.sq-textarea { min-height: 96px; resize: vertical; }

.sq-label {
  display: block;
  font-size: var(--sq-text-sm);
  font-weight: 500;
  color: var(--sq-text-muted);
  margin-bottom: 6px;
}

.sq-helptext {
  display: block;
  margin-top: .25rem;
  font-size: var(--sq-text-xs);
  color: var(--sq-text-light);
}

.sq-form-error {
  background: var(--sq-danger-soft);
  border: 1px solid #f0c6c0;
  border-radius: var(--sq-radius-sm);
  padding: 10px 14px;
  margin-bottom: 1rem;
  font-size: var(--sq-text-sm);
  color: var(--sq-danger);
}

.sq-form input:not([type="radio"]):not([type="checkbox"]):not([type="file"]),
.sq-form select,
.sq-form textarea {
  width: 100%;
  border: 1px solid var(--sq-border-input);
  border-radius: var(--sq-radius-sm);
  padding: 11px 14px;
  font-size: var(--sq-text-base);
  font-family: inherit;
  color: var(--sq-text);
  background: #fff;
  outline: none;
  transition: border-color var(--sq-transition), box-shadow var(--sq-transition);
}
.sq-form input:focus, .sq-form select:focus, .sq-form textarea:focus {
  border-color: var(--sq-accent);
  box-shadow: var(--sq-shadow-focus);
}
.sq-form ul.errorlist {
  list-style: none;
  padding: 0;
  margin: .35rem 0 0;
  color: var(--sq-danger);
  font-size: .85rem;
}
.sq-form .helptext {
  display: block;
  margin-top: .25rem;
  font-size: .8rem;
  color: var(--sq-text-light);
}

/* ─── Layout ─────────────────────────────────────────────────────────── */
.sq-page {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
@media (max-width: 575.98px) {
  .sq-page { padding: 1rem .75rem; align-items: flex-start; padding-top: 1.5rem; }
}
@media (orientation: landscape) and (max-height: 600px) {
  .sq-page { align-items: flex-start; padding-top: 1rem; padding-bottom: 1rem; }
}

.sq-page-narrow  { max-width: 440px; width: 100%; }
.sq-page-medium  { max-width: 520px; width: 100%; }
.sq-page-wide    { max-width: 720px; width: 100%; }
.sq-page-xwide   { max-width: 1040px; width: 100%; }

/* ─── Section title ──────────────────────────────────────────────────── */
.sq-section-title {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--sq-border-soft);
}
.sq-section-title .sq-section-icon {
  width: 52px; height: 52px;
  background: var(--sq-primary-soft);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}
.sq-section-title h2 {
  font-size: var(--sq-text-lg); font-weight: 600; color: var(--sq-text); margin: 0 0 3px;
}
.sq-section-title p {
  font-size: var(--sq-text-sm); color: var(--sq-text-light); margin: 0;
}

/* ─── Back link ──────────────────────────────────────────────────────── */
.sq-back-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 1.5rem;
  color: var(--sq-text-light);
  font-size: var(--sq-text-base);
  text-decoration: none;
}
.sq-back-link .sq-back-arrow {
  width: 36px; height: 36px;
  background: #fff;
  border: 1px solid var(--sq-border);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--sq-text-muted);
  transition: background var(--sq-transition), border-color var(--sq-transition);
}
.sq-back-link:hover .sq-back-arrow { background: var(--sq-surface-soft); border-color: var(--sq-accent-soft); }
.sq-back-link:hover { color: var(--sq-text-muted); }

.sq-brand-footer {
  text-align: center;
  font-size: var(--sq-text-sm);
  color: var(--sq-text-faint);
  margin-top: 1.5rem;
}

.sq-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 1rem 0;
  color: var(--sq-text-light);
  font-size: var(--sq-text-sm);
}
.sq-divider::before,
.sq-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--sq-border);
}

/* ─── Topbar ─────────────────────────────────────────────────────────── */
.sq-topbar {
  background: rgba(255, 255, 255, .85);
  border-bottom: 1px solid var(--sq-border);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
}
.sq-topbar-inner {
  max-width: var(--sq-container);
  margin: 0 auto;
  padding: .75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.sq-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--sq-primary);
  font-size: var(--sq-text-lg);
  text-decoration: none;
  letter-spacing: -.01em;
}
.sq-brand:hover { color: var(--sq-primary-hover); }
.sq-brand-dot {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--sq-primary), var(--sq-accent));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: var(--sq-shadow-sm);
}
.sq-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  background: var(--sq-primary);
}

/* ─── Pills / badges ─────────────────────────────────────────────────── */
.sq-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  font-size: 11px; font-weight: 500;
  border-radius: var(--sq-radius-pill);
  white-space: nowrap;
}
.sq-pill-primary { background: var(--sq-primary-soft); color: var(--sq-primary); }
.sq-pill-success { background: var(--sq-success-soft); color: var(--sq-success-text); }
.sq-pill-warning { background: var(--sq-warning-soft); color: var(--sq-warning-text); }
.sq-pill-info    { background: var(--sq-info-soft);    color: var(--sq-info-text); }
.sq-pill-accent  { background: var(--sq-accent-soft);  color: var(--sq-primary); }

/* ─── Alerts ─────────────────────────────────────────────────────────── */
.sq-alert {
  border-radius: var(--sq-radius-md);
  padding: 12px 16px;
  font-size: var(--sq-text-base);
  margin-bottom: .75rem;
  border: 1px solid transparent;
}
.sq-alert-success { background: var(--sq-success-soft); color: var(--sq-success-text); border-color: #c5dfd0; }
.sq-alert-error,
.sq-alert-danger  { background: var(--sq-danger-soft);  color: var(--sq-danger);       border-color: #f0c6c0; }
.sq-alert-warning { background: var(--sq-warning-soft); color: var(--sq-warning-text); border-color: #e8d4a3; }
.sq-alert-info    { background: var(--sq-info-soft);    color: var(--sq-info-text);    border-color: #b8d3e3; }

/* ─── Modals ─────────────────────────────────────────────────────────── */
.sq-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(17, 17, 17, .55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1rem;
  align-items: flex-start;
  justify-content: center;
}
.sq-modal.is-open { display: flex; }
@media (min-height: 720px) {
  .sq-modal { align-items: center; }
}
.sq-modal-dialog {
  background: #fff;
  border-radius: var(--sq-radius-xl);
  padding: 2rem;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, .25);
  margin: auto;
  max-height: none;
}
@media (max-width: 575.98px) {
  .sq-modal { padding: .75rem; }
  .sq-modal-dialog { padding: 1.25rem; border-radius: var(--sq-radius-lg); }
}

/* ─── Animations ─────────────────────────────────────────────────────── */
@keyframes sq-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.sq-page-enter { animation: sq-fade-in .35s ease both; }

@keyframes sq-pop {
  0%   { transform: scale(.5); opacity: 0; }
  80%  { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}
.sq-pop { animation: sq-pop .4s ease-out; }

@keyframes sq-bounce {
  from { transform: translateY(0); }
  to   { transform: translateY(-8px); }
}
.sq-bounce { animation: sq-bounce 1s infinite alternate; }

@keyframes sq-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .55; }
}
.sq-pulse { animation: sq-pulse 1.6s infinite ease-in-out; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .sq-card-hover:hover { transform: none; }
}

/* ─── Bootstrap overrides for cohesion ───────────────────────────────── */
.btn-primary {
  background: var(--sq-primary) !important;
  border-color: var(--sq-primary) !important;
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--sq-primary-hover) !important;
  border-color: var(--sq-primary-hover) !important;
}
.btn-outline-primary {
  color: var(--sq-primary) !important;
  border-color: var(--sq-primary) !important;
}
.btn-outline-primary:hover {
  background: var(--sq-primary) !important;
  color: #fff !important;
}
.text-primary { color: var(--sq-primary) !important; }
.bg-primary   { background-color: var(--sq-primary) !important; }
.bg-primary-subtle { background-color: var(--sq-primary-soft) !important; }
.form-control:focus, .form-select:focus {
  border-color: var(--sq-accent);
  box-shadow: var(--sq-shadow-focus);
}
.nav-tabs .nav-link.active {
  color: var(--sq-primary);
  border-color: var(--sq-border) var(--sq-border) #fff;
}
.nav-tabs .nav-link {
  color: var(--sq-text-muted);
}
.nav-tabs .nav-link:hover {
  color: var(--sq-primary);
  border-color: transparent;
}
.dropdown-menu {
  border: 1px solid var(--sq-border) !important;
  box-shadow: var(--sq-shadow-md) !important;
}

/* ─── Quiz / option visual tokens ────────────────────────────────────── */
.sq-question-text {
  color: var(--sq-ink);
  background: var(--sq-primary-soft);
  border-left: 4px solid var(--sq-primary);
  padding: 12px 16px;
  border-radius: var(--sq-radius-sm);
  font-weight: 500;
}
.sq-option-text {
  color: var(--sq-text);
  background: var(--sq-surface);
  border: 1px solid var(--sq-border);
  padding: 10px 14px;
  border-radius: var(--sq-radius-sm);
}
.sq-option-text.is-correct {
  background: var(--sq-success-soft);
  border-color: #c5dfd0;
  color: var(--sq-success-text);
}
.sq-option-text.is-wrong-selected {
  background: var(--sq-danger-soft);
  border-color: #f0c6c0;
  color: var(--sq-danger);
}
.sq-option-text.is-selected {
  background: var(--sq-primary-soft);
  border-color: #bccee2;
  color: var(--sq-primary);
}

/* ─── Code blocks ────────────────────────────────────────────────────── */
.sq-code-block {
  background: #142A47;            /* deep indigo */
  color: #E4ECF5;
  padding: 14px 16px;
  border-radius: var(--sq-radius-md);
  font-family: 'JetBrains Mono', 'Fira Code', Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  overflow-x: auto;
  margin: 10px 0;
  position: relative;
  border: 1px solid #1E3A5F;
}
.sq-code-block code { color: inherit; background: none; padding: 0; }
.sq-code-lang {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--sq-accent);
  background: rgba(232, 163, 61, .14);
  padding: 2px 8px;
  border-radius: 6px;
  margin-bottom: 8px;
  font-family: 'Inter', sans-serif;
}
.sq-code-inline {
  background: var(--sq-primary-soft);
  color: var(--sq-accent-hover);
  padding: 2px 6px;
  border-radius: 5px;
  font-family: 'JetBrains Mono', 'Fira Code', Menlo, Consolas, monospace;
  font-size: .92em;
}

/* ─── Toast container (used by toast.js) ─────────────────────────────── */
.sq-toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
  pointer-events: none;
}
html[dir="rtl"] .sq-toast-container { right: auto; left: 20px; }
.sq-toast {
  border-radius: var(--sq-radius-md);
  padding: 12px 16px;
  box-shadow: var(--sq-shadow-md);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: var(--sq-text-base);
  pointer-events: auto;
  min-width: 240px;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity var(--sq-transition), transform var(--sq-transition);
  border: 1px solid transparent;
}
.sq-toast.is-visible { opacity: 1; transform: translateX(0); }
.sq-toast-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.sq-toast-text { flex: 1; line-height: 1.45; }
.sq-toast-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  opacity: .6;
  color: inherit;
}
.sq-toast-close:hover { opacity: 1; }

.sq-toast-success { background: var(--sq-success-soft); color: var(--sq-success-text); border-color: #c5dfd0; }
.sq-toast-success .sq-toast-icon { background: var(--sq-success-text); }
.sq-toast-error,
.sq-toast-danger  { background: var(--sq-danger-soft); color: var(--sq-danger); border-color: #f0c6c0; }
.sq-toast-error .sq-toast-icon, .sq-toast-danger .sq-toast-icon { background: var(--sq-danger); }
.sq-toast-warning { background: var(--sq-warning-soft); color: var(--sq-warning-text); border-color: #e8d4a3; }
.sq-toast-warning .sq-toast-icon { background: var(--sq-warning-text); }
.sq-toast-info    { background: var(--sq-info-soft); color: var(--sq-info-text); border-color: #b8d3e3; }
.sq-toast-info .sq-toast-icon { background: var(--sq-info-text); }

/* ─── Responsive helpers ─────────────────────────────────────────────── */
@media (max-width: 575.98px) {
  .sq-section-title { gap: 10px; padding-bottom: 1.25rem; margin-bottom: 1.5rem; }
  .sq-section-title .sq-section-icon { width: 44px; height: 44px; font-size: 20px; }
  .sq-section-title h2 { font-size: var(--sq-text-md); }
}
@media (orientation: landscape) and (max-height: 500px) {
  .sq-page { padding-top: .75rem; padding-bottom: .75rem; }
  .sq-card { padding: 1.25rem; }
}

/* ─── Topbar / mobile drawer (extracted from _topbar.html) ──────────── */
.sq-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--sq-text-base);
  color: var(--sq-text-muted);
  text-decoration: none;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: var(--sq-radius-sm);
  transition: background var(--sq-transition), color var(--sq-transition);
}
.sq-nav-link:hover { background: var(--sq-primary-soft); color: var(--sq-primary); }
.sq-nav-link.is-active { background: var(--sq-primary-soft); color: var(--sq-primary); }

.sq-burger {
  display: none;
  width: 40px; height: 40px;
  border-radius: var(--sq-radius-md);
  border: 1px solid var(--sq-border);
  background: #fff;
  align-items: center; justify-content: center;
  font-size: 18px; color: var(--sq-text-muted);
  cursor: pointer;
}
.sq-mobile-nav {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(82vw, 320px);
  background: #fff;
  box-shadow: -8px 0 24px rgba(0, 0, 0, .15);
  z-index: 250;
  transform: translateX(100%);
  transition: transform var(--sq-transition-slow);
  display: flex; flex-direction: column;
  padding: 1rem;
  overflow-y: auto;
}
.sq-mobile-nav.is-open { transform: translateX(0); }
html[dir="rtl"] .sq-mobile-nav { inset: 0 auto 0 0; transform: translateX(-100%); box-shadow: 8px 0 24px rgba(0, 0, 0, .15); }
html[dir="rtl"] .sq-mobile-nav.is-open { transform: translateX(0); }

.sq-mobile-backdrop {
  position: fixed; inset: 0;
  background: rgba(17, 17, 17, .4);
  z-index: 240;
  opacity: 0; pointer-events: none;
  transition: opacity var(--sq-transition);
}
.sq-mobile-backdrop.is-open { opacity: 1; pointer-events: auto; }

.sq-mobile-link {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-radius: var(--sq-radius-md);
  text-decoration: none;
  color: var(--sq-text);
  font-size: var(--sq-text-md); font-weight: 500;
  transition: background var(--sq-transition), color var(--sq-transition);
}
.sq-mobile-link:hover { background: var(--sq-primary-soft); color: var(--sq-primary); }
.sq-mobile-link.is-danger { color: var(--sq-danger); }

.sq-mobile-section {
  text-transform: uppercase;
  font-size: 11px; letter-spacing: .08em;
  color: var(--sq-text-light);
  padding: 14px 14px 6px;
}

.sq-lang-form { margin: 0; }
.sq-lang-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; border: 1px solid var(--sq-border);
  border-radius: var(--sq-radius-md); padding: 6px 10px;
  font-size: var(--sq-text-sm); color: var(--sq-text-muted); cursor: pointer;
}
.sq-lang-btn:hover { background: var(--sq-surface-soft); }

@media (max-width: 991.98px) {
  .sq-burger { display: inline-flex; }
  .sq-nav-desktop { display: none !important; }
}

/* ─── Notification dot / unread badge ────────────────────────────────── */
.sq-notif-toggle {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--sq-surface-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--sq-text-muted);
  font-size: 18px;
  position: relative;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background var(--sq-transition), border-color var(--sq-transition);
}
.sq-notif-toggle:hover { background: var(--sq-primary-soft); border-color: var(--sq-accent-soft); color: var(--sq-primary); }
.sq-notif-badge {
  position: absolute;
  top: -2px; right: -2px;
  background: var(--sq-danger);
  color: #fff;
  border-radius: var(--sq-radius-pill);
  min-width: 18px; height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px; font-weight: 600;
  padding: 0 5px;
  box-shadow: 0 0 0 2px #fff;
}
html[dir="rtl"] .sq-notif-badge { right: auto; left: -2px; }

/* ─── Exam page ───────────────────────────────────────────────────────── */
.sq-exam-shell {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(1100px 520px at 12% -10%, rgba(232, 163, 61, .10), transparent 60%),
    radial-gradient(900px 420px at 110% 0%, rgba(30, 58, 95, .08), transparent 55%),
    var(--sq-bg);
}
.sq-exam-wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 1.75rem 1rem 7rem;
}
@media (max-width: 575.98px) {
  .sq-exam-wrap { padding: 1rem .85rem 6rem; }
}

.sq-exam-bar {
  background: linear-gradient(135deg, var(--sq-primary) 0%, #2A5681 60%, var(--sq-accent) 130%);
  color: #fff;
  padding: .85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
  gap: 1rem;
  flex-wrap: wrap;
  row-gap: .5rem;
  box-shadow: 0 6px 18px rgba(30, 58, 95, .18);
  backdrop-filter: saturate(140%);
}
.sq-exam-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 200px;
}
.sq-exam-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  flex-wrap: nowrap;
}
.sq-exam-bar-title {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  letter-spacing: .1px;
}
.sq-exam-bar-meta {
  font-size: 12px;
  opacity: .82;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 3px 10px;
  border-radius: var(--sq-radius-pill);
  background: rgba(255, 255, 255, .14);
}
.sq-exam-bar-counter {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: var(--sq-radius-pill);
  background: rgba(255, 255, 255, .14);
}
.sq-exam-bar-counter-label { font-size: 12px; opacity: .8; text-transform: uppercase; letter-spacing: .4px; }
.sq-exam-bar-counter-value { font-size: 15px; font-weight: 700; }
.sq-exam-bar-counter-sep   { opacity: .5; }
.sq-exam-bar-counter-total { font-size: 14px; opacity: .85; }

@media (max-width: 767.98px) {
  .sq-exam-bar { padding: .7rem 1rem; gap: .75rem; }
  .sq-exam-bar-left, .sq-exam-bar-right { gap: 10px; }
  .sq-exam-bar-title { font-size: 14px; }
  .sq-exam-bar-meta  { display: none; }
}
@media (max-width: 575.98px) {
  .sq-exam-bar { padding: .55rem .65rem; gap: .5rem; }
  .sq-exam-bar-left, .sq-exam-bar-right { gap: 8px; }
  .sq-exam-bar-title { font-size: 13px; }
  .sq-exam-bar-counter { padding: 4px 8px; }
  .sq-exam-bar-counter-label { display: none; }
  .sq-exam-bar-counter-value, .sq-exam-bar-counter-total { font-size: 13px; }
  .sq-exam-bar .sq-exam-finish { padding: 6px 12px; font-size: 13px; }
  .sq-exam-home { width: 32px; height: 32px; font-size: 14px; }
}

/* ── Audio TTS floating action button (bottom-left overlay) ──
   Anchored to the visual viewport with safe-area insets so it stays
   visible above iOS home indicators and Android gesture bars. */
.sq-audio-fab {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  left: calc(20px + env(safe-area-inset-left, 0px));
  z-index: 1000;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--sq-surface);
  color: var(--sq-text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--sq-transition),
              background var(--sq-transition),
              box-shadow var(--sq-transition);
}
.sq-audio-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .22);
}
.sq-audio-fab:active { transform: translateY(0); }
.sq-audio-fab.is-on {
  background: var(--sq-primary);
  color: #fff;
  box-shadow: 0 8px 22px rgba(30, 58, 95, .4);
}
.sq-audio-fab.is-on::after {
  content: "";
  position: absolute;
  top: 6px; right: 6px;
  width: 10px; height: 10px;
  background: var(--sq-accent);
  border-radius: 50%;
  border: 2px solid var(--sq-primary);
}
html[dir="rtl"] .sq-audio-fab {
  left: auto;
  right: calc(20px + env(safe-area-inset-right, 0px));
}
html[dir="rtl"] .sq-audio-fab.is-on::after { right: auto; left: 6px; }
@media (max-width: 575.98px) {
  .sq-audio-fab {
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    left: calc(14px + env(safe-area-inset-left, 0px));
    width: 46px; height: 46px; font-size: 20px;
  }
  html[dir="rtl"] .sq-audio-fab {
    left: auto;
    right: calc(14px + env(safe-area-inset-right, 0px));
  }
}
.sq-exam-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  text-decoration: none;
  flex-shrink: 0;
  transition: background var(--sq-transition), transform var(--sq-transition);
}
.sq-exam-home:hover { background: rgba(255, 255, 255, .26); color: #fff; transform: scale(1.05); }
.sq-exam-home:active { transform: scale(.96); }
.sq-exam-finish {
  background: #fff;
  color: var(--sq-primary);
  border: none;
  border-radius: var(--sq-radius-pill);
  padding: 9px 20px;
  font-size: var(--sq-text-base);
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  letter-spacing: .2px;
  box-shadow: 0 4px 12px rgba(30, 58, 95, .25);
  transition: transform var(--sq-transition), box-shadow var(--sq-transition), background var(--sq-transition);
}
.sq-exam-finish:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(30, 58, 95, .32); background: var(--sq-surface-soft); }
.sq-exam-finish:active { transform: translateY(0); }

/* Timer pill — fixed overlay at bottom-right by default; always visible
   while scrolling. The user can drag it via the handle to any corner
   (.is-floating + inline left/top from JS). The ↺ button resets to default.
   Safe-area insets keep it above iOS home indicators / Android gesture bars. */
.sq-timer-pill {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  right: calc(20px + env(safe-area-inset-right, 0px));
  z-index: 1000;
  background: linear-gradient(135deg, var(--sq-primary), var(--sq-accent));
  color: #fff;
  border-radius: var(--sq-radius-pill);
  padding: 10px 16px;
  box-shadow: 0 12px 28px rgba(30, 58, 95, .40), inset 0 1px 0 rgba(255, 255, 255, .12);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'SF Mono', Menlo, monospace;
  will-change: background;
  transition: background var(--sq-transition), box-shadow var(--sq-transition), transform var(--sq-transition);
}
.sq-timer-pill:hover { transform: translateY(-1px); }
html[dir="rtl"] .sq-timer-pill {
  right: auto;
  left: calc(20px + env(safe-area-inset-left, 0px));
}
.sq-timer-pill.is-floating {
  /* When dragged, JS sets explicit top/left and we ignore default corner. */
  bottom: auto; right: auto;
}
.sq-timer-pill .sq-timer-handle {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  font-size: 16px;
  opacity: .8;
  padding: 0 4px;
  line-height: 1;
}
.sq-timer-pill .sq-timer-handle:hover { opacity: 1; }
.sq-timer-pill.is-dragging .sq-timer-handle,
.sq-timer-pill.is-dragging { cursor: grabbing; }
.sq-timer-pill .sq-timer-reset {
  background: rgba(255,255,255,.18);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11px;
  cursor: pointer;
  margin-left: 4px;
  display: none;
}
.sq-timer-pill.is-floating .sq-timer-reset { display: inline-block; }
.sq-timer-pill .sq-timer-reset:hover { background: rgba(255,255,255,.28); }
.sq-timer-pill .sq-timer-label {
  font-size: 10px;
  opacity: .75;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.sq-timer-pill .sq-timer-value { font-size: 18px; font-weight: 700; line-height: 1; }
.sq-timer-pill.is-warning { background: linear-gradient(135deg, var(--sq-accent), #C7861F); box-shadow: 0 12px 28px rgba(232, 163, 61, .42); }
.sq-timer-pill.is-critical { background: linear-gradient(135deg, #D14A3E, var(--sq-danger)); box-shadow: 0 12px 28px rgba(192, 57, 43, .45); animation: sq-pulse 1s infinite; }
@media (max-width: 575.98px) {
  .sq-timer-pill {
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    right: calc(14px + env(safe-area-inset-right, 0px));
    padding: 8px 12px;
    gap: 6px;
  }
  html[dir="rtl"] .sq-timer-pill {
    right: auto;
    left: calc(14px + env(safe-area-inset-left, 0px));
  }
  .sq-timer-pill .sq-timer-label { display: none; }
  .sq-timer-pill .sq-timer-value { font-size: 16px; }
}
/* Reserve scroll space at the bottom so users can scroll content past
   the docked timer pill / audio FAB. */
#questions-container { padding-bottom: 110px; }

.sq-question-card {
  background: var(--sq-surface);
  border-radius: var(--sq-radius-xl);
  border: 1px solid var(--sq-border);
  padding: 1.75rem 2rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--sq-shadow-sm);
  animation: sq-card-in .35s cubic-bezier(.4, 0, .2, 1);
}
@keyframes sq-card-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@media (max-width: 575.98px) {
  .sq-question-card { padding: 1.25rem 1.1rem; border-radius: var(--sq-radius-lg); }
}

/* Question header: numbered badge + meta */
.sq-question-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 1.25rem;
}
.sq-question-num {
  min-width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--sq-primary-soft), var(--sq-accent-soft));
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--sq-primary);
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(232, 163, 61, .18);
}
.sq-question-body { flex: 1; min-width: 0; }
.sq-question-text { font-size: var(--sq-text-md); line-height: 1.65; color: var(--sq-text); }
.sq-question-image {
  display: block;
  max-width: min(100%, 560px);
  max-height: 360px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--sq-radius-md);
  border: 1px solid var(--sq-border);
  background: var(--sq-surface-soft);
  margin-top: 12px;
  box-shadow: var(--sq-shadow-xs);
}
@media (max-width: 575.98px) {
  .sq-question-image { max-height: 260px; }
}
.sq-question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.sq-question-meta .sq-tag {
  font-size: 11px;
  color: var(--sq-text-muted);
  background: var(--sq-surface-soft);
  border: 1px solid var(--sq-border);
  border-radius: var(--sq-radius-pill);
  padding: 3px 10px;
  text-transform: uppercase;
  letter-spacing: .4px;
}

/* Options list */
.sq-options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Per-question exam mode: only the active card is visible. */
.sq-pq-question { display: none; }
.sq-pq-question.is-active { display: block; animation: sq-pq-fade .25s ease; }
@keyframes sq-pq-fade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* Option label — custom indicator, big touch target, smooth hover */
.sq-option-label {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1.5px solid var(--sq-border);
  border-radius: var(--sq-radius-md);
  background: var(--sq-surface);
  cursor: pointer;
  transition: background var(--sq-transition),
              border-color var(--sq-transition),
              transform var(--sq-transition),
              box-shadow var(--sq-transition);
  user-select: none;
}
.sq-option-label:hover {
  background: var(--sq-surface-soft);
  border-color: var(--sq-accent-soft);
  transform: translateY(-1px);
  box-shadow: var(--sq-shadow-sm);
}
.sq-option-label:active { transform: translateY(0); }
.sq-option-label.is-checked {
  background: linear-gradient(180deg, var(--sq-primary-soft), #fff 120%);
  border-color: var(--sq-accent);
  box-shadow: 0 0 0 3px rgba(232, 163, 61, .12);
}
/* In-exam correctness feedback (only when the owner / paid user opted-in).
   Wins over `is-checked` because we set it after the change handler runs. */
.sq-option-label.is-correct {
  background: var(--sq-success-soft);
  border-color: var(--sq-success);
  box-shadow: 0 0 0 3px rgba(45, 134, 89, .18);
}
.sq-option-label.is-correct input { border-color: var(--sq-success); background: var(--sq-success); }
.sq-option-label.is-incorrect {
  background: var(--sq-danger-soft);
  border-color: var(--sq-danger);
  box-shadow: 0 0 0 3px rgba(192, 57, 43, .18);
}
.sq-option-label.is-incorrect input { border-color: var(--sq-danger); background: var(--sq-danger); }
.sq-option-label input {
  appearance: none;
  -webkit-appearance: none;
  width: 22px; height: 22px;
  flex-shrink: 0;
  border: 2px solid var(--sq-border-input);
  background: #fff;
  cursor: pointer;
  margin: 0;
  position: relative;
  transition: border-color var(--sq-transition), background var(--sq-transition);
}
.sq-option-label input[type="radio"]    { border-radius: 50%; }
.sq-option-label input[type="checkbox"] { border-radius: 6px; }
.sq-option-label:hover input { border-color: var(--sq-accent); }
.sq-option-label input:checked {
  border-color: var(--sq-accent);
  background: var(--sq-accent);
}
.sq-option-label input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 8px; height: 8px;
  background: #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.sq-option-label input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  top: 1px; left: 5px;
  width: 5px; height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.sq-option-label input:focus-visible {
  outline: none;
  box-shadow: var(--sq-shadow-focus);
}
.sq-option-label .sq-option-text {
  flex: 1;
  font-size: var(--sq-text-base);
  line-height: 1.55;
  color: var(--sq-text);
  word-break: break-word;
}
.sq-option-label .sq-option-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.sq-option-label .sq-option-body .sq-option-text {
  flex: 1 1 auto;
  min-width: 0;
}
.sq-option-label .sq-option-body .sq-option-text:empty {
  display: none;
}
.sq-option-image {
  display: block;
  flex: 0 0 auto;
  max-width: min(100%, 280px);
  max-height: 180px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--sq-radius-sm);
  border: 1px solid var(--sq-border);
  background: var(--sq-surface-soft);
  box-shadow: var(--sq-shadow-xs);
}
@media (max-width: 575.98px) {
  .sq-option-image { max-height: 140px; }
}

/* Results page option images — thumbnails sized to match the row's rhythm.
   Fixed height keeps every row visually aligned; click/tap reveals full size. */
.sq-result-option-image {
  display: block;
  flex: 0 0 auto;
  height: 56px;
  width: auto;
  max-width: 120px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--sq-border);
  background: #fff;
  cursor: zoom-in;
  transition: transform var(--sq-transition), box-shadow var(--sq-transition);
}
.sq-result-option-image:hover {
  transform: scale(1.04);
  box-shadow: var(--sq-shadow-sm);
}
@media (max-width: 575.98px) {
  .sq-result-option-image { height: 48px; max-width: 96px; }
}

/* One-question top bar (display_mode=one) */
.sq-one-bar {
  background: var(--sq-surface);
  border-radius: var(--sq-radius-lg);
  border: 1px solid var(--sq-border);
  box-shadow: var(--sq-shadow-xs);
  padding: 12px 16px;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 12px;
}
.sq-one-bar-info {
  font-size: 13px;
  color: var(--sq-text-muted);
  white-space: nowrap;
}
.sq-one-bar-info strong { color: var(--sq-primary); font-weight: 700; }
.sq-progress-track {
  flex: 1;
  height: 8px;
  background: var(--sq-border);
  border-radius: var(--sq-radius-pill);
  overflow: hidden;
}
.sq-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--sq-primary), var(--sq-accent));
  border-radius: var(--sq-radius-pill);
  transition: width .35s cubic-bezier(.4, 0, .2, 1);
}
.sq-one-bar-actions { display: flex; gap: 8px; flex-shrink: 0; }
@media (max-width: 575.98px) {
  .sq-one-bar { flex-wrap: wrap; padding: 10px 12px; gap: 10px; }
  .sq-one-bar-actions { width: 100%; justify-content: space-between; }
  .sq-one-bar-actions .sq-btn { flex: 1; }
}

/* Standalone progress strip for per-question mode */
.sq-pq-progress {
  background: var(--sq-surface);
  border-bottom: 1px solid var(--sq-border);
  position: sticky;
  top: 56px;
  z-index: 80;
}
.sq-pq-progress-inner {
  max-width: 820px;
  margin: 0 auto;
  padding: 12px 1rem;
}

/* Per-question advance footer */
.sq-pq-advance {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.sq-pq-advance-hint {
  font-size: 11px;
  color: var(--sq-text-light);
  font-style: italic;
}

/* Submit button (full mode) */
.sq-exam-submit {
  margin-top: 1.25rem;
  background: linear-gradient(135deg, var(--sq-primary), var(--sq-accent));
  color: #fff;
  border: none;
  border-radius: var(--sq-radius-lg);
  padding: 16px 24px;
  font-size: var(--sq-text-md);
  font-weight: 700;
  width: 100%;
  cursor: pointer;
  letter-spacing: .2px;
  box-shadow: 0 10px 26px rgba(30, 58, 95, .28);
  transition: transform var(--sq-transition), box-shadow var(--sq-transition), filter var(--sq-transition);
}
.sq-exam-submit:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(30, 58, 95, .35); filter: brightness(1.05); }
.sq-exam-submit:active { transform: translateY(0); }

/* ─── Notification dropdown items ────────────────────────────────────── */
.sq-notif-empty,
.sq-notif-error {
  padding: 32px 16px;
  text-align: center;
  font-size: var(--sq-text-sm);
}
.sq-notif-empty { color: var(--sq-text-light); }
.sq-notif-error { color: var(--sq-danger); }

.sq-notif-item {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--sq-border-soft);
  text-decoration: none;
  color: var(--sq-text);
  background: #fff;
  transition: background var(--sq-transition);
}
.sq-notif-item:hover { background: var(--sq-surface-soft); color: var(--sq-text); }
.sq-notif-item.is-unread { background: var(--sq-surface-soft); }
.sq-notif-item:last-child { border-bottom: none; }
.sq-notif-icon { font-size: 18px; flex-shrink: 0; }
.sq-notif-body { flex: 1; min-width: 0; }
.sq-notif-msg { font-size: var(--sq-text-sm); line-height: 1.4; }
.sq-notif-time { font-size: 11px; color: var(--sq-text-light); margin-top: 3px; }
.sq-notif-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--sq-accent);
  margin-top: 6px;
  flex-shrink: 0;
}

/* Notification dropdown wrapper */
.sq-notif-menu {
  min-width: 340px;
  max-width: 380px;
  border-radius: var(--sq-radius-lg);
  overflow: hidden;
  padding: 0 !important;
}
.sq-notif-menu-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--sq-border-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sq-notif-menu-head .sq-notif-title { font-weight: 600; font-size: var(--sq-text-base); }
.sq-notif-menu-head a { font-size: var(--sq-text-xs); }
.sq-notif-list-wrap { max-height: 420px; overflow-y: auto; }
.sq-notif-loading {
  padding: 24px 16px;
  text-align: center;
  color: var(--sq-text-light);
  font-size: var(--sq-text-sm);
}

/* ─── Editorial typography ───────────────────────────────────────────── */
/* Serif headings give the site a hand-edited, less-default feel. Inter remains
   for body so reading length isn't affected. */
.sq-serif,
.sq-display,
.sq-eyebrow + h1,
.sq-h-editorial {
  font-family: 'Source Serif Pro', 'Source Serif 4', Georgia, 'Times New Roman', serif;
  letter-spacing: -.015em;
}
.sq-display {
  font-size: clamp(34px, 6vw, 56px);
  line-height: 1.05;
  font-weight: 600;
  color: var(--sq-ink);
  margin: 0;
}
.sq-display em {
  font-style: italic;
  font-weight: 500;
  color: var(--sq-accent);
}
.sq-h-editorial {
  font-size: clamp(22px, 3.2vw, 30px);
  line-height: 1.15;
  font-weight: 600;
  color: var(--sq-ink);
  margin: 0 0 .75rem;
}
.sq-eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--sq-accent);
  margin-bottom: 1rem;
}
.sq-lead {
  font-size: clamp(16px, 2.2vw, 19px);
  line-height: 1.6;
  color: var(--sq-text-muted);
  max-width: 60ch;
  margin: 0 0 1.5rem;
}
.sq-rule {
  border: 0;
  border-top: 1px solid var(--sq-border);
  margin: 2.5rem 0;
}
.sq-rule-thick {
  border: 0;
  border-top: 2px solid var(--sq-ink);
  width: 48px;
  margin: 0 0 1.25rem;
}

/* ─── Icon system ────────────────────────────────────────────────────── */
/* Inline SVG icons. Use via {% include "_icons.html" with name="..." %} */
.sq-icon {
  display: inline-flex;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  vertical-align: -.18em;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sq-icon-sm { width: 16px; height: 16px; }
.sq-icon-lg { width: 28px; height: 28px; stroke-width: 1.4; }
.sq-icon-xl { width: 40px; height: 40px; stroke-width: 1.2; }

.sq-icon-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--sq-surface-soft);
  border: 1px solid var(--sq-border);
  color: var(--sq-ink);
}
.sq-icon-tile .sq-icon { width: 22px; height: 22px; }
.sq-icon-tile-accent { background: var(--sq-accent-soft); color: var(--sq-accent); border-color: transparent; }
.sq-icon-tile-ink    { background: var(--sq-ink); color: #fff; border-color: transparent; }

/* ─── Stat strip (clickable segmented stat row) ──────────────────────── */
.sq-stat-strip { padding: 0; overflow: hidden; }
.sq-stat {
  flex: 1 1 0;
  min-width: 130px;
  padding: .85rem 1rem;
  border-right: 1px solid var(--sq-border);
  color: inherit;
  text-decoration: none;
  display: block;
  transition: background .15s ease;
}
.sq-stat:last-child { border-right: none; }
.sq-stat:hover { background: var(--sq-surface-soft); color: inherit; text-decoration: none; }
.sq-stat-label {
  font-size: 11px;
  color: var(--sq-text-light);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.sq-stat-value {
  font-family: 'Source Serif Pro', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--sq-ink);
  line-height: 1.1;
  margin-top: 2px;
}
.sq-stat-value-sm { font-size: 15px; line-height: 1.25; margin-top: 4px; }
.sq-stat-value-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-top: 2px;
}
.sq-sparkline { opacity: .85; flex-shrink: 0; }
@media (max-width: 575.98px) {
  .sq-stat { border-right: none; border-bottom: 1px solid var(--sq-border); }
  .sq-stat:last-child { border-bottom: none; }
}

/* ─── Action chips (compact pill links) ──────────────────────────────── */
.sq-chip {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .85rem;
  border-radius: 999px;
  background: var(--sq-surface);
  border: 1px solid var(--sq-border);
  color: var(--sq-text);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  line-height: 1;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}
.sq-chip:hover {
  background: var(--sq-surface-soft);
  border-color: var(--sq-ink);
  color: var(--sq-ink);
  transform: translateY(-1px);
}
.sq-chip .sq-icon-sm { flex-shrink: 0; }
.sq-chip-accent {
  background: var(--sq-ink);
  border-color: var(--sq-ink);
  color: #fff;
}
.sq-chip-accent:hover {
  background: var(--sq-accent);
  border-color: var(--sq-accent);
  color: #fff;
}

/* ─── Editorial layouts ──────────────────────────────────────────────── */
.sq-editorial {
  max-width: 1080px;
  margin: 0 auto;
  padding: 3.5rem 1.5rem;
}
@media (max-width: 575.98px) {
  .sq-editorial { padding: 2rem 1rem; }
}

/* Asymmetric two-column feature row: a wide story + a small support card. */
.sq-feature-row {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
  padding: 2rem 0;
  border-top: 1px solid var(--sq-border);
}
.sq-feature-row:first-of-type { border-top: 0; }
.sq-feature-row.is-reverse { grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr); }
@media (max-width: 767.98px) {
  .sq-feature-row,
  .sq-feature-row.is-reverse { grid-template-columns: 1fr; gap: 1.25rem; padding: 1.5rem 0; }
}
.sq-feature-num {
  font-family: 'Source Serif Pro', Georgia, serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--sq-text-light);
  letter-spacing: .04em;
}
.sq-feature-row h3 {
  font-family: 'Source Serif Pro', Georgia, serif;
  font-size: clamp(20px, 2.6vw, 26px);
  font-weight: 600;
  color: var(--sq-ink);
  margin: .25rem 0 .75rem;
  line-height: 1.2;
}
.sq-feature-row p {
  font-size: 15px;
  line-height: 1.65;
  color: var(--sq-text-muted);
  margin: 0;
  max-width: 56ch;
}
.sq-feature-aside {
  background: var(--sq-surface);
  border: 1px solid var(--sq-border);
  border-radius: 12px;
  padding: 1.25rem;
  font-size: 13px;
  color: var(--sq-text-muted);
  line-height: 1.6;
}
.sq-feature-aside strong {
  display: block;
  color: var(--sq-ink);
  font-weight: 600;
  margin-bottom: .25rem;
  font-size: 13px;
}

/* Brand wordmark (replaces emoji "dot") */
.sq-brand-mark {
  display: inline-flex;
  align-items: center;
  font-weight: 700;
  font-size: 18px;
  color: var(--sq-ink);
  letter-spacing: -.02em;
  text-decoration: none;
}
.sq-brand-mark::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--sq-accent);
  border-radius: 50%;
  margin-right: 10px;
  vertical-align: middle;
}
.sq-brand-mark:hover { color: var(--sq-ink); }

/* Footer */
.sq-footer {
  border-top: 1px solid var(--sq-border);
  padding: 2.5rem 1.5rem 3rem;
  background: var(--sq-surface-soft);
  margin-top: 4rem;
}
.sq-footer-inner {
  max-width: var(--sq-container);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr));
  gap: 2rem;
}
.sq-footer-col h4 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--sq-text-light);
  margin: 0 0 .85rem;
}
.sq-footer-col ul { list-style: none; padding: 0; margin: 0; }
.sq-footer-col li { margin-bottom: .5rem; }
.sq-footer-col a {
  color: var(--sq-text-muted);
  font-size: 14px;
  text-decoration: none;
}
.sq-footer-col a:hover { color: var(--sq-ink); }
.sq-footer-bottom {
  max-width: var(--sq-container);
  margin: 2rem auto 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--sq-border);
  font-size: 13px;
  color: var(--sq-text-light);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
}
@media (max-width: 767.98px) {
  .sq-footer-inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .sq-footer-inner { grid-template-columns: 1fr; gap: 1.25rem; }
}
