/* ================================================================
   area-vs-perimeter.css
   ----------------------------------------------------------------
   Styling for the "Area vs Perimeter (Untangling the Two)" skill
   quizzes on the Class 5 Math page:

     - A.1 Fence vs Floor              (.avp-stage, garden with fence
                                         outline + grass fill, one of
                                         the two highlighted per Q)
     - A.2 Same Area, Different        (.avp-stage-compare, two grid
           Perimeter                    shapes built from the same
                                         number of squares)
     - A.3 Same Perimeter, Different   (.avp-stage-compare, two ruler-
           Area                         style rectangles sharing a
                                         perimeter)
     - A.4 Sort the Question           (.avp-stage-word, a word-problem
                                         snippet card, no diagram)

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

/* Two-shapes-side-by-side skills (A.2, A.3) read better wider/shorter
   than a perfect square, so they get their own aspect ratio while
   keeping the same border/ring language. */
.avp-stage.avp-stage-compare {
    aspect-ratio: 17 / 10;
    width: clamp(260px, 90vw, 460px);
}

/* Word-problem card skill (A.4) also benefits from extra width so the
   sentence doesn't get cramped. */
.avp-stage.avp-stage-word {
    aspect-ratio: 3 / 2;
    width: clamp(240px, 88vw, 420px);
}
.avp-stage.avp-stage-word svg {
    width: 100%;
    height: 100%;
}

/* ---------- A.1 Fence vs Floor ---------- */
.avp-garden-tag-bg {
    fill: #eef6ff;
    stroke: #a9c4dd;
    stroke-width: 1.5;
}
.avp-garden-tag-text {
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    fill: #3a5a78;
    text-anchor: middle;
}
/* Floor fill = the grass covering the inside of the garden (area). */
.avp-floor-fill {
    fill: #dff2cf;
    stroke: none;
}
.avp-floor-fill.avp-target {
    fill: #93d977;
    filter: drop-shadow(0 0 6px rgba(70,170,60,0.55));
}
/* Fence line = the dashed boundary running around the outside
   (perimeter). Drawn on top of the fill at the same rectangle. */
.avp-fence-line {
    fill: none;
    stroke: #a97c46;
    stroke-width: 2.6;
    stroke-dasharray: 7,5;
}
.avp-fence-line.avp-target {
    stroke: #f5427d;
    stroke-width: 4;
    stroke-dasharray: 8,4;
    filter: drop-shadow(0 0 4px rgba(245,66,125,0.5));
}
.avp-dim-arrow {
    stroke: #5b4636;
    stroke-width: 1.6;
    fill: none;
}
.avp-tick-mark {
    stroke: #5b4636;
    stroke-width: 1.4;
}
.avp-dim-label {
    font-family: inherit;
    font-size: 14px;
    font-weight: 800;
    fill: #3a2c1f;
    text-anchor: middle;
}
.avp-mode-caption-bg {
    fill: #fff8e8;
    stroke: #f0c96e;
    stroke-width: 1.5;
}
.avp-mode-caption-text {
    font-family: inherit;
    font-size: 12px;
    font-weight: 800;
    fill: #8a5a2e;
    text-anchor: middle;
}

/* ---------- A.2 / A.3 shared comparison layout ---------- */
.avp-compare-title {
    font-family: inherit;
    font-size: 13px;
    font-weight: 900;
    fill: #3a2c1f;
    text-anchor: middle;
}
.avp-compare-caption {
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 700;
    fill: #6a5a48;
    text-anchor: middle;
}
.avp-shape-label-bg {
    fill: #fff0f4;
    stroke: #f5b0c4;
    stroke-width: 1.4;
}
.avp-shape-label-text {
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 900;
    fill: #a3335c;
    text-anchor: middle;
}
.avp-divider {
    stroke: #d9c9b8;
    stroke-width: 1.5;
    stroke-dasharray: 3,4;
}

