/* ================================================================
   perimeter-regular-shapes.css
   ----------------------------------------------------------------
   Styling for the "Regular Shapes: Discovering the Shortcut" skill
   quizzes on the Class 5 Math page:

     - C.1 Square Spotting                    (.rs-stage / .rs-tick)
     - C.2 From Addition to Multiplication     (.rs-eq-strip / .rs-eq-mul)
     - C.3 Rectangle Spotting                  (.rs-stage / .rs-tick)
     - C.4 Formula Match (Square vs Rectangle) (.rs-stage / .rs-tick)
     - C.5 Equilateral Triangle Shortcut       (.rs-eq-strip)

   All five share one visual "stage" card (.rs-stage, styled like
   perimeter-measuring.css's .meas-stage: a bordered box that rings
   green/red via .is-correct/.is-wrong once a question is graded), an
   optional "equation strip" (.rs-eq-strip) that visually collapses a
   repeated addition into a multiplication, and one answer-chip row
   (.rs-options / .rs-opt). The chip row is a 4-column CSS Grid — not
   a wrapping flex row — specifically 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. This file is fully self-contained (its own "rs-"
   class prefix) and is loaded as a plain stylesheet link, independent
   of perimeter-foundations.css and perimeter-measuring.css.
   ================================================================ */

/* ---------- shared visual "stage" (shape + tick marks live here) ---------- */
.rs-stage {
    width: clamp(220px, 70vw, 320px);
    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;
}
.rs-stage.is-correct {
    border-color: #22c08d;
    box-shadow: 0 0 0 4px rgba(34,192,141,0.18);
}
.rs-stage.is-wrong {
    border-color: #f5427d;
    box-shadow: 0 0 0 4px rgba(245,66,125,0.15);
}
.rs-stage svg {
    width: 92%;
    height: 92%;
    display: block;
}

/* ---------- shape shell (square / rectangle / triangle) ---------- */
.rs-shape-fill {
    fill: #eef2ff;
    stroke: none;
}
.rs-shape-outline {
    fill: none;
    stroke: var(--line);
    stroke-width: 3;
    stroke-linejoin: round;
}

/* ---------- "equal sides" tick marks (textbook-style hatch marks) ----------
   Small perpendicular dashes at each equal side's midpoint. Sides that
   belong to the same equal-length group get the same tick count
   (1 tick, 2 ticks, ...), so the child can visually match which sides
   are "the same" before ever adding a number. */
.rs-tick {
    stroke: #5b7fdb;
    stroke-width: 2.5;
    stroke-linecap: round;
}

/* ---------- side-length labels ----------
   Rendered as plain bold text with a white "halo" stroke (paint-order
   puts the stroke behind the fill) instead of a background bubble —
   keeps every number fully readable directly against the stage
   background with no box edge that could ever get clipped by the
   stage's rounded border. */
.rs-side-label-text {
    font-size: 16px;
    font-weight: 800;
    fill: #233c66;
    text-anchor: middle;
    dominant-baseline: middle;
    paint-order: stroke fill;
    stroke: #ffffff;
    stroke-width: 4px;
    stroke-linejoin: round;
}

/* ---------- equation strip (addition -> multiplication reveal) ----------
   Sits under the stage on C.2, C.3, and C.5. Shows the repeated
   addition, an arrow, and the multiplication it collapses into. The
   multiplication chip starts faded/small and animates in (via the
   .show class, toggled a beat after render) so the "collapsing"
   feels like something that happens, not something that's just
   handed to the child. */
.rs-eq-strip {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: clamp(6px, 2vw, 12px);
    width: 100%;
    max-width: 480px;
    margin: 10px auto 2px;
}
.rs-eq-part {
    font-family: inherit;
    font-weight: 800;
    font-size: clamp(13px, 3.6vw, 18px);
    color: #3a2c1f;
    padding: 6px 10px;
    border-radius: 10px;
    background: #fff;
    border: 2px solid var(--line);
    white-space: nowrap;
}
.rs-eq-arrow {
    font-size: clamp(15px, 4vw, 20px);
    color: #5b7fdb;
    font-weight: 800;
    line-height: 1;
}
.rs-eq-mul {
    opacity: 0;
    transform: scale(0.7);
    transition: opacity 0.4s ease, transform 0.4s ease, background 0.4s ease, border-color 0.4s ease;
}
.rs-eq-mul.show {
    opacity: 1;
    transform: scale(1);
    background: #fff3b0;
    border-color: #e0b400;
}

/* ---------- shared answer-chip row (all five skills' answer chips) ----------
   4-column grid = guaranteed single line at every width; never
   switches to flex-wrap, so the four chips can't stack. Works for
   plain numbers (C.1, C.3, C.5) and short formula/expression text
   (C.2, C.4) alike — text shrinks and may wrap inside its own cell,
   the row itself never does. */
.rs-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: clamp(6px, 2vw, 14px);
    width: 100%;
    max-width: 560px;
    margin: 18px auto 4px;
}
.rs-opt {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 58px;
    padding: 8px 4px;
    border-radius: 14px;
    border: 3px solid var(--line);
    background: #fff;
    font-family: inherit;
    font-weight: 800;
    color: #3a2c1f;
    font-size: clamp(12px, 3.4vw, 17px);
    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;
}
.rs-opt:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 0 rgba(0,0,0,0.08);
}
.rs-opt:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: none;
}
.rs-opt:focus-visible {
    outline: 3px solid #4a90e2;
    outline-offset: 2px;
}
.rs-opt:disabled { cursor: default; }
.rs-opt.is-correct {
    border-color: #22c08d;
    background: #eafff6;
    box-shadow: 0 0 0 4px rgba(34,192,141,0.18);
}
.rs-opt.is-wrong {
    border-color: #f5427d;
    background: #fff0f4;
    box-shadow: 0 0 0 4px rgba(245,66,125,0.15);
}

/* ---------- helper caption under the stage / equation strip ---------- */
.rs-unit-hint {
    text-align: center;
    font-size: clamp(11px, 3vw, 13px);
    font-weight: 700;
    color: #8a7a68;
    margin: 2px auto 0;
}

/* ---------- responsive tuning (mirrors perimeter-measuring.css) ---------- */
@media (max-width: 380px) {
    .rs-stage { width: clamp(180px, 78vw, 260px); margin: 10px auto 4px; }
    .rs-options { gap: 5px; margin: 12px auto 4px; }
    .rs-opt { min-height: 50px; padding: 6px 3px; font-size: clamp(11px, 3.6vw, 14px); border-width: 2px; border-radius: 12px; }
    .rs-side-label-text { font-size: 13px; stroke-width: 3px; }
    .rs-eq-strip { gap: 5px; margin: 8px auto 2px; }
    .rs-eq-part { font-size: clamp(11px, 3.4vw, 15px); padding: 5px 7px; }
}

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

@media (min-width: 700px) {
    .rs-options { gap: 16px; }
    .rs-opt { min-height: 74px; font-size: 18px; }
}

@media (min-width: 900px) {
    .rs-stage { width: clamp(260px, 34vw, 340px); }
    .rs-opt { min-height: 80px; }
}

@media (max-height: 700px) {
    .rs-stage { width: clamp(180px, 46vw, 240px); margin: 8px auto 4px; }
    .rs-options { margin: 10px auto 4px; }
    .rs-opt { min-height: 48px; }
}