/* ================================================================
   area-foundations.css
   ----------------------------------------------------------------
   Styling for the "What is Area? (Foundations \u2014 no numbers yet)"
   skill quizzes on the Class 5 Math page:

     - A.1 Cover the Shape           (.area-stage / .area-tile)
     - A.2 More Space or Less Space? (.area-compare-stage / .area-compare-pane)
     - A.3 Same Shape, Different Size(.area-compare-stage / .area-compare-pane)
     - A.4 Squishy Shapes Trap       (.area-compare-stage / .area-tile-grid)
     - A.5 Area Is Not the Outline   (.area-stage / .area-fill-inside / .area-stroke-boundary)

   Mirrors perimeter-foundations.css's shared "stage" card (a bordered
   box that rings green/red via .is-correct/.is-wrong once a question
   is graded) and shared answer-chip row (.area-options / .area-opt),
   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. A.2/A.3/A.4 additionally need a
   two-shape side-by-side comparison, so this file adds
   .area-compare-stage/.area-compare-pane as a second stage variant
   that keeps the same border/ring language as .area-stage. Loaded as
   a plain stylesheet link, independent of every other skill's CSS.
   ================================================================ */

/* ---------- shared visual "stage" (single-shape skills: A.1, A.5) ---------- */
.area-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;
}
.area-stage.is-correct {
    border-color: #22c08d;
    box-shadow: 0 0 0 4px rgba(34,192,141,0.18);
}
.area-stage.is-wrong {
    border-color: #f5427d;
    box-shadow: 0 0 0 4px rgba(245,66,125,0.15);
}
.area-stage svg {
    width: 92%;
    height: 92%;
    display: block;
}

/* ---------- two-shape comparison "stage" (A.2, A.3, A.4) ----------
   Same border/ring/shadow language as .area-stage so it reads as the
   same family of card, but wider and split into two side-by-side
   panes instead of one square. */
.area-compare-stage {
    width: clamp(240px, 84vw, 460px);
    min-height: clamp(160px, 50vw, 240px);
    margin: 14px auto 6px;
    border: 3px solid var(--line);
    border-radius: 20px;
    background: var(--bg-light);
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: clamp(6px, 2vw, 16px);
    padding: clamp(8px, 2.5vw, 16px);
    box-shadow: 0 4px 0 rgba(0,0,0,0.06);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
    overflow: hidden;
}
.area-compare-stage.is-correct {
    border-color: #22c08d;
    box-shadow: 0 0 0 4px rgba(34,192,141,0.18);
}
.area-compare-stage.is-wrong {
    border-color: #f5427d;
    box-shadow: 0 0 0 4px rgba(245,66,125,0.15);
}
.area-compare-pane {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
}
.area-compare-pane svg {
    width: 100%;
    height: auto;
    max-height: clamp(140px, 42vw, 210px);
    display: block;
}
.area-compare-divider {
    width: 2px;
    align-self: stretch;
    background: repeating-linear-gradient(to bottom, #d7dee6 0, #d7dee6 6px, transparent 6px, transparent 12px);
    flex: 0 0 2px;
}
.area-compare-label {
    margin-top: 6px;
    font-size: clamp(11px, 3vw, 14px);
    font-weight: 800;
    color: #8a7a68;
    letter-spacing: 0.03em;
}

/* ---------- A.1 Cover the Shape: outline + staggered tile fill-in ---------- */
.area-field-shape {
    fill: #fff8ec;
    stroke: var(--line);
    stroke-width: 3;
    stroke-linejoin: round;
}
.area-tile {
    fill: #7ecbff;
    stroke: #4a90c9;
    stroke-width: 1.5;
    opacity: 0;
    transform-box: fill-box;
    transform-origin: center;
    animation: areaTilePop 0.35s ease forwards;
}
@keyframes areaTilePop {
    from { opacity: 0; transform: scale(0.4); }
    to { opacity: 0.92; transform: scale(1); }
}

/* ---------- A.2 / A.3: plain comparison rectangles ---------- */
.area-compare-shape {
    fill: #fff8ec;
    stroke: var(--line);
    stroke-width: 3;
    stroke-linejoin: round;
}

/* ---------- A.4 Squishy Shapes Trap: tiled unit grids for a fair, countable comparison ---------- */
.area-compare-outline {
    fill: none;
    stroke: var(--line);
    stroke-width: 3;
    stroke-linejoin: round;
}
.area-tile-grid {
    fill: #ffd27a;
    stroke: #d9a441;
    stroke-width: 1.2;
}

/* ---------- A.5 Area Is Not the Outline (trap questions) ---------- */
.area-stroke-boundary {
    fill: none;
    stroke: #ff8a3d;
    stroke-width: 8;
    stroke-linejoin: round;
}
.area-fill-inside {
    fill: #7ecbff;
    stroke: var(--line);
    stroke-width: 2;
}

/* ---------- shared answer-chip row (all five skills' text chips) ----------
   4-column grid = guaranteed single line at every width; never
   switches to flex-wrap, so the four chips can't stack. */
.area-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: clamp(6px, 2vw, 14px);
    width: 100%;
    max-width: 560px;
    margin: 18px auto 4px;
}
.area-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;
}
.area-opt:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 0 rgba(0,0,0,0.08);
}
.area-opt:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: none;
}
.area-opt:focus-visible {
    outline: 3px solid #4a90e2;
    outline-offset: 2px;
}
.area-opt:disabled { cursor: default; }
.area-opt.is-correct {
    border-color: #22c08d;
    background: #eafff6;
    box-shadow: 0 0 0 4px rgba(34,192,141,0.18);
}
.area-opt.is-wrong {
    border-color: #f5427d;
    background: #fff0f4;
    box-shadow: 0 0 0 4px rgba(245,66,125,0.15);
}

/* ---------- responsive tuning ---------- */
@media (max-width: 380px) {
    .area-stage { width: clamp(180px, 78vw, 260px); margin: 10px auto 4px; }
    .area-compare-stage { min-height: clamp(130px, 46vw, 190px); padding: 6px; gap: 4px; margin: 10px auto 4px; }
    .area-compare-pane svg { max-height: clamp(110px, 38vw, 170px); }
    .area-options { gap: 5px; margin: 12px auto 4px; }
    .area-opt { min-height: 50px; padding: 6px 3px; font-size: clamp(10px, 3.2vw, 13px); border-width: 2px; border-radius: 12px; }
}

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

@media (min-width: 700px) {
    .area-options { gap: 16px; }
    .area-opt { min-height: 74px; font-size: 17px; }
    .area-compare-pane svg { max-height: clamp(180px, 26vw, 240px); }
}

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

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