/* A.2 grid-square shapes (same area, different perimeter) */
.avp-grid-cell {
    fill: #7ecbff;
    stroke: #4a90c9;
    stroke-width: 1.1;
}
.avp-grid-cell.avp-cell-b {
    fill: #ffd166;
    stroke: #e0a72e;
}

/* A.3 ruler-style rectangles (same perimeter, different area) */
.avp-rect-fill-a {
    fill: #c8e9ff;
    stroke: #4a90c9;
    stroke-width: 2.2;
}
.avp-rect-fill-b {
    fill: #ffe9c2;
    stroke: #e0a72e;
    stroke-width: 2.2;
}

/* ---------- A.4 Sort the Question (word-problem card) ---------- */
.avp-wordcard {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 18px 16px;
    box-sizing: border-box;
    text-align: center;
}
.avp-wordcard-icon {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #fff8e8;
    border: 2.5px solid #f0c96e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #a97c30;
    flex: 0 0 auto;
}
.avp-wordcard-quote {
    font-family: inherit;
    font-weight: 700;
    font-size: clamp(14px, 4vw, 18px);
    line-height: 1.35;
    color: #3a2c1f;
    max-width: 34ch;
}
.avp-wordcard-quote::before { content: "\201C"; }
.avp-wordcard-quote::after { content: "\201D"; }

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

/* Number chips (A.1) can afford slightly larger digits when the
   label is short (no unit suffix). */
.avp-opt.avp-opt-number {
    font-size: clamp(14px, 4.2vw, 20px);
    font-weight: 800;
}
/* Chips that carry a unit suffix ("18 m" / "24 sq m") need a touch
   more headroom so they still fit one line inside their own cell. */
.avp-opt.avp-opt-unit {
    font-size: clamp(10px, 2.9vw, 15px);
    font-weight: 800;
}
/* Text chips (A.2 / A.3 / A.4 \u2014 "Shape A", "Both the same",
   "Area", "Neither"...) get a slightly smaller baseline since some
   labels run longer than a plain number. */
.avp-opt.avp-opt-text {
    font-size: clamp(10px, 2.9vw, 14.5px);
    font-weight: 800;
}

/* ---------- responsive tuning ---------- */
@media (max-width: 380px) {
    .avp-stage { width: clamp(180px, 80vw, 270px); margin: 10px auto 4px; }
    .avp-stage.avp-stage-compare { width: clamp(240px, 92vw, 340px); }
    .avp-stage.avp-stage-word { width: clamp(220px, 90vw, 300px); }
    .avp-options { gap: 5px; margin: 12px auto 4px; }
    .avp-opt { min-height: 50px; padding: 6px 3px; font-size: clamp(9.5px, 3vw, 12.5px); border-width: 2px; border-radius: 12px; }
    .avp-opt.avp-opt-number { font-size: clamp(13px, 4vw, 18px); }
    .avp-opt.avp-opt-unit { font-size: clamp(9px, 2.7vw, 12px); }
    .avp-opt.avp-opt-text { font-size: clamp(9px, 2.7vw, 12px); }
    .avp-wordcard { gap: 8px; padding: 12px 10px; }
    .avp-wordcard-icon { width: 36px; height: 36px; font-size: 16px; }
}

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

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

@media (min-width: 900px) {
    .avp-stage { width: clamp(270px, 36vw, 360px); }
    .avp-stage.avp-stage-compare { width: clamp(360px, 46vw, 480px); }
    .avp-stage.avp-stage-word { width: clamp(320px, 42vw, 440px); }
    .avp-opt { min-height: 80px; }
}

@media (max-height: 700px) {
    .avp-stage { width: clamp(180px, 48vw, 250px); margin: 8px auto 4px; }
    .avp-stage.avp-stage-compare { width: clamp(240px, 58vw, 340px); }
    .avp-stage.avp-stage-word { width: clamp(220px, 54vw, 320px); }
    .avp-options { margin: 10px auto 4px; }
    .avp-opt { min-height: 48px; }
}