/* ================================================================
   decimal-foundations.css
   ----------------------------------------------------------------
   Styles for the "What is a decimal? (Foundations)" skill group on
   the Class 4 Math page:

     - A.1  Splitting the Whole into Tens — a strip/bar cut into
            exactly 10 equal parts, some shaded. A bridging fraction
            ("n/10") sits under the bar before the decimal answer is
            asked for (new .dec-tenbar-* classes; the stacked
            .dec-frac symbol is self-contained, same philosophy as
            fraction-mul-div.css's .fmd-frac — no cross-file
            dependency).

     - A.2  The Missing Piece Between Whole Numbers — a number line
            from 0 to 1 with all 10 tenths ticks marked and a single
            dot placed at one of them (new .dec-line-* classes),
            asking what decimal the dot marks.

     - A.3  Base-10 Blocks: Flat = Whole — a 10\u00d710 grid standing in
            for the "flat," with whole shaded columns for tenths and
            extra individual cells for hundredths (new .dec-flat-*
            classes, layered exactly like real base-10 blocks: a
            column strip is 1/10 of the flat, a single cell is
            1/100).

     - A.4  Naming the Spots After the Point — a small place-value
            chart (Ones | . | Tenths | Hundredths) with one column
            highlighted (new .dec-pv-* classes), asking for the
            *value* of the highlighted digit — reinforcing that the
            point is a divider, not a digit.

     - A.5  Equal Cuts Only (Trap questions) — a bar cut into 10
            pieces that are sometimes genuinely equal and sometimes
            not (new .dec-eqcheck-* classes, widths set inline per
            question), asking the child to catch the "any pieces =
            equal parts" misconception.

   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 small answer-chip wrapper (.dec-picker) instead of reusing
   any other skill file's picker markup, so it has no hidden
   cross-file dependency. 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-foundations.css}" />
   ================================================================ */

/* ---------- shared: stacked fraction symbol (.dec-frac) ---------- */
/* Used only as the fraction-to-decimal "bridge" caption in A.1 —
   self-contained markup, not reusing any other file's fraction
   symbol internals. */
.dec-frac {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.05;
    font-weight: 800;
    color: var(--secondary);
}
.dec-frac-num, .dec-frac-den {
    font-size: 18px;
}
.dec-frac-line {
    width: 100%;
    height: 3px;
    background: currentColor;
    border-radius: 2px;
    margin: 2px 0;
}

/* ---------- shared: answer-chip picker row ---------- */
/* flex-wrap is intentionally "nowrap": there are only ever 2 (Yes/No)
   or 4 (number) chips, and they must always sit in a single row.
   Each .dec-opt is a flexible (not fixed-width) item so the row
   shrinks to fit the quiz card instead of wrapping to a second line. */
.dec-picker {
    display: flex;
    align-items: stretch;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 10px;
    margin: 18px auto 4px;
    width: 100%;
    max-width: 360px;
}
.dec-opt {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 0;
    min-width: 0;
    max-width: 150px;
    padding: 12px 8px;
    /* .quiz-number-opt (shared quiz stylesheet) sets a fixed height
       meant for a single short line. These chips can wrap to 2-3
       lines (esp. the Yes/No text chips in A.5), so force the box to
       grow with its content instead of clipping/overflowing it. */
    height: auto !important;
    min-height: 56px !important;
    max-height: none !important;
    box-sizing: border-box !important;
    white-space: normal !important;
    overflow: visible;
}
.dec-opt-num {
    font-weight: 800;
    font-size: 20px;
    color: var(--secondary);
}
.dec-opt-text {
    font-weight: 700;
    font-size: 14.5px;
    color: var(--secondary);
    text-align: center;
    line-height: 1.3;
}
.quiz-number-opt.dec-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.dec-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);
}

/* ---------- A.1 ten-part bar (fraction \u2192 decimal bridge) ---------- */
.dec-tenbar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin: 18px auto 6px;
}
.dec-tenbar {
    display: flex;
    width: min(320px, 90%);
    height: 60px;
    border-radius: 12px;
    overflow: hidden;
    border: 3px solid var(--line);
    background: #fff;
}
.dec-tenbar-seg {
    flex: 1 1 0;
    border-right: 2px solid var(--line);
    background: transparent;
    transition: background .2s ease;
}
.dec-tenbar-seg:last-child { border-right: none; }
.dec-tenbar-seg.is-shaded { background: var(--sky); }
.dec-tenbar-caption {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
}

/* ---------- A.2 number line ---------- */
.dec-line-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin: 26px auto 14px;
    width: 100%;
}
.dec-number-line {
    position: relative;
    width: min(420px, 92%);
    height: 64px;
}
.dec-line-track {
    position: absolute;
    left: 0; right: 0; top: 28px;
    height: 4px;
    border-radius: 2px;
    background: var(--secondary);
    opacity: 0.25;
}
.dec-line-tick {
    position: absolute;
    top: 18px;
    width: 2px;
    height: 24px;
    background: var(--secondary);
    opacity: 0.35;
    transform: translateX(-1px);
}
.dec-line-tick.is-end {
    opacity: 0.8;
    width: 3px;
    height: 30px;
    top: 15px;
}
.dec-line-label {
    position: absolute;
    top: 46px;
    transform: translateX(-50%);
    font-weight: 800;
    font-size: 13px;
    color: var(--secondary);
    opacity: 0.85;
}
.dec-line-dot {
    position: absolute;
    top: 20px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--pink);
    border: 3px solid #fff;
    box-shadow: 0 0 0 2px var(--pink), 0 3px 8px rgba(0,0,0,0.2);
    transform: translate(-50%, 0);
}
.dec-line-question-mark {
    position: absolute;
    top: -22px;
    transform: translateX(-50%);
    font-weight: 800;
    font-size: 16px;
    color: var(--pink);
}

