/* ================================================================
   formula-fluency-word-problems.css
   ----------------------------------------------------------------
   Styling for the "Formula Fluency & Word Problems" skill quizzes
   on the Class 5 Math page:

     - A.1 Formula Flashcards   (.fwp-stage, labeled rectangle/square,
                                  quick length x width -> area drill)
     - A.2 Area Word Problems   (.fwp-stage, labeled rectangle plot,
                                  garden/carpet/tile/paint/farmland
                                  word-problem framing)
     - A.3 Unit Awareness       (.fwp-stage.fwp-stage-wide, a unit
                                  grid rectangle + a "1 unit square"
                                  anchor swatch, same numbers under
                                  different units)
     - A.4 Design Your Own Room (.fwp-stage, a dashed "area budget"
                                  panel; pick the length x width pair
                                  that fits the budget exactly)

   Independent stylesheet (own "fwp-" prefixed classes, does not
   reuse composite-irregular-shapes.css's ".cis-*" classes or any
   other skill's classes) but mirrors the same bordered "stage" card
   language (rings green/red via .is-correct/.is-wrong once graded)
   and the same shared answer-chip row: a 4-column CSS Grid — not a
   wrapping flex row — so all four answers are FORCED onto a single
   line at every viewport width down to small Android phones; text
   inside a chip shrinks (via clamp()) and may wrap to a second line
   inside its own cell, but the row itself never breaks into two
   rows. Loaded as a plain stylesheet link, independent of every
   other skill's CSS.
   ================================================================ */

/* ---------- shared visual "stage" (all four skills) ---------- */
.fwp-stage {
    width: clamp(230px, 78vw, 380px);
    aspect-ratio: 1 / 1;
    margin: 14px auto 6px;
    border: 3px solid var(--line);
    border-radius: 20px;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 0 rgba(0,0,0,0.06);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    overflow: hidden;
}
.fwp-stage.is-correct {
    border-color: #22c08d;
    box-shadow: 0 0 0 4px rgba(34,192,141,0.18);
}
.fwp-stage.is-wrong {
    border-color: #f5427d;
    box-shadow: 0 0 0 4px rgba(245,66,125,0.15);
}
.fwp-stage svg {
    width: 92%;
    height: 92%;
    display: block;
}

/* Unit-Awareness stages (A.3) read better a touch wider/shorter so
   the unit grid + anchor swatch + legend all stay legible, same
   border/ring language as the square stage. */
.fwp-stage.fwp-stage-wide {
    aspect-ratio: 5 / 4;
    width: clamp(250px, 90vw, 440px);
}

/* ---------- shared grid-paper lines ---------- */
.fwp-line {
    stroke: #cfd8e3;
    stroke-width: 1;
}
.fwp-bounds {
    fill: none;
    stroke: #b7c2cf;
    stroke-width: 1.5;
}
.fwp-dashed-bounds {
    fill: none;
    stroke: #b7c2cf;
    stroke-width: 1.8;
    stroke-dasharray: 5,4;
}

/* ---------- shared dimension callouts (A.1 / A.2 / A.3) ---------- */
.fwp-dim-arrow {
    stroke: #5b4636;
    stroke-width: 1.6;
    fill: none;
}
.fwp-tick-mark {
    stroke: #5b4636;
    stroke-width: 1.4;
}
.fwp-dim-label {
    font-family: inherit;
    font-size: 14px;
    font-weight: 800;
    fill: #3a2c1f;
    text-anchor: middle;
}

/* ---------- A.1 Formula Flashcards ---------- */
.fwp-shape-fill {
    fill: #c8e9ff;
    stroke: #4a90c9;
    stroke-width: 2.2;
}
.fwp-shape-tag-bg {
    fill: #fff8e8;
    stroke: #f0c96e;
    stroke-width: 1.5;
}
.fwp-shape-tag-text {
    font-family: inherit;
    font-size: 13px;
    font-weight: 800;
    fill: #8a5a2e;
    text-anchor: middle;
}

/* ---------- A.2 Area Word Problems ---------- */
.fwp-plot-fill {
    fill: #d8f5e3;
    stroke: #33a874;
    stroke-width: 2.2;
}
.fwp-plot-tag-bg {
    fill: #eef6ff;
    stroke: #a9c4dd;
    stroke-width: 1.5;
}
.fwp-plot-tag-text {
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    fill: #3a5a78;
    text-anchor: middle;
}

/* ---------- A.3 Unit Awareness ---------- */
.fwp-unit-cell {
    fill: #ffe3b0;
    stroke: #c99a2e;
    stroke-width: 1.2;
}
.fwp-anchor-cell {
    fill: #ffd166;
    stroke: #e0a72e;
    stroke-width: 1.8;
}
.fwp-anchor-tag-bg {
    fill: #fff8e8;
    stroke: #f0c96e;
    stroke-width: 1.5;
}
.fwp-anchor-tag-text {
    font-family: inherit;
    font-size: 10.5px;
    font-weight: 800;
    fill: #8a5a2e;
    text-anchor: middle;
}
.fwp-unit-caption {
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 700;
    fill: #5b4636;
    text-anchor: middle;
}

