/* ================================================================
   percent-compare.css
   ----------------------------------------------------------------
   Styles for the "Comparing & Ordering Percentages" skill group on
   the Class 5 Math page — the direct sibling of Fraction Comparing
   & Ordering's .frac-cmp-* /.frac-bench-* /.frac-order-* classes in
   fraction-compare.css, adapted so every shape is a plain
   percent-fill bar (0-100%) instead of a fraction shape, since a
   percentage never needs a denominator picker — it's always "out of
   100":

     - A.1  Side-by-Side Bars Compare — "Which is more, 30% or 45%?"
            Two vertical percent-fill bars sit side by side with a
            "vs" divider between them, each carrying its own big "X%"
            label underneath and acting as the tappable answer itself
            — same one-shot tap-to-grade pattern as Fraction Comparing
            & Ordering's Same Denominator Compare. (.pct-cmp-*)

     - A.2  Benchmark Percentages (vs 0%, 50%, 100%) — "Is 62% closer
            to half or to full?" A single percent-fill bar with its
            label sits above three plain pill buttons — 0%, 50%,
            100% — reusing the same pill look as the fraction
            benchmark activity. (.pct-bench-*)

     - A.3  Ordering 3-4 Percentages — "Drag these into order,
            smallest to largest." 3 or 4 percent cards (small
            percent-fill bar + big label) sit in a row the child can
            drag to reorder, then tap "Check My Order" to grade the
            whole arrangement at once. (.pct-order-*)

     - A.4  Percent vs Fraction vs Decimal Ordering — the same
            drag-to-order interaction as A.3, but each card shows one
            of three *representations* of a value (a percent, a
            fraction, or a decimal) with a small colored tag naming
            which it is, and no percent-fill bar — the point of this
            skill is converting between forms in your head, not
            reading a bar. (.pct-mix-*)

   Every answer row on this page (2 bars, 3 pills, or up to 4 drag
   cards) is forced to stay on a SINGLE horizontal line at every
   supported width — flex-wrap: nowrap everywhere, with flexible
   min/max widths (not fixed px) so 2-4 items always divide up the
   available row width on common Android phone screens (360px-430px)
   as well as desktop, and an overflow-x:auto safety net only ever
   kicks in on truly tiny/zoomed viewports.

   This file depends on classes already styled elsewhere:
     - .bq-* / .quiz-* / .card classes from quiz-popup-theme.css and
       quiz-modal-responsive.css, for the modal shell, slot tracker,
       progress line, feedback banner, and star-reward summary card

   Load AFTER the shared quiz theme files, e.g.:
     <link rel="stylesheet" th:href="@{/css/quiz-popup-theme.css}" />
     <link rel="stylesheet" th:href="@{/css/quiz-modal-responsive.css}" />
     <link rel="stylesheet" th:href="@{/css/percent-compare.css}" />
   ================================================================ */

/* ================================================================
   Shared percent-fill bar (used by A.1, A.2, A.3)
   ================================================================ */
/* The bar itself is now a self-contained inline SVG (built in
   percent-compare.js) that paints its own track, border, and
   gradient fill directly with literal colors — nothing here depends
   on CSS custom properties resolving correctly. This wrapper is
   responsible for RESPONSIVE SIZING ONLY: it's a plain box whose
   width/height (overridden per-context and per-breakpoint below)
   the SVG fills at width:100%/height:100%. */
