/* ================================================================
   composite-irregular-shapes.css
   ----------------------------------------------------------------
   Styling for the "Composite & Irregular Shapes" skill quizzes on
   the Class 5 Math page:

     - B.1 Split Into Rectangles     (.cis-stage, L/step shape + dashed split line)
     - B.2 Missing Piece Method      (.cis-stage, big rectangle + hatched "bite")
     - B.3 Real-World Floor Plans    (.cis-stage, themed room/house layouts)
     - B.4 Irregular Grid Estimation (.cis-stage, wiggly blob on a unit grid)

   Independent stylesheet (own "cis-" prefixed classes, does not
   reuse rect-square-formula.css's ".rsf-*" classes or
   grid-area-counting.css's ".grid-*" 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 \u2014 not a wrapping flex row \u2014 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) ---------- */
.cis-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;
}
.cis-stage.is-correct {
    border-color: #22c08d;
    box-shadow: 0 0 0 4px rgba(34,192,141,0.18);
}
.cis-stage.is-wrong {
    border-color: #f5427d;
    box-shadow: 0 0 0 4px rgba(245,66,125,0.15);
}
.cis-stage svg {
    width: 92%;
    height: 92%;
    display: block;
}

/* Grid-estimation stages (B.4) read better a touch wider/shorter so
   the whole blob + grid stays legible, same border/ring language. */
.cis-stage.cis-stage-wide {
    aspect-ratio: 5 / 4;
    width: clamp(250px, 90vw, 440px);
}

/* ---------- shared grid-paper lines ---------- */
.cis-line {
    stroke: #cfd8e3;
    stroke-width: 1;
}
.cis-bounds {
    fill: none;
    stroke: #b7c2cf;
    stroke-width: 1.5;
}
.cis-ghost-bounds {
    fill: none;
    stroke: #b7c2cf;
    stroke-width: 1.6;
    stroke-dasharray: 4,3;
}

/* ---------- B.1 Split Into Rectangles ---------- */
.cis-part-a {
    fill: #c8e9ff;
    stroke: #4a90c9;
    stroke-width: 2.2;
}
.cis-part-b {
    fill: #ffe3b0;
    stroke: #c99a2e;
    stroke-width: 2.2;
}
.cis-split-line {
    stroke: #f5427d;
    stroke-width: 2.2;
    stroke-dasharray: 6,4;
    fill: none;
}
.cis-dim-arrow {
    stroke: #5b4636;
    stroke-width: 1.6;
    fill: none;
}
.cis-tick-mark {
    stroke: #5b4636;
    stroke-width: 1.4;
}
.cis-dim-label {
    font-family: inherit;
    font-size: 14px;
    font-weight: 800;
    fill: #3a2c1f;
    text-anchor: middle;
}
.cis-part-tag-bg {
    fill: #fff8e8;
    stroke: #f0c96e;
    stroke-width: 1.5;
}
.cis-part-tag-text {
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 800;
    fill: #8a5a2e;
    text-anchor: middle;
}

/* ---------- B.2 Missing Piece Method ---------- */
.cis-shape-fill {
    fill: #d8f5e3;
    stroke: #33a874;
    stroke-width: 2.2;
}
.cis-missing-fill {
    fill: url(#cisHatchPattern);
    stroke: #f5427d;
    stroke-width: 2;
    stroke-dasharray: 5,3;
}
.cis-missing-label {
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 800;
    fill: #d63a70;
    text-anchor: middle;
}
.cis-hatch-stroke {
    stroke: #f5a9c4;
    stroke-width: 1.4;
}

/* ---------- B.3 Real-World Floor Plans (theme tags + labels) ---------- */
.cis-theme-room {
    fill: #c8e9ff;
    stroke: #4a90c9;
    stroke-width: 2.2;
}
.cis-theme-house {
    fill: #ffe3b0;
    stroke: #c99a2e;
    stroke-width: 2.2;
}
.cis-theme-garden {
    fill: url(#cisHatchPatternGreen);
    stroke: #4f9e3a;
    stroke-width: 2;
    stroke-dasharray: 5,3;
}
.cis-hatch-stroke-green {
    stroke: #b7e3a8;
    stroke-width: 1.4;
}
.cis-plan-tag-bg {
    fill: #eef6ff;
    stroke: #a9c4dd;
    stroke-width: 1.5;
}
.cis-plan-tag-text {
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    fill: #3a5a78;
    text-anchor: middle;
}

/* ---------- B.4 Irregular Grid Estimation ---------- */
.cis-cell-full {
    fill: #7ecbff;
    stroke: #4a90c9;
    stroke-width: 1.2;
}
.cis-cell-half {
    fill: #ffd166;
    stroke: #e0a72e;
    stroke-width: 1.2;
}
.cis-cell-empty {
    fill: none;
    stroke: none;
}
.cis-grid-caption {
    font-family: inherit;
    font-size: 12px;
    font-weight: 800;
    fill: #8a5a2e;
    text-anchor: middle;
}
.cis-legend-swatch {
    stroke-width: 1.2;
}
.cis-legend-text {
    font-family: inherit;
    font-size: 10.5px;
    font-weight: 700;
    fill: #5b4636;
    text-anchor: start;
}

/* ---------- 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. */
.cis-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: clamp(6px, 2vw, 14px);
    width: 100%;
    max-width: 620px;
    margin: 18px auto 4px;
}
.cis-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;
}
.cis-opt:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 0 rgba(0,0,0,0.08);
}
.cis-opt:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: none;
}
.cis-opt:focus-visible {
    outline: 3px solid #4a90e2;
    outline-offset: 2px;
}
.cis-opt:disabled { cursor: default; }
.cis-opt.is-correct {
    border-color: #22c08d;
    background: #eafff6;
    box-shadow: 0 0 0 4px rgba(34,192,141,0.18);
}
.cis-opt.is-wrong {
    border-color: #f5427d;
    background: #fff0f4;
    box-shadow: 0 0 0 4px rgba(245,66,125,0.15);
}

/* Number chips (all four skills) can afford slightly larger digits
   when the label is short (no unit suffix). */
.cis-opt.cis-opt-number {
    font-size: clamp(14px, 4.4vw, 20px);
    font-weight: 800;
}
/* Chips that carry a unit suffix ("24 sq cm") or a decimal
   (half-square totals like "9.5") need a touch more headroom so
   they still fit one line inside their own cell. */
.cis-opt.cis-opt-unit {
    font-size: clamp(10.5px, 3vw, 15px);
    font-weight: 800;
}

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

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

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

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

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