/* ---------- A.3 base-10 "flat" grid ---------- */
.dec-flat-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin: 16px auto 8px;
}
.dec-flat-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: 220px;
    height: 220px;
}
.dec-flat-cell { background: #fff; }
.dec-flat-cell.is-tenth { background: var(--sky); opacity: 0.85; }
.dec-flat-cell.is-hundredth { background: var(--sun); }
.dec-flat-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}
.dec-flat-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--secondary);
    opacity: 0.8;
}
.dec-flat-legend-swatch {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    border-radius: 4px;
    border: 1px solid var(--line);
}
.dec-flat-legend-swatch.is-tenth { background: var(--sky); opacity: 0.85; }
.dec-flat-legend-swatch.is-hundredth { background: var(--sun); }

/* ---------- A.4 place-value chart ---------- */
.dec-pvchart-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin: 20px auto 10px;
}
.dec-pvchart {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 8px;
}
.dec-pv-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 62px;
}
.dec-pv-label {
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text);
    opacity: 0.75;
    text-align: center;
}
.dec-pv-digit {
    width: 54px;
    height: 54px;
    border-radius: 12px;
    border: 3px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 24px;
    color: var(--secondary);
    background: #fff;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.dec-pv-col.is-highlight .dec-pv-digit {
    border-color: var(--sun);
    background: rgba(245,166,35,0.12);
    box-shadow: 0 0 0 4px rgba(245,166,35,0.18);
}
.dec-pv-point {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 54px;
    padding-bottom: 4px;
    width: 18px;
}
.dec-pv-point-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--secondary);
}
.dec-pv-point-label {
    font-size: 9.5px;
    font-weight: 700;
    color: var(--text);
    opacity: 0.6;
    margin-top: 4px;
    white-space: nowrap;
}

/* ---------- A.5 equal-cuts checker bar ---------- */
.dec-eqcheck-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin: 18px auto 6px;
}
.dec-eqcheck-bar {
    display: flex;
    width: min(340px, 92%);
    height: 60px;
    border-radius: 12px;
    overflow: hidden;
    border: 3px solid var(--line);
    background: #fff;
}
.dec-eqcheck-seg {
    flex: 0 0 auto;
    height: 100%;
    border-right: 2px solid var(--line);
    background: rgba(46,155,245,0.10);
}
.dec-eqcheck-seg:nth-child(even) { background: rgba(46,155,245,0.20); }
.dec-eqcheck-seg:last-child { border-right: none; }
.dec-eqcheck-caption {
    font-weight: 700;
    font-size: 13.5px;
    color: var(--text);
    text-align: center;
    max-width: 320px;
}

/* ---------- phone responsiveness ---------- */
@media (max-width: 560px) {
    .dec-frac-num, .dec-frac-den { font-size: 15px; }
    .dec-picker { gap: 8px; margin: 14px auto 4px; max-width: 320px; }
    .dec-opt { padding: 9px 6px; }
    .dec-opt-num { font-size: 17px; }
    .dec-opt-text { font-size: 12.5px; }

    .dec-tenbar { height: 46px; border-radius: 10px; }
    .dec-tenbar-caption { font-size: 12.5px; gap: 8px; }

    .dec-number-line { height: 56px; }
    .dec-line-track { top: 24px; }
    .dec-line-tick { top: 15px; height: 20px; }
    .dec-line-tick.is-end { top: 12px; height: 26px; }
    .dec-line-label { top: 38px; font-size: 11.5px; }
    .dec-line-dot { top: 17px; width: 16px; height: 16px; }
    .dec-line-question-mark { top: -20px; font-size: 14px; }

    .dec-flat-grid { width: 168px; height: 168px; }
    .dec-flat-legend { gap: 10px; }
    .dec-flat-legend-item { font-size: 11px; }

    .dec-pv-col { width: 50px; }
    .dec-pv-digit { width: 44px; height: 44px; font-size: 19px; border-radius: 10px; }
    .dec-pv-label { font-size: 9.5px; }
    .dec-pv-point { height: 44px; width: 14px; }

    .dec-eqcheck-bar { height: 46px; }
    .dec-eqcheck-caption { font-size: 12px; }
}
@media (max-width: 380px) {
    .dec-frac-num, .dec-frac-den { font-size: 13px; }
    .dec-picker { gap: 6px; max-width: 280px; }
    .dec-opt { padding: 7px 4px; }
    .dec-opt-num { font-size: 15px; }
    .dec-opt-text { font-size: 11.5px; }

    .dec-tenbar { height: 40px; }

    .dec-number-line { height: 50px; }
    .dec-line-dot { width: 14px; height: 14px; }

    .dec-flat-grid { width: 140px; height: 140px; }

    .dec-pv-col { width: 42px; }
    .dec-pv-digit { width: 36px; height: 36px; font-size: 16px; }
    .dec-pv-label { font-size: 8.5px; }
    .dec-pv-point { height: 36px; width: 12px; }

    .dec-eqcheck-bar { height: 40px; }
}