/* ================================================================
   primes-composites-deeper-structure.css
   ----------------------------------------------------------------
   Styles for the "Primes and Composites - Deeper Structure" skill
   group on the Class 5 Math page:

     - A.1  Factor Trees — break a composite down branch by branch
            until only primes remain (new .ds-tree-* classes).

     - A.2  Prime Factorization — The Number's DNA — every composite
            is built from a unique "recipe" of primes; shown as a
            bead strand plus exponent shorthand (new .ds-dna-*
            classes).

     - A.3  Build-a-Composite — reverse direction: multiply given
            prime "blocks" together to build a composite (new
            .ds-blocks / .ds-block classes).

     - A.4  Twin Primes & Pattern Spotting — spot pairs 2 apart that
            are both prime (new .ds-twin-* classes).

     - A.5  Real-World Prime Spotting — lockers/rows/boxes: can the
            total be split evenly? (new .ds-real-* classes).

     - A.6  Prime & Composite Number Line / Chart Recap — a 1-50
            "trophy wall" chart, color-coded (new .ds-chart-*
            classes).

   This file is fully self-contained ("ds-" prefixed classes) with
   no dependency on finding-identifying-efficiently.css or any
   other skill's stylesheet — same philosophy as that file's "fie-"
   classes. Load it 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/primes-composites-deeper-structure.css}" />
   ================================================================ */

/* ---------- shared: answer-chip picker row ---------- */
/* flex-wrap is intentionally "nowrap": there are always exactly 4
   answer chips and they must always sit in a single row on every
   screen size, phone included (Android browsers down to ~320px are
   the explicit target here). Each .ds-opt is a flexible item so the
   row shrinks to fit the quiz card instead of wrapping to a second
   line; text inside a chip may wrap to two lines, but the 4 chips
   themselves never stack. */
.ds-picker {
    display: flex;
    align-items: stretch;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 10px;
    margin: 18px auto 4px;
    width: 100%;
    max-width: 420px;
}
.ds-opt {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1 1 0;
    min-width: 0;
    max-width: 170px;
    padding: 10px 6px;
    height: auto !important;
    min-height: 56px !important;
    max-height: none !important;
    box-sizing: border-box !important;
    white-space: normal !important;
    overflow: hidden;
    font-weight: 800;
    color: var(--secondary);
    text-align: center;
    line-height: 1.2;
    gap: 4px;
}
/* Sentence/word chips (A.4, A.5) need a smaller base size since
   labels like "No — not both prime" run long. */
.ds-opt.ds-opt-text {
    font-size: 12.5px;
}
/* Number / short-expression chips (A.1 factorizations, A.2 DNA
   notation, A.3 products, A.6 chart picks). */
.ds-opt.ds-opt-number {
    font-size: 18px;
}
.quiz-number-opt.ds-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.ds-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: stage wrapper + caption ---------- */
.ds-stage-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 10px auto 4px;
}
.ds-caption {
    font-weight: 700;
    font-size: 14.5px;
    color: var(--text);
    text-align: center;
    max-width: 380px;
}
.ds-caption strong {
    color: var(--secondary);
}

/* ================================================================
   A.1 Factor Trees
   ================================================================ */
.ds-tree-wrap {
    display: flex;
    justify-content: center;
    padding: 16px 10px 6px;
    background: #fff;
    border: 3px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.06);
    max-width: 420px;
    overflow-x: auto;
}
.ds-tree-node-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.ds-tree-node {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 8px;
    border-radius: 10px;
    background: rgba(0,0,0,0.03);
    border: 2px solid var(--line);
    font-weight: 800;
    font-size: 16px;
    color: var(--secondary);
}
.ds-tree-node.is-leaf-prime {
    background: rgba(16,185,129,0.14);
    border-color: #10b981;
    color: #0a7a5c;
}
.ds-tree-children {
    display: flex;
    justify-content: center;
    gap: 14px;
    padding-top: 16px;
    position: relative;
}
.ds-tree-children::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 16px;
    background: var(--line);
    transform: translateX(-50%);
}
.ds-tree-child {
    position: relative;
    padding: 16px 8px 0;
}
.ds-tree-child::before {
    content: "";
    position: absolute;
    top: 0;
    height: 2px;
    background: var(--line);
}
.ds-tree-child:first-child::before { left: 50%; right: 0; }
.ds-tree-child:last-child::before { left: 0; right: 50%; }
.ds-tree-child::after {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 16px;
    background: var(--line);
    transform: translateX(-50%);
}
.ds-tree-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
}
.ds-tree-legend .dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    margin-right: 4px;
    vertical-align: middle;
    background: rgba(16,185,129,0.35);
    border: 1px solid #10b981;
}

