/* ================================================================
   decimal-mul-div.css
   ----------------------------------------------------------------
   Styles for the "Multiplying & Dividing Decimals (conceptual
   only)" skill group on the Class 4 Math page:

     - A.1  Decimal x Whole Number (Repeated Shading) — "3 groups
            of 0.2" — the same repeated-shading / repeated-addition
            bridge used for fraction x whole number, just with
            decimal tenths bars instead of fraction bars (new
            .dmd-repeat-* classes).

     - A.2  Decimal x Decimal (Area Model) — an overlapping shaded
            10x10 grid (columns x rows) that visually multiplies
            0.4 x 0.3; the double-shaded overlap area is the answer,
            directly mirroring the fraction area model so the idea
            transfers instead of feeling like a brand new rule (new
            .dmd-area-* classes).

     - A.3  Dividing a Decimal by a Whole Number — "0.6 shared
            between 3 people" — an already-shaded tenths bar split
            into equal groups, one group highlighted as "1 share"
            (new .dmd-share-* classes).

     - A.4  Dividing Whole Number by a Decimal (Measuring) — "How
            many 0.25s fit in 2?" — a measuring bar broken into
            equal decimal-sized steps, each step numbered so the
            child can count how many fit, mirroring the fraction
            "how many 1/4s fit in 3" task (new .dmd-measure-*
            classes).

     - A.5  Why Multiplying Decimals Can Make Numbers Smaller — a
            dedicated conceptual stop reusing the area-model grid
            alongside two reference strips, so the overlap can be
            visually compared against each starting strip and shown
            to be smaller than either one (new .dmd-smaller-*
            classes).

   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 "dmd-" prefixed classes instead of reusing any
   other skill file's markup, so it has no hidden cross-file
   dependency — same philosophy as decimal-rwv.css's .drw-* classes
   and fraction-mul-div.css's .fmd-* 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/decimal-mul-div.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,
   phone included — same reasoning as decimal-rwv.css's .drw-picker.
   Each .dmd-opt is a flexible (not fixed-width) item so the row
   shrinks to fit the quiz card instead of wrapping to a second
   line. */
.dmd-picker {
    display: flex;
    align-items: stretch;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 10px;
    margin: 18px auto 4px;
    width: 100%;
    max-width: 420px;
}
.dmd-opt {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 0;
    min-width: 0;
    max-width: 170px;
    padding: 12px 8px;
    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: 17px;
    color: var(--secondary);
    text-align: center;
    line-height: 1.25;
    word-break: break-word;
}
/* modifier for the conceptual (A.5) skill, whose four chips carry
   short phrases instead of a bare number — same single-row rule,
   just a smaller resting font so the phrase still fits comfortably
   on one line inside the chip. */
.dmd-opt.dmd-opt-phrase {
    font-size: 13.5px;
    padding: 10px 6px;
    line-height: 1.2;
}
.quiz-number-opt.dmd-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.dmd-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: small caption/equation text under a visual ---------- */
.dmd-caption {
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
    text-align: center;
    max-width: 340px;
    margin: 2px auto 0;
}
.dmd-caption .dmd-caption-val {
    font-weight: 800;
    color: var(--secondary);
}

/* ================================================================
   A.1 Decimal x Whole Number (Repeated Shading)
   ================================================================ */
.dmd-repeat-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin: 16px auto 6px;
}
.dmd-repeat-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}
.dmd-repeat-bar {
    display: flex;
    width: 92px;
    height: 42px;
    border-radius: 10px;
    overflow: hidden;
    border: 3px solid var(--line);
    background: #fff;
}
.dmd-repeat-seg {
    flex: 1 1 0;
    border-right: 1px solid var(--line);
    background: transparent;
}
.dmd-repeat-seg:last-child { border-right: none; }
.dmd-repeat-seg.is-shaded { background: var(--mint); }
.dmd-repeat-plus {
    font-weight: 800;
    font-size: 20px;
    color: var(--secondary);
    opacity: 0.75;
    padding: 0 2px;
}

/* ================================================================
   A.2 Decimal x Decimal (Area Model)
   ================================================================ */
