/* ================================================================
   common-factors-multiples.css
   ----------------------------------------------------------------
   Styles for the "Common Factors & Common Multiples" skill group
   (Tier 2b) on the Class 5 Math page, placed right after "Finding
   Factors and Multiples Systematically":

     - A.1  Overlap Circles — Common Factors — two Venn circles
            (factors of A / factors of B) with number pills already
            sorted into left-only, right-only and the overlap; the
            child picks which of 4 numbers belongs in the overlap
            (new .cfm-venn-* classes).

     - A.2  Overlap Circles — Common Multiples — two parallel
            number lines, multiples of one number highlighted on
            each, so the child can see which numbers land on both
            lines (new .cfm-lines-* classes).

     - A.3  Which Numbers Fit Both? (Puzzle Mode) — a real-world
            sharing puzzle ("arrange both A apples and B oranges
            into equal rows of the same size") illustrated with two
            rows of fruit dots (new .cfm-puzzle-* classes).

     - A.4  Meeting Point on the Number Line — two frogs hopping in
            steps of p and q along a shared number line; the child
            finds the first spot where both frogs land (new
            .cfm-frog-* classes, built on the same .cfm-lines-*
            two-track layout as A.2).

   Every skill here shares the same 5-question-per-slot / star-
   reward / "practice more?" quiz shell as the rest of the site (via
   the .bq- / .quiz- classes from quiz-popup-theme.css and quiz-
   modal-responsive.css, loaded elsewhere). This file defines its
   own self-contained "cfm-" prefixed classes, including its own
   answer-chip wrapper (.cfm-picker), so it has no hidden cross-file
   dependency — same philosophy as factor-multiple-systematic.css's
   .ffm- classes. Load this file after the shared quiz shell
   stylesheets, e.g.:

     <link rel="stylesheet" th:href="@{/css/quiz-popup-theme.css}" />
     <link rel="stylesheet" th:href="@{/css/quiz-modal-responsive.css}" />
     <link rel="stylesheet" th:href="@{/css/common-factors-multiples.css}" />
   ================================================================ */

/* ---------- shared: answer-chip picker row ---------- */
/* flex-wrap is intentionally "nowrap": there are always exactly 4
   chips and they must always sit in a single row on every screen
   size, including small Android phone browsers. Each .cfm-opt is a
   flexible (not fixed-width) item so the row shrinks to fit the
   quiz card instead of wrapping to a second line. */
.cfm-picker {
    display: flex;
    align-items: stretch;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 10px;
    margin: 18px auto 4px;
    width: 100%;
    max-width: 420px;
}
.cfm-opt {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 0;
    min-width: 0;
    max-width: 170px;
    padding: 12px 6px;
    height: auto !important;
    min-height: 52px !important;
    max-height: none !important;
    box-sizing: border-box !important;
    white-space: normal !important;
    overflow: visible;
    font-weight: 800;
    font-size: 16px;
    color: var(--secondary);
    text-align: center;
    line-height: 1.2;
    word-break: break-word;
}
.quiz-number-opt.cfm-opt.is-correct {
    border-color: #10b981;
    background: rgba(16,185,129,0.08);
    box-shadow: 0 0 0 3px rgba(16,185,129,0.18);
}
.quiz-number-opt.cfm-opt.is-wrong {
    border-color: #ef4444;
    background: rgba(239,68,68,0.08);
    box-shadow: 0 0 0 3px rgba(239,68,68,0.18);
}

/* ---------- shared: target / instruction caption ---------- */
.cfm-target-caption {
    font-weight: 700;
    font-size: 15px;
    color: var(--text);
    text-align: center;
    margin: 4px auto 2px;
    max-width: 360px;
}
.cfm-target-caption .cfm-target-val {
    font-weight: 800;
    color: var(--secondary);
    font-size: 17px;
}

/* ================================================================
   A.1 Overlap Circles — Common Factors
   ================================================================ */
.cfm-venn-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin: 14px auto 6px;
    width: 100%;
}
.cfm-venn-stage {
    position: relative;
    width: min(330px, 92%);
    height: 208px;
    margin: 4px auto 0;
}
.cfm-venn-circle {
    position: absolute;
    top: 14px;
    width: 190px;
    height: 180px;
    border-radius: 50%;
    border: 3px solid var(--purple);
    background: rgba(157, 92, 255, 0.10);
}
.cfm-venn-circle.right {
    border-color: var(--sky);
    background: rgba(46, 155, 245, 0.10);
}
.cfm-venn-label {
    position: absolute;
    top: -4px;
    font-weight: 800;
    font-size: 12.5px;
    text-align: center;
    width: 130px;
}
.cfm-venn-label.left { left: 4px; color: var(--purple); }
.cfm-venn-label.right { right: 4px; color: var(--sky); text-align: right; }
.cfm-venn-pill {
    position: absolute;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 26px;
    padding: 0 6px;
    border-radius: 13px;
    background: #fff;
    border: 2px solid var(--secondary);
    font-weight: 800;
    font-size: 13px;
    color: var(--secondary);
    box-shadow: 0 2px 5px rgba(0,0,0,0.10);
}
.cfm-venn-pill.is-overlap {
    border-color: var(--sun);
    color: #b8860b;
    background: #fff8e8;
}
.cfm-venn-note {
    font-weight: 700;
    font-size: 12.5px;
    color: var(--text);
    opacity: 0.75;
    text-align: center;
    max-width: 300px;
}
.cfm-venn-note .cfm-overlap-word { color: var(--sun); font-weight: 800; }