.pct-bar-track {
    position: relative;
    width: 56px;
    height: 120px;
    box-sizing: border-box;
    flex: 0 0 auto;
}
.pct-bar-num {
    margin-top: 10px;
    font-weight: 800;
    font-size: 20px;
    color: var(--secondary, #1e3a5f);
    text-align: center;
    white-space: nowrap;
}

/* ---------- Side-by-Side Bars Compare (A.1) ---------- */

.pct-cmp-pair {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 22px;
    margin: 18px auto 6px;
    flex-wrap: nowrap;
}

/* Each side of the comparison is its own plain <button> — the whole
   card (bar + label) is the tappable answer, not just a caption
   underneath it. Same feel as Fraction Comparing & Ordering's
   .frac-cmp-option. */
.pct-cmp-option {
    flex: 1 1 130px;
    min-width: 92px;
    max-width: 170px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 16px 12px 14px;
    border-radius: 18px;
    border: 3px solid var(--line, #cbd5e1);
    background: transparent;
    cursor: pointer;
    font: inherit;
    -webkit-tap-highlight-color: transparent;
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.pct-cmp-option:hover:not(:disabled) {
    transform: translateY(-3px);
    border-color: var(--sky, #2e9bf5);
    box-shadow: 0 10px 20px -12px rgba(30,58,95,0.25);
}
.pct-cmp-option:active:not(:disabled) { transform: translateY(-1px); }
.pct-cmp-option:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(46,155,245,0.35);
}
.pct-cmp-option:disabled { cursor: default; }

.pct-cmp-option .pct-bar-track { width: 100%; max-width: 74px; height: 130px; }

.pct-cmp-option.is-correct {
    border-color: #10b981;
    background: rgba(16,185,129,0.08);
    box-shadow: 0 0 0 3px rgba(16,185,129,0.18);
}
.pct-cmp-option.is-wrong {
    border-color: #ef4444;
    background: rgba(239,68,68,0.08);
    box-shadow: 0 0 0 3px rgba(239,68,68,0.18);
}

.pct-cmp-vs {
    flex: 0 0 auto;
    font-weight: 800;
    font-size: 20px;
    color: var(--secondary, #1e3a5f);
    opacity: 0.55;
    padding-bottom: 46px;
}

/* A quiet callout used once per correct answer to spell out the
   "same denominator — 100 — every time" payoff explicitly. */
.pct-cmp-hundred-note {
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--secondary, #1e3a5f);
    opacity: 0.75;
    margin: 2px auto 0;
    max-width: 320px;
}

@media (max-width: 560px) {
    .pct-cmp-pair { gap: 10px; margin: 14px auto 4px; }
    .pct-cmp-option { padding: 12px 8px 10px; gap: 4px; border-radius: 14px; min-width: 84px; }
    .pct-cmp-option .pct-bar-track { height: 96px; max-width: 56px; }
    .pct-bar-num { font-size: 16px; margin-top: 6px; }
    .pct-cmp-vs { font-size: 15px; padding-bottom: 34px; }
}
@media (max-width: 380px) {
    .pct-cmp-pair { gap: 8px; }
    .pct-cmp-option { min-width: 74px; padding: 10px 6px 8px; }
    .pct-cmp-option .pct-bar-track { height: 82px; max-width: 48px; }
    .pct-bar-num { font-size: 14px; }
}

/* ---------- Benchmark Percentages (A.2) ---------- */

.pct-bench-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin: 16px auto 6px;
}

.pct-bench-stage-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.pct-bench-stage-card .pct-bar-track { height: 130px; }

.pct-bench-options {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 8px;
    flex-wrap: nowrap;
    width: 100%;
}

.pct-bench-option {
    flex: 1 1 90px;
    min-width: 76px;
    max-width: 130px;
    box-sizing: border-box;
    padding: 14px 8px;
    border-radius: 16px;
    border: 3px solid var(--line, #cbd5e1);
    background: transparent;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    font-size: 20px;
    color: var(--secondary, #1e3a5f);
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.pct-bench-option:hover:not(:disabled) {
    transform: translateY(-3px);
    border-color: var(--sky, #2e9bf5);
    box-shadow: 0 10px 20px -12px rgba(30,58,95,0.25);
}
.pct-bench-option:active:not(:disabled) { transform: translateY(-1px); }
.pct-bench-option:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(46,155,245,0.35);
}
.pct-bench-option:disabled { cursor: default; }

.pct-bench-option.is-correct {
    border-color: #10b981;
    background: rgba(16,185,129,0.08);
    box-shadow: 0 0 0 3px rgba(16,185,129,0.18);
}
.pct-bench-option.is-wrong {
    border-color: #ef4444;
    background: rgba(239,68,68,0.08);
    box-shadow: 0 0 0 3px rgba(239,68,68,0.18);
}

@media (max-width: 560px) {
    .pct-bench-wrap { margin: 12px auto 4px; gap: 8px; }
    .pct-bench-stage-card .pct-bar-track { height: 100px; }
    .pct-bench-options { gap: 8px; margin-top: 6px; }
    .pct-bench-option { min-width: 62px; padding: 10px 6px; font-size: 16px; border-radius: 14px; }
}
@media (max-width: 380px) {
    .pct-bench-stage-card .pct-bar-track { height: 86px; }
    .pct-bench-options { gap: 6px; }
    .pct-bench-option { min-width: 54px; padding: 8px 4px; font-size: 14px; }
}

/* ================================================================
   Shared drag-to-order row (A.3 percent cards, A.4 mixed-form cards)
   ================================================================ */

.pct-order-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin: 16px auto 10px;
    width: 100%;
}

.pct-order-legend {
    font-weight: 700;
    font-size: 14px;
    color: var(--secondary, #1e3a5f);
    opacity: 0.7;
    letter-spacing: 0.02em;
    text-align: center;
}

/* nowrap + horizontal auto-scroll safety net keeps every card on
   ONE line at every width — cards themselves flex between a min and
   max so 3-4 of them divide up a 360px-430px Android screen (or a
   wide desktop modal) without ever needing to actually scroll in
   practice. Padding here (not on the card) is what keeps the
   top-left position badge from clipping at the row edge. */
.pct-order-row {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 10px;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    box-sizing: border-box;
    padding: 16px 12px 10px;
}

.pct-order-card {
    position: relative;
    flex: 1 1 110px;
    min-width: 78px;
    max-width: 150px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 8px 12px;
    border-radius: 18px;
    border: 3px solid var(--line, #cbd5e1);
    background: transparent;
    cursor: grab;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    -webkit-user-select: none;
    user-select: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.pct-order-card:active { cursor: grabbing; }
.pct-order-card:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(46,155,245,0.35);
}
.pct-order-card.is-dragging {
    z-index: 10;
    border-color: var(--sky, #2e9bf5);
    box-shadow: 0 14px 24px -12px rgba(30,58,95,0.35);
}

.pct-order-card .pct-bar-track { height: 76px; max-width: 48px; }
.pct-order-card .pct-bar-num { font-size: 17px; margin-top: 6px; }

.pct-order-badge {
    position: absolute;
    top: -10px;
    left: -10px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--sky, #2e9bf5);
    color: #fff;
    font-weight: 800;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.pct-order-card.is-correct {
    border-color: #10b981;
    background: rgba(16,185,129,0.08);
    box-shadow: 0 0 0 3px rgba(16,185,129,0.18);
}
.pct-order-card.is-wrong {
    border-color: #ef4444;
    background: rgba(239,68,68,0.08);
    box-shadow: 0 0 0 3px rgba(239,68,68,0.18);
}

@media (max-width: 560px) {
    .pct-order-wrap { margin: 12px auto 6px; gap: 10px; }
    .pct-order-row { gap: 7px; padding: 14px 8px 8px; }
    .pct-order-card { flex-basis: 84px; min-width: 66px; max-width: 116px; padding: 16px 6px 10px; gap: 6px; border-radius: 14px; }
    .pct-order-card .pct-bar-track { height: 58px; max-width: 38px; }
    .pct-order-card .pct-bar-num { font-size: 14px; }
    .pct-order-badge { width: 20px; height: 20px; font-size: 11px; top: -8px; left: -8px; }
    .pct-order-legend { font-size: 12px; }
}
@media (max-width: 380px) {
    .pct-order-row { gap: 5px; padding: 14px 6px 6px; }
    .pct-order-card { flex-basis: 70px; min-width: 58px; max-width: 96px; padding: 14px 4px 8px; }
    .pct-order-card .pct-bar-track { height: 48px; max-width: 32px; }
    .pct-order-card .pct-bar-num { font-size: 12px; }
}

/* ---------- Percent vs Fraction vs Decimal Ordering (A.4) ---------- */
/* Reuses every .pct-order-* rule above as-is (row layout, badge,
   drag/grading states) for the shared cards, but each card here
   shows a form TAG + a big text value instead of a percent-fill bar
   — the point of this skill is converting between forms mentally,
   not reading a bar. */

.pct-mix-tag {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
    color: #fff;
}
.pct-mix-tag.pct { background: var(--sky, #2e9bf5); }
.pct-mix-tag.frac { background: var(--purple, #8b5cf6); }
.pct-mix-tag.dec { background: var(--sun, #fbbf24); color: var(--secondary, #1e3a5f); }

.pct-mix-value {
    font-weight: 800;
    font-size: 22px;
    color: var(--secondary, #1e3a5f);
    white-space: nowrap;
    line-height: 1.1;
}

/* .frac-friendly-symbol-num/-bar/-den-style stacked fraction look,
   drawn in plain markup here (no shared shape helper needed for
   simple text like "3/5"). */
.pct-mix-frac {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
    font-weight: 800;
    font-size: 20px;
    color: var(--secondary, #1e3a5f);
}
.pct-mix-frac .num { padding-bottom: 3px; border-bottom: 2px solid var(--secondary, #1e3a5f); }
.pct-mix-frac .den { padding-top: 3px; }

.pct-order-card.pct-mix-card { padding-top: 22px; justify-content: center; min-height: 92px; }

@media (max-width: 560px) {
    .pct-mix-tag { font-size: 9px; padding: 2px 7px; }
    .pct-mix-value { font-size: 17px; }
    .pct-mix-frac { font-size: 15px; }
    .pct-order-card.pct-mix-card { min-height: 76px; }
}
@media (max-width: 380px) {
    .pct-mix-value { font-size: 14px; }
    .pct-mix-frac { font-size: 13px; }
}