.dmd-area-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin: 14px auto 4px;
    width: 100%;
}
.dmd-area-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(10, 1fr);
    gap: 1px;
    background: var(--line);
    border: 2px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    width: 200px;
    height: 200px;
}
.dmd-area-cell { background: #fff; }
.dmd-area-cell.is-col { background: rgba(46,155,245,0.35); }
.dmd-area-cell.is-row { background: rgba(255,196,61,0.45); }
.dmd-area-cell.is-overlap { background: #10b981; }
.dmd-area-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px 16px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text);
}
.dmd-area-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.dmd-area-legend-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 4px;
    border: 1px solid var(--line);
}
.dmd-area-legend-swatch.is-col { background: rgba(46,155,245,0.35); }
.dmd-area-legend-swatch.is-row { background: rgba(255,196,61,0.45); }
.dmd-area-legend-swatch.is-overlap { background: #10b981; }

/* ================================================================
   A.3 Dividing a Decimal by a Whole Number
   ================================================================ */
.dmd-share-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin: 16px auto 6px;
}
.dmd-share-groups {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: center;
    gap: 14px;
}
.dmd-share-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.dmd-share-cells {
    display: flex;
    border-radius: 8px;
    overflow: hidden;
    border: 3px solid var(--line);
    background: var(--mint);
}
.dmd-share-cell {
    width: 22px;
    height: 34px;
    border-right: 1px solid rgba(255,255,255,0.55);
    background: var(--mint);
}
.dmd-share-cell:last-child { border-right: none; }
.dmd-share-group.is-first .dmd-share-cells {
    border-color: var(--secondary);
    background: var(--sky);
}
.dmd-share-group.is-first .dmd-share-cell { background: var(--sky); }
.dmd-share-tag {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text);
    opacity: 0.65;
}
.dmd-share-group.is-first .dmd-share-tag {
    color: var(--secondary);
    opacity: 1;
}

/* ================================================================
   A.4 Dividing Whole Number by a Decimal (Measuring)
   ================================================================ */
.dmd-measure-question {
    font-weight: 700;
}
.dmd-measure-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin: 16px auto 6px;
    width: 100%;
}
.dmd-measure-bar {
    display: flex;
    width: min(340px, 92%);
    height: 48px;
    border-radius: 10px;
    overflow: hidden;
    border: 3px solid var(--line);
    background: #fff;
}
.dmd-measure-seg {
    flex: 1 1 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px dashed rgba(0,0,0,0.25);
    background: var(--sun);
    opacity: 0.85;
    font-size: 11px;
    font-weight: 800;
    color: #7a4a00;
}
.dmd-measure-seg:last-child { border-right: none; }
.dmd-measure-seg.is-whole-end { border-right: 3px solid var(--secondary); }

/* ================================================================
   A.5 Why Multiplying Decimals Can Make Numbers Smaller
   ================================================================ */
.dmd-smaller-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin: 14px auto 4px;
    width: 100%;
}
.dmd-smaller-refs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 18px;
}
.dmd-smaller-ref {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.dmd-smaller-ref-label {
    font-size: 12px;
    font-weight: 800;
    color: var(--secondary);
}
.dmd-smaller-bar {
    display: flex;
    width: 130px;
    height: 26px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--line);
    background: #fff;
}
.dmd-smaller-bar-seg {
    flex: 1 1 0;
    border-right: 1px solid var(--line);
    background: transparent;
}
.dmd-smaller-bar-seg:last-child { border-right: none; }
.dmd-smaller-bar-seg.is-col { background: rgba(46,155,245,0.5); }
.dmd-smaller-bar-seg.is-row { background: rgba(255,196,61,0.6); }

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

    .dmd-repeat-bar { width: 74px; height: 36px; }
    .dmd-repeat-plus { font-size: 16px; }

    .dmd-area-grid { width: 160px; height: 160px; }

    .dmd-share-cell { width: 18px; height: 28px; }

    .dmd-measure-bar { height: 40px; }
    .dmd-measure-seg { font-size: 10px; }

    .dmd-smaller-bar { width: 108px; height: 22px; }
}
@media (max-width: 380px) {
    .dmd-picker { gap: 5px; max-width: 300px; }
    .dmd-opt { padding: 7px 3px; font-size: 12.5px; min-height: 42px !important; }
    .dmd-opt.dmd-opt-phrase { font-size: 10.5px; padding: 6px 3px; }

    .dmd-repeat-bar { width: 62px; height: 32px; }

    .dmd-area-grid { width: 136px; height: 136px; }
    .dmd-area-legend { font-size: 11px; gap: 6px 10px; }

    .dmd-share-cell { width: 15px; height: 24px; }
    .dmd-share-tag { font-size: 9.5px; }

    .dmd-measure-bar { height: 36px; }
    .dmd-measure-seg { font-size: 9px; }

    .dmd-smaller-bar { width: 92px; height: 20px; }
    .dmd-smaller-ref-label { font-size: 10.5px; }
}