/* Math Worksheets — per-topic generator UI. Matches the literacy worksheet
   pages: a z-depth-2 form card with a "Worksheet Type" radio column beside the
   option fields, then the shared action-button row and a live preview. */

.mt-builder { margin-top: 0.5rem; }

/* Form card */
.mt-form { background: #fff; border-radius: 12px; max-width: 900px; }

/* Three-column card body: Worksheet Type | Options | Accommodations
   (matches the letter-sounds form's 1.4fr 1fr 1fr grid). */
.mt-form-grid {
    display: grid;
    grid-template-columns: 1.15fr 1fr 1fr;
    gap: 1rem 1.25rem;
    align-items: start;
    margin-bottom: 1rem;
}
@media (max-width: 991px) { .mt-form-grid { grid-template-columns: 1fr; } }
.mt-types-wrap > .hint,
.mt-opts-wrap > .hint,
.mt-accom-wrap > .hint { margin-bottom: 0.5rem; }
.mt-options-col { display: flex; flex-direction: column; gap: 0.5rem; }

/* Worksheet Type radios — small circular radios, stacked, like the reading pages */
.mt-types { display: flex; flex-direction: column; gap: 0.1rem; }
.mt-type {
    display: flex; align-items: center; gap: 8px; margin: 0;
    padding: 6px 4px; cursor: pointer; font-size: 0.92rem; color: #2b2b2b;
}
.mt-type:hover { color: #0f5b49; }
/* Radios + checkboxes share the small circular style from the reading pages. */
.mt-type input, .mt-field-check input {
    -webkit-appearance: none; appearance: none; flex: 0 0 auto;
    width: 16px; height: 16px; margin: 0;
    border: 1.5px solid #9aa0a6; border-radius: 50%; background: #fff; cursor: pointer;
}
.mt-type input:checked, .mt-field-check input:checked { border-color: #2b2b2b; background: radial-gradient(circle at center, #2b2b2b 0 4px, #fff 5px); }
.mt-type input:focus-visible, .mt-field-check input:focus-visible { outline: 2px solid #0b5d4a; outline-offset: 2px; }

/* Option fields — uppercase "hint" label above each control */
.mt-field-opt { display: flex; flex-direction: column; gap: 0.2rem; margin: 0; }
.mt-field-full { grid-column: 1 / -1; }
.mt-opt-lbl { margin: 0; }
/* Smaller sentence-case sub-labels for option fields (like the reading pages'
   "Number of questions" / "Answer with"), distinct from the column headers. */
.mt-sublabel { margin: 0; font-size: 0.85rem; font-weight: 600; color: #4f4f4f; text-transform: none; letter-spacing: 0; }
.mt-field-opt .mt-input,
.mt-field-opt select,
.mt-field-opt input[type="number"] {
    padding: 0.35rem 0.5rem; border: 1px solid #ced4da; border-radius: 6px;
    background: #fff; font-size: 0.9rem; color: #1a1a1a; width: 100%; max-width: 13rem;
}
.mt-field-opt input[type="number"] { max-width: 6rem; }
.mt-field-check { flex-direction: row; align-items: center; gap: 0.5rem; }
.mt-field-check .mt-opt-text { font-size: 0.9rem; color: #2b2b2b; }

/* Actions */
.mt-actions { gap: 0.5rem; align-items: center; padding-top: 0.25rem; }
/* Fallback button styling (ws-actions.css, loaded site-wide, overrides via
   !important). Dark text on mint per the site's WCAG 2.1 AA palette. */
.mt-actions .ws-action-btn {
    border: none; border-radius: 999px; padding: 8px 16px; background-color: #29f1c3;
    color: #07261f; font-weight: 700; font-size: 12px; cursor: pointer;
    display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap;
}
.mt-actions .ws-action-btn:hover { filter: brightness(0.95); }
.mt-msg { font-size: 0.85rem; color: #1e7d2e; margin-left: 0.25rem; }
.mt-msg-err { color: #c1121f; }
.mt-msg-ok { color: #1e7d2e; }

/* Preview "paper" — full-size pages (WYSIWYG: matches the printed sheet) that
   flow down the page on a plain background; the whole window scrolls to reach
   later pages (no inner scrollbox, no gray mat). */
.mt-preview { margin-top: 1.25rem; }
.mt-window { padding: 0; }

/* ===================== Practice viewer (modal) ===================== */
.mt-modal { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; }
.mt-modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.55); }
.mt-modal-dialog {
    position: relative; background: #fff; border-radius: 14px; width: min(560px, 94vw);
    max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.mt-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid #eef2f6; }
.mt-modal-head h2 { margin: 0; font-size: 1.1rem; font-weight: 700; color: #1a1a1a; }
.mt-modal-close { border: none; background: transparent; font-size: 1.6rem; line-height: 1; cursor: pointer; color: #4b5563; padding: 0 4px; }
.mt-modal-close:hover { color: #111827; }

.mt-tabs { display: flex; gap: 6px; padding: 12px 18px 0; flex-wrap: wrap; }
.mt-tab {
    border: 1px solid #d0d5da; background: #fff; border-radius: 999px; padding: 7px 15px;
    font-size: 0.85rem; font-weight: 700; color: #2b2b2b; cursor: pointer;
}
.mt-tab:hover { border-color: #29c7a0; }
.mt-tab.is-active { background: #0f7c63; border-color: #0f7c63; color: #fff; }

.mt-modal-body { padding: 18px; overflow-y: auto; }
.mt-pr-progress { font-size: 0.85rem; font-weight: 700; color: #6c757d; margin-bottom: 12px; display: flex; justify-content: space-between; gap: 10px; }
.mt-pr-score { color: #0f7c63; }

/* The problem HTML reuses the .mt-paper primitives; strip the paper chrome AND
   the full-page sizing (width/aspect-ratio) so it fits the modal, and scale the
   problem down to a modal-friendly size (selectors out-specify the injected
   worksheet CSS). */
.mt-pr-q.mt-paper { box-shadow: none; padding: 0; margin: 0; max-width: none; width: auto; aspect-ratio: auto; background: transparent; }
.mt-pr-q.mt-paper .mt-eq { font-size: 26px; }
.mt-pr-q.mt-paper .mt-vstack { font-size: 30px; }
.mt-pr-q.mt-paper .mt-ld { font-size: 26px; padding-top: 22px; }
.mt-pr-card {
    border: 1.5px solid #d8efe8; border-radius: 12px; background: #f4fbf9; padding: 26px 18px;
    text-align: center; cursor: pointer; min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
}
.mt-pr-card .mt-pr-a { font-size: 1.6rem; font-weight: 800; color: #0f5b49; }
.mt-pr-hint { font-size: 0.8rem; color: #9aa0a6; }
.mt-pr-q-block { text-align: center; margin-bottom: 16px; }

.mt-pr-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .mt-pr-choices { grid-template-columns: 1fr; } }
.mt-pr-choice {
    border: 1.5px solid #ced4da; background: #fff; border-radius: 10px; padding: 12px; font-size: 1.05rem;
    font-weight: 700; color: #1a1a1a; cursor: pointer; min-height: 48px;
}
.mt-pr-choice:hover { border-color: #0f7c63; }
.mt-pr-choice.is-correct { background: #e6f7ed; border-color: #0f7c63; color: #0f5b49; }
.mt-pr-choice.is-wrong { background: #fdecec; border-color: #c1121f; color: #c1121f; }

.mt-pr-write { margin: 4px 0 8px; }
.mt-pr-wlabel { display: block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #6c757d; margin-bottom: 6px; }
.mt-pr-input { width: 100%; padding: 0.6rem 0.7rem; border: 1.5px solid #ced4da; border-radius: 8px; font-size: 1.1rem; }
.mt-pr-input.is-correct { border-color: #0f7c63; background: #f4fbf9; }
.mt-pr-input.is-wrong { border-color: #c1121f; background: #fff6f6; }

.mt-pr-feedback { min-height: 1.4em; margin: 10px 0; font-size: 0.95rem; }
.mt-pr-feedback .mt-ok { color: #0f5b49; font-weight: 700; }
.mt-pr-feedback .mt-err { color: #c1121f; font-weight: 700; }

.mt-pr-nav { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.mt-pr-nav .ws-action-btn[disabled] { opacity: 0.5; cursor: default; }

.mt-pr-done { text-align: center; padding: 24px 8px; }
.mt-pr-done-emoji { font-size: 3rem; }
.mt-pr-done-score { font-size: 1.25rem; margin: 8px 0 18px; }
