.mathcy-quiz{--mq-border:#e2e8f0;--mq-soft:#f8fafc;--mq-question:#f6f7f9;--mq-text:#172033;--mq-muted:#667085;--mq-ok:#16794b;--mq-ok-bg:#edf9f2;--mq-bad:#b42318;--mq-bad-bg:#fff3f2;color:var(--mq-text);margin:0;font-size:16px;line-height:1.6}
.mathcy-quiz *{box-sizing:border-box}
.mathcy-quiz__header{display:flex;flex-direction:column;justify-content:center;align-items:center;gap:.55rem;padding:0 0 .9rem;border-bottom:1px solid var(--mq-border);text-align:center}
.mathcy-quiz__header>div:first-child{width:100%;min-width:0}
.mathcy-quiz__title{margin:0;font-size:1.35rem;line-height:1.3;text-align:center}
.mathcy-quiz__description{width:100%;text-align:center}
.mathcy-quiz__description p{margin:.35rem 0}
.mathcy-quiz__meta{display:flex;gap:.5rem;flex-wrap:wrap;justify-content:center;align-items:center;color:var(--mq-muted);font-size:.9rem}
.mathcy-quiz__meta span{padding:.3rem .55rem;border:1px solid var(--mq-border);border-radius:999px;background:var(--mq-soft);white-space:nowrap}
.mathcy-question{margin:1.15rem 0;scroll-margin-top:96px;padding:1rem;border:1px solid var(--mq-border);border-radius:14px;background:var(--mq-question);outline:none}
.mathcy-question.is-correct{border-color:#9fd7b9;background:var(--mq-ok-bg)}
.mathcy-question.is-wrong{border-color:#f0b5b0;background:var(--mq-bad-bg)}

.mathcy-question.is-required-missing{border-color:#e0a23a;background:#fffaf0;box-shadow:none}
.mathcy-question.is-required-missing .mathcy-question__feedback{color:#9a5b00;text-align:center}
.mathcy-question__head{display:flex;justify-content:space-between;gap:1rem;align-items:center;margin-bottom:.65rem}
.mathcy-question__number{font-size:1rem;margin:0;font-weight:700}
.mathcy-question__points{font-size:.85rem;color:var(--mq-muted);white-space:nowrap}
.mathcy-question__text p{margin:.45rem 0}
.mathcy-question__text ul{margin:.5rem 0 .5rem 1.25rem}
.mathcy-math-inline{white-space:normal}
.mathcy-math-block{overflow-x:auto;padding:.4rem 0;text-align:center}
.mathcy-options{display:flex;flex-wrap:wrap;align-items:stretch;gap:.65rem;margin-top:.9rem;width:100%}
.mathcy-option{position:relative;display:flex;flex:1 1 150px;align-items:center;justify-content:center;gap:.55rem;min-width:140px;min-height:54px;padding:.7rem .8rem;border:1px solid var(--mq-border);border-radius:11px;background:#fff;cursor:pointer;text-align:center;transition:border-color .15s ease,background .15s ease,box-shadow .15s ease,transform .15s ease}
.mathcy-option input{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}
.mathcy-option__letter{display:inline-flex;flex:0 0 32px;align-items:center;justify-content:center;width:32px;height:32px;border:1px solid var(--mq-border);border-radius:50%;font-weight:700;line-height:1;background:#fff}
.mathcy-option__label{min-width:0;overflow-wrap:anywhere}
.mathcy-option__letter,.mathcy-option__label,.mathcy-option__label *{pointer-events:none}

.mathcy-option--letter-only{flex-basis:84px;min-width:72px;padding:.65rem;gap:0}
.mathcy-option--letter-only .mathcy-option__letter{flex-basis:36px;width:36px;height:36px}
.mathcy-option:hover{border-color:#aab6c5}
.mathcy-option:has(input:focus-visible){outline:2px solid currentColor;outline-offset:2px}
.mathcy-option:has(input:checked){border-color:currentColor;background:var(--mq-soft);box-shadow:0 0 0 1px currentColor inset}
.mathcy-option.is-correct-option{border-color:#76c69b;background:#f1fbf5}
.mathcy-option.is-wrong-option{border-color:#e69c96;background:#fff7f6}
.mathcy-input-label{display:block;font-weight:600;margin:.8rem 0 .35rem}
.mathcy-answer-input,.mathcy-answer-textarea{width:100%;border:1px solid var(--mq-border);border-radius:10px;background:#fff;color:inherit;padding:.7rem .8rem;font:inherit;outline:none}
.mathcy-answer-input:focus,.mathcy-answer-textarea:focus{border-color:currentColor;box-shadow:0 0 0 2px rgba(15,23,42,.08)}
.mathcy-answer-textarea{resize:vertical;min-height:130px}
.mathcy-open-note{font-size:.86rem;color:var(--mq-muted);margin:.35rem 0 0}
.mathcy-question__feedback{margin-top:.75rem;font-weight:650}
.mathcy-question.is-correct .mathcy-question__feedback{color:var(--mq-ok)}
.mathcy-question.is-wrong .mathcy-question__feedback{color:var(--mq-bad)}
.mathcy-question__solution{margin-top:.9rem;padding:.85rem;border:1px solid var(--mq-border);background:rgba(255,255,255,.72);border-radius:9px}
.mathcy-solution__title{font-weight:750;margin-bottom:.35rem}
.mathcy-quiz__actions{display:flex;gap:.65rem;flex-wrap:wrap;justify-content:center;align-items:center;margin-top:1rem}
.mathcy-btn{appearance:none;border-radius:10px;padding:.7rem 1rem;font:inherit;font-weight:700;cursor:pointer;min-height:44px}
.mathcy-btn--primary{background:var(--wp--preset--color--primary,#111827);color:#fff;border:1px solid transparent}
.mathcy-btn--secondary{background:#fff;color:inherit;border:1px solid var(--mq-border)}
.mathcy-quiz__result{margin-top:1rem;padding:1rem;border:1px solid var(--mq-border);border-radius:12px;background:var(--mq-soft);display:flex;gap:.55rem 1rem;flex-wrap:wrap;align-items:center}
.mathcy-quiz__result[hidden]{display:none}
.mathcy-quiz-error{padding:1rem;border:1px solid #efb1ab;background:#fff4f2;border-radius:10px}
.mathcy-quiz__form{margin-bottom:0}
.mathcy-quiz__questions>.mathcy-question:last-child{margin-bottom:0}
@media(max-width:640px){.mathcy-quiz__header{align-items:center;text-align:center}.mathcy-quiz__meta{justify-content:center;margin-top:0}.mathcy-question{padding:.85rem}.mathcy-option{min-height:52px;padding:.65rem .7rem}.mathcy-quiz__actions{justify-content:center}.mathcy-quiz__actions .mathcy-btn{width:auto;flex:0 0 auto}.mathcy-question__text,.mathcy-question__feedback{text-align:center}.mathcy-question__head{justify-content:center;flex-wrap:wrap}.mathcy-question__answer{text-align:left}.mathcy-answer-input,.mathcy-answer-textarea{text-align:left}}
@media(max-width:420px){.mathcy-option{flex-basis:100%;min-width:100%;width:100%}}
.mathcy-question__text img,.mathcy-question__solution img{display:block;max-width:100%;height:auto;margin:.75rem auto}
.mathcy-option__label img{display:block;max-width:100%;height:auto;margin:.35rem auto}

/* v1.14.0: detailed per-question results after submission */
.mathcy-quiz__result{display:block}
.mathcy-result-summary{display:flex;gap:.55rem 1rem;flex-wrap:wrap;align-items:center}
.mathcy-result-details{margin-top:1rem;padding-top:1rem;border-top:1px solid var(--mq-border)}
.mathcy-result-details__title{margin:0 0 .75rem;font-size:1rem;text-align:center}
.mathcy-result-list{display:grid;gap:.65rem}
.mathcy-result-row{display:grid;grid-template-columns:minmax(110px,.85fr) minmax(150px,1.2fr) minmax(120px,.85fr) minmax(90px,.65fr);gap:.65rem;align-items:stretch;padding:.7rem;border:1px solid var(--mq-border);border-radius:10px;background:#fff}
.mathcy-result-row__question{display:flex;align-items:center;font-weight:750}
.mathcy-result-row__cell{display:flex;flex-direction:column;justify-content:center;min-width:0}
.mathcy-result-row__cell span{font-size:.78rem;color:var(--mq-muted);line-height:1.35}
.mathcy-result-row__cell strong{font-size:.95rem;overflow-wrap:anywhere}
.mathcy-result-row.is-correct .mathcy-result-row__status strong{color:var(--mq-ok)}
.mathcy-result-row.is-wrong .mathcy-result-row__status strong{color:var(--mq-bad)}
.mathcy-result-row.is-open .mathcy-result-row__status strong{color:var(--mq-muted)}
.mathcy-result-row__points{text-align:center}
@media(max-width:820px){.mathcy-result-row{grid-template-columns:1fr 1fr}.mathcy-result-row__question{grid-column:1/-1}.mathcy-result-row__points{text-align:left}}
@media(max-width:520px){.mathcy-result-summary{justify-content:center;text-align:center}.mathcy-result-row{grid-template-columns:1fr;text-align:center}.mathcy-result-row__question{justify-content:center}.mathcy-result-row__points{text-align:center}}

/* v1.15.0: center quiz action buttons */
.mathcy-quiz__actions{text-align:center}

/* v1.19.0: solutions open in a responsive modal after submission */
.mathcy-question__solution-template{display:none!important}
.mathcy-reset[hidden]{display:none!important}
.mathcy-solutions-modal[hidden]{display:none!important}
.mathcy-solutions-modal{position:fixed;inset:0;z-index:2147483000;display:flex;align-items:center;justify-content:center;padding:20px}
.mathcy-solutions-modal__backdrop{position:absolute;inset:0;background:rgba(15,23,42,.58);backdrop-filter:blur(2px)}
.mathcy-solutions-modal__dialog{position:relative;z-index:1;display:flex;flex-direction:column;width:min(920px,100%);max-height:calc(100dvh - 40px);overflow:hidden;background:#fff;border:1px solid var(--mq-border);border-radius:16px;box-shadow:0 24px 70px rgba(15,23,42,.28);outline:none}
.mathcy-solutions-modal__header{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:1rem 1.15rem;border-bottom:1px solid var(--mq-border);background:#fff}
.mathcy-solutions-modal__title{margin:0;font-size:1.2rem;line-height:1.3}
.mathcy-solutions-modal__close{display:inline-flex;align-items:center;justify-content:center;flex:0 0 42px;width:42px;height:42px;padding:0;border:1px solid var(--mq-border);border-radius:10px;background:#fff;color:var(--mq-text);font:inherit;font-size:1.65rem;line-height:1;cursor:pointer}
.mathcy-solutions-modal__body{overflow-y:auto;overscroll-behavior:contain;padding:1rem 1.15rem;min-width:0}
.mathcy-modal-solution{min-width:0;padding:1rem;border:1px solid var(--mq-border);border-radius:12px;background:var(--mq-soft)}
.mathcy-modal-solution+.mathcy-modal-solution{margin-top:.9rem}
.mathcy-modal-solution__title{margin:0 0 .7rem;font-size:1rem;text-align:center}
.mathcy-modal-solution__content{min-width:0}
.mathcy-modal-solution__content>:first-child{margin-top:0}
.mathcy-modal-solution__content>:last-child{margin-bottom:0}
.mathcy-modal-solution__content img{display:block;max-width:100%;height:auto;margin:.75rem auto}
.mathcy-solutions-modal__footer{display:flex;justify-content:center;padding:.85rem 1.15rem;border-top:1px solid var(--mq-border);background:#fff}
html.mathcy-solutions-open,body.mathcy-solutions-open{overflow:hidden!important}
.mathcy-solutions-modal .mathcy-math-block{max-width:100%;min-width:0;text-align:center}
.mathcy-solutions-modal mjx-container[display="true"]{max-width:100%}
@media(max-width:640px){.mathcy-solutions-modal{padding:10px}.mathcy-solutions-modal__dialog{width:100%;max-height:calc(100dvh - 20px);border-radius:13px}.mathcy-solutions-modal__header{padding:.8rem .9rem}.mathcy-solutions-modal__body{padding:.8rem}.mathcy-modal-solution{padding:.8rem}.mathcy-solutions-modal__footer{padding:.7rem .8rem}}

/* v1.24.0: intrinsic-width answer tabs that wrap as whole tabs and always fill each row.
   The previous max-content min-width caused overflow specifically on medium-width layouts. */
.mathcy-options{
  display:flex;
  flex-wrap:wrap;
  align-items:stretch;
  gap:.65rem;
  width:100%;
}
.mathcy-option{
  flex:1 1 max-content;
  width:auto;
  min-width:140px;
  max-width:100%;
}
.mathcy-option--letter-only{
  flex:1 1 84px;
  width:auto;
  min-width:72px;
  max-width:100%;
}
.mathcy-option__label{
  min-width:0;
  max-width:100%;
  white-space:normal;
  overflow-wrap:normal;
  word-break:normal;
}
.mathcy-option__label mjx-container{
  max-width:100%!important;
  white-space:normal!important;
}

/* Very small screens: every answer gets the full line. */
@media(max-width:420px){
  .mathcy-option,
  .mathcy-option--letter-only{
    flex:1 1 100%;
    width:100%;
    min-width:0;
  }
}

/* v1.25.0: drag-and-drop ordering questions */
.mathcy-order{
  display:grid;
  gap:.65rem;
  width:100%;
  margin-top:.9rem;
}
.mathcy-order-tile{
  appearance:none;
  -webkit-appearance:none;
  display:grid;
  grid-template-columns:28px minmax(0,1fr);
  align-items:center;
  gap:.7rem;
  width:100%;
  min-height:58px;
  margin:0;
  padding:.72rem .85rem;
  border:1px solid var(--mq-border);
  border-radius:11px;
  background:#fff;
  color:inherit;
  font:inherit;
  line-height:1.5;
  text-align:left;
  cursor:grab;
  touch-action:none;
  user-select:none;
  -webkit-user-select:none;
  transition:border-color .15s ease,box-shadow .15s ease,transform .15s ease,opacity .15s ease;
}
.mathcy-order-tile:hover{border-color:#aab6c5}
.mathcy-order-tile:focus-visible{outline:2px solid currentColor;outline-offset:2px}
.mathcy-order-tile:active{cursor:grabbing}
.mathcy-order-tile.is-dragging{
  z-index:2;
  border-color:#94a3b8;
  box-shadow:0 10px 24px rgba(15,23,42,.16);
  opacity:.84;
  cursor:grabbing;
}
.mathcy-order-tile:disabled{
  cursor:default;
  opacity:1;
}
.mathcy-order-tile__handle{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:1.15rem;
  line-height:1;
  color:var(--mq-muted);
  letter-spacing:-.2em;
  padding-right:.2em;
  pointer-events:none;
}
.mathcy-order-tile__content{
  min-width:0;
  overflow-wrap:anywhere;
  pointer-events:none;
}
.mathcy-order-tile__content *{pointer-events:none}
.mathcy-order-tile__content mjx-container{max-width:100%!important}
.mathcy-order-note{
  margin:.55rem 0 0;
  color:var(--mq-muted);
  font-size:.86rem;
  text-align:center;
}
.mathcy-order.is-locked .mathcy-order-tile{box-shadow:none}
@media(max-width:640px){
  .mathcy-order{gap:.55rem}
  .mathcy-order-tile{
    grid-template-columns:24px minmax(0,1fr);
    gap:.55rem;
    min-height:56px;
    padding:.68rem .7rem;
  }
}