/* ================================================================
   A.2 Overlap Circles — Common Multiples (parallel number lines)
   A.4 Meeting Point on the Number Line (two frogs) reuses this
   two-track layout with its own row accent classes.
   ================================================================ */
.cfm-lines-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin: 16px auto 8px;
    width: 100%;
}
.cfm-lines-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 100%;
}
.cfm-lines-row-label {
    font-weight: 800;
    font-size: 13px;
    color: var(--purple);
    text-align: center;
}
.cfm-lines-row.is-second .cfm-lines-row-label { color: var(--sky); }
.cfm-lines-row-label .cfm-lines-emoji { font-size: 15px; margin-right: 3px; }
.cfm-line-track-wrap {
    position: relative;
    width: min(430px, 94%);
    height: 40px;
}
.cfm-line-base {
    position: absolute;
    left: 0; right: 0; top: 18px;
    height: 4px;
    border-radius: 2px;
    background: var(--secondary);
    opacity: 0.20;
}
.cfm-line-tick {
    position: absolute;
    top: 10px;
    width: 2px;
    height: 20px;
    background: var(--secondary);
    opacity: 0.22;
    transform: translateX(-1px);
}
.cfm-line-num {
    position: absolute;
    top: 30px;
    transform: translateX(-50%);
    font-weight: 700;
    font-size: 9.5px;
    color: var(--secondary);
    opacity: 0.55;
}
.cfm-line-dot {
    position: absolute;
    top: 12px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    transform: translate(-50%, 0);
    background: var(--purple);
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}
.cfm-lines-row.is-second .cfm-line-dot { background: var(--sky); }
.cfm-line-dot.is-common {
    background: var(--sun);
    width: 20px;
    height: 20px;
    box-shadow: 0 0 0 3px rgba(255,193,7,0.25);
}
.cfm-line-dot-label {
    position: absolute;
    top: -17px;
    left: 50%;
    transform: translateX(-50%);
    font-weight: 800;
    font-size: 10px;
    color: inherit;
}

/* ================================================================
   A.3 Which Numbers Fit Both? (Puzzle Mode)
   ================================================================ */
.cfm-puzzle-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin: 14px auto 6px;
    width: 100%;
}
.cfm-puzzle-story {
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
    text-align: center;
    max-width: 320px;
    line-height: 1.4;
}
.cfm-puzzle-groups {
    display: flex;
    justify-content: center;
    gap: 22px;
    flex-wrap: nowrap;
    width: 100%;
}
.cfm-puzzle-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.cfm-puzzle-group-label {
    font-weight: 800;
    font-size: 13px;
    color: var(--secondary);
}
.cfm-puzzle-dots {
    display: grid;
    grid-auto-flow: row;
    gap: 3px;
    max-width: 130px;
    justify-content: center;
}
.cfm-puzzle-dot {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}
.cfm-puzzle-question {
    font-weight: 800;
    font-size: 14.5px;
    color: var(--purple);
    text-align: center;
    max-width: 320px;
    margin-top: 2px;
}

/* ---------- phone responsiveness ---------- */
@media (max-width: 560px) {
    .cfm-picker { gap: 7px; margin: 14px auto 4px; max-width: 350px; }
    .cfm-opt { padding: 9px 5px; font-size: 14px; min-height: 46px !important; }

    .cfm-venn-stage { height: 190px; }
    .cfm-venn-circle { width: 168px; height: 160px; top: 14px; }
    .cfm-venn-pill { min-width: 24px; height: 22px; font-size: 11.5px; }
    .cfm-venn-label { font-size: 11px; width: 110px; }

    .cfm-lines-wrap { gap: 10px; }
    .cfm-line-track-wrap { height: 36px; }
    .cfm-line-num { font-size: 8.5px; top: 27px; }
    .cfm-line-dot { width: 13px; height: 13px; top: 12.5px; }
    .cfm-line-dot.is-common { width: 17px; height: 17px; }

    .cfm-puzzle-groups { gap: 14px; }
    .cfm-puzzle-dots { max-width: 104px; }
    .cfm-puzzle-dot { width: 13px; height: 13px; font-size: 11px; }
    .cfm-puzzle-story, .cfm-puzzle-question { max-width: 280px; font-size: 13px; }
}
@media (max-width: 380px) {
    .cfm-picker { gap: 5px; max-width: 310px; }
    .cfm-opt { padding: 7px 4px; font-size: 12.5px; min-height: 44px !important; }

    .cfm-venn-stage { height: 172px; }
    .cfm-venn-circle { width: 148px; height: 142px; top: 12px; }
    .cfm-venn-pill { min-width: 22px; height: 20px; font-size: 10.5px; }
    .cfm-venn-label { font-size: 10px; width: 96px; }

    .cfm-line-track-wrap { width: 96%; }
    .cfm-line-dot { width: 11px; height: 11px; }
    .cfm-line-dot.is-common { width: 15px; height: 15px; }

    .cfm-puzzle-groups { gap: 10px; }
    .cfm-puzzle-dots { max-width: 88px; }
    .cfm-puzzle-dot { width: 11px; height: 11px; font-size: 10px; }
}