/* ================================================================
   A.2 Prime Factorization — The Number's DNA
   ================================================================ */
.ds-dna-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: #fff;
    border: 3px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.06);
    max-width: 380px;
}
.ds-dna-strand {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    position: relative;
}
.ds-dna-bead {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(124,58,237,0.10);
    border: 3px solid var(--primary);
    font-weight: 800;
    font-size: 15px;
    color: var(--secondary);
}
.ds-dna-label {
    font-weight: 700;
    font-size: 13px;
    color: var(--text);
    text-align: center;
}

/* ================================================================
   A.3 Build-a-Composite
   ================================================================ */
.ds-blocks-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 16px 18px;
    background: #fff;
    border: 3px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.06);
}
.ds-blocks {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}
.ds-block {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: var(--sun);
    color: #5b3d00;
    font-weight: 800;
    font-size: 17px;
    box-shadow: 0 3px 6px rgba(0,0,0,0.10);
}
.ds-block-op {
    font-weight: 800;
    font-size: 18px;
    color: var(--text);
}
.ds-block-eq {
    font-weight: 800;
    font-size: 20px;
    color: var(--secondary);
    margin-left: 4px;
}

/* ================================================================
   A.4 Twin Primes & Pattern Spotting
   ================================================================ */
.ds-twin-strip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 14px;
    background: #fff;
    border: 3px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.06);
}
.ds-twin-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #fff;
    border: 4px solid var(--primary);
    font-weight: 800;
    font-size: 20px;
    color: var(--secondary);
    flex: 0 0 auto;
}
.ds-twin-gap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-weight: 700;
    font-size: 11.5px;
    color: var(--text);
    min-width: 56px;
}
.ds-twin-gap .line {
    width: 100%;
    height: 2px;
    background: var(--line);
    position: relative;
}
.ds-twin-gap .num {
    font-weight: 800;
    font-size: 13px;
    color: var(--secondary);
}

/* ================================================================
   A.5 Real-World Prime Spotting
   ================================================================ */
.ds-real-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: #fff;
    border: 3px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.06);
    max-width: 300px;
}
.ds-real-grid {
    display: grid;
    gap: 4px;
}
.ds-real-cell {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    background: var(--primary);
    opacity: 0.85;
}
.ds-real-cell.is-single-row {
    background: var(--sun);
}

/* ================================================================
   A.6 Prime & Composite Number Line / Chart Recap
   ================================================================ */