/* ---------- A.4 Design Your Own Room ---------- */
.fwp-budget-panel {
    fill: #eef6ff;
}
.fwp-budget-number {
    font-family: inherit;
    font-size: 34px;
    font-weight: 800;
    fill: #3a5a78;
    text-anchor: middle;
}
.fwp-budget-unit {
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    fill: #5b7fa0;
    text-anchor: middle;
}
.fwp-budget-caption {
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    fill: #5b4636;
    text-anchor: middle;
}
.fwp-budget-icon-stroke {
    stroke: #a9c4dd;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
}

/* ---------- shared answer-chip row (all four skills' chips) ----------
   4-column grid = guaranteed single line at every width; never
   switches to flex-wrap, so the four chips can't stack. */
.fwp-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: clamp(6px, 2vw, 14px);
    width: 100%;
    max-width: 620px;
    margin: 18px auto 4px;
}
.fwp-opt {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 58px;
    padding: 8px 4px;
    border-radius: 14px;
    border: 3px solid var(--line);
    background: #fff;
    font-family: inherit;
    font-weight: 700;
    color: #3a2c1f;
    font-size: clamp(11px, 3.3vw, 16px);
    line-height: 1.15;
    text-align: center;
    word-break: break-word;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.fwp-opt:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 0 rgba(0,0,0,0.08);
}
.fwp-opt:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: none;
}
.fwp-opt:focus-visible {
    outline: 3px solid #4a90e2;
    outline-offset: 2px;
}
.fwp-opt:disabled { cursor: default; }
.fwp-opt.is-correct {
    border-color: #22c08d;
    background: #eafff6;
    box-shadow: 0 0 0 4px rgba(34,192,141,0.18);
}
.fwp-opt.is-wrong {
    border-color: #f5427d;
    background: #fff0f4;
    box-shadow: 0 0 0 4px rgba(245,66,125,0.15);
}

/* Number chips (A.1 / A.2) can afford slightly larger digits when
   the label is short (no unit suffix). */
.fwp-opt.fwp-opt-number {
    font-size: clamp(14px, 4.4vw, 20px);
    font-weight: 800;
}
/* Chips that carry a unit suffix ("40 sq m") or a decimal need a
   touch more headroom so they still fit one line inside their cell. */
.fwp-opt.fwp-opt-unit {
    font-size: clamp(10.5px, 3vw, 15px);
    font-weight: 800;
}
/* Text chips (A.3 unit-label combos like "24 cm\u00b2", A.4 pairs
   like "6 \u00d7 4") are the longest labels in this file, so they get
   the smallest floor while still forcing a single-line row. */
.fwp-opt.fwp-opt-text {
    font-size: clamp(10px, 3vw, 14.5px);
    font-weight: 800;
    letter-spacing: 0.01em;
}

/* ---------- responsive tuning ---------- */
@media (max-width: 380px) {
    .fwp-stage { width: clamp(190px, 82vw, 280px); margin: 10px auto 4px; }
    .fwp-stage.fwp-stage-wide { width: clamp(230px, 90vw, 330px); }
    .fwp-options { gap: 5px; margin: 12px auto 4px; }
    .fwp-opt { min-height: 50px; padding: 6px 3px; font-size: clamp(10px, 3.2vw, 13px); border-width: 2px; border-radius: 12px; }
    .fwp-opt.fwp-opt-number { font-size: clamp(13px, 4.2vw, 18px); }
    .fwp-opt.fwp-opt-unit { font-size: clamp(9.5px, 2.9vw, 12.5px); }
    .fwp-opt.fwp-opt-text { font-size: clamp(8.5px, 2.7vw, 11.5px); }
}

@media (min-width: 480px) {
    .fwp-opt { min-height: 64px; }
}

@media (min-width: 700px) {
    .fwp-options { gap: 16px; }
    .fwp-opt { min-height: 74px; font-size: 17px; }
    .fwp-opt.fwp-opt-number { font-size: 21px; }
    .fwp-opt.fwp-opt-unit { font-size: 15px; }
    .fwp-opt.fwp-opt-text { font-size: 14.5px; }
}

@media (min-width: 900px) {
    .fwp-stage { width: clamp(280px, 38vw, 380px); }
    .fwp-stage.fwp-stage-wide { width: clamp(360px, 48vw, 480px); }
    .fwp-opt { min-height: 80px; }
}

@media (max-height: 700px) {
    .fwp-stage { width: clamp(190px, 50vw, 260px); margin: 8px auto 4px; }
    .fwp-stage.fwp-stage-wide { width: clamp(230px, 58vw, 330px); }
    .fwp-options { margin: 10px auto 4px; }
    .fwp-opt { min-height: 48px; }
}