.ds-chart-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 4px;
    padding: 12px;
    background: #fff;
    border: 3px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.06);
    max-width: 400px;
}
.ds-chart-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    border-radius: 6px;
    font-weight: 800;
    font-size: 11px;
    color: #fff;
}
.ds-chart-cell.is-prime {
    background: #10b981;
}
.ds-chart-cell.is-composite {
    background: #6366f1;
}
.ds-chart-cell.is-special {
    background: rgba(0,0,0,0.15);
    color: var(--text);
}
.ds-chart-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px 16px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
}
.ds-chart-legend span.dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    margin-right: 4px;
    vertical-align: middle;
}
.ds-chart-legend .dot.prime { background: #10b981; }
.ds-chart-legend .dot.composite { background: #6366f1; }
.ds-chart-legend .dot.special { background: rgba(0,0,0,0.25); }

/* ---------- phone responsiveness (Android + iOS + desktop) ---------- */
@media (max-width: 560px) {
    .ds-picker { gap: 8px; margin: 14px auto 4px; max-width: 340px; }
    .ds-opt { padding: 8px 5px; min-height: 50px !important; }
    .ds-opt.ds-opt-text { font-size: 11px; }
    .ds-opt.ds-opt-number { font-size: 15px; }

    .ds-tree-wrap { max-width: 320px; padding: 12px 8px 6px; }
    .ds-tree-node { min-width: 34px; height: 34px; font-size: 13px; }
    .ds-tree-children { gap: 10px; }

    .ds-dna-card { padding: 11px 14px; max-width: 320px; }
    .ds-dna-bead { width: 32px; height: 32px; font-size: 13px; }

    .ds-block { width: 36px; height: 36px; font-size: 15px; }
    .ds-block-op { font-size: 15px; }
    .ds-block-eq { font-size: 17px; }

    .ds-twin-badge { width: 46px; height: 46px; font-size: 17px; }
    .ds-twin-gap { min-width: 46px; font-size: 10.5px; }

    .ds-real-cell { width: 13px; height: 13px; }

    .ds-chart-grid { max-width: 320px; padding: 9px; gap: 3px; }
    .ds-chart-cell { font-size: 9.5px; }
    .ds-chart-legend { font-size: 11px; gap: 6px 12px; }

    .ds-caption { font-size: 13px; max-width: 300px; }
}
/* Common small-Android widths (Galaxy A/M series, budget phones). */
@media (max-width: 400px) {
    .ds-picker { gap: 7px; max-width: 320px; }
    .ds-opt { padding: 7px 4px; min-height: 48px !important; }
    .ds-opt.ds-opt-text { font-size: 10px; }
    .ds-opt.ds-opt-number { font-size: 14px; }

    .ds-tree-wrap { max-width: 290px; padding: 10px 6px 5px; }
    .ds-tree-node { min-width: 30px; height: 30px; font-size: 12px; }
    .ds-tree-children { gap: 8px; }

    .ds-dna-bead { width: 28px; height: 28px; font-size: 12px; }
    .ds-block { width: 32px; height: 32px; font-size: 13px; }

    .ds-chart-grid { max-width: 290px; padding: 8px; gap: 2px; }
    .ds-chart-cell { font-size: 8.5px; }
}
@media (max-width: 380px) {
    .ds-picker { gap: 6px; max-width: 300px; }
    .ds-opt { padding: 6px 3px; min-height: 46px !important; }
    .ds-opt.ds-opt-text { font-size: 9.5px; }
    .ds-opt.ds-opt-number { font-size: 13px; }

    .ds-tree-wrap { max-width: 270px; }
    .ds-tree-node { min-width: 28px; height: 28px; font-size: 11px; }
    .ds-tree-children { gap: 6px; }

    .ds-dna-bead { width: 26px; height: 26px; font-size: 11px; }
    .ds-block { width: 30px; height: 30px; font-size: 12px; }

    .ds-twin-badge { width: 40px; height: 40px; font-size: 15px; }

    .ds-chart-grid { max-width: 270px; padding: 7px; gap: 2px; }
    .ds-chart-cell { font-size: 7.5px; }
}
/* Extra-narrow Android browsers (e.g. 320px viewport). */
@media (max-width: 340px) {
    .ds-picker { gap: 5px; max-width: 280px; }
    .ds-opt { padding: 5px 2px; min-height: 44px !important; }
    .ds-opt.ds-opt-text { font-size: 9px; }
    .ds-opt.ds-opt-number { font-size: 12px; }

    .ds-tree-wrap { max-width: 250px; }
    .ds-tree-node { min-width: 26px; height: 26px; font-size: 10px; }

    .ds-chart-grid { max-width: 250px; padding: 6px; gap: 2px; }
    .ds-chart-cell { font-size: 7px; }
}