/* ================================================================
   integers-brahmagupta.css
   ----------------------------------------------------------------
   Styles for "Brahmagupta's Rules, History & the Game" (Tier 12) in
   Topic 8, "The Other Side of Zero (Integers)", on the Class 6 Math
   page:

     - A.1  Brahmagupta's Rules for Addition   (five bins, coins)
     - A.2  Brahmagupta's Rules for Subtraction
     - A.3  Explain the Rule with the Lift     (lift strip, number line)
     - A.4  Name the Rule (mixed practice)     (answer + rule chips)
     - A.5  Integer Snakes and Ladders         (board strip, dice)
     - A.6  A Pinch of History                 (parchment timeline)
     - A.7  Sign Estimation Warm-Up
     - A.8  Spot the Mistake                   (note cards)
     - A.9  Story Maker                        (lettered stories)

   Same shared popup shell as the other integer tiers (quiz-overlay /
   quiz-modal), so this file only styles the pictures and the answer
   chips. Fully self-contained: every class starts with "ibg-" and
   every popup id starts with "ibg". Site colour variables (--primary,
   --secondary, --line, --sun) are read with fallbacks.

   Finish (kid-friendly, matt + shine): glossy sunny-gold / orange /
   pink for fortunes (positives), fresh mint for zero, cool sky /
   violet / purple for debts (negatives), on a matt pastel lavender
   "paper" stage. History pictures sit on a warm parchment stage.
   Warm = up, cool = down, so the colours quietly teach the idea
   without giving an answer away.

   Layout notes
   - Answer chips ALWAYS stay on ONE row (flex-wrap: nowrap), 4 chips.
   - Android-native feel: >=52px touch targets, instant :active press,
     no 300ms delay, no grey tap flash, safe-area padding.

     <link rel="stylesheet" th:href="@{/css/integers-brahmagupta.css}" />
   ================================================================ */

/* ---------- SVG paint ---------- */
.ibg-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.ibg-o { stroke: rgba(60, 38, 120, 0.60); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.ibg-sh { filter: drop-shadow(0 4px 3px rgba(60, 38, 120, 0.25)); }
.ibg-gloss { fill: #fff; opacity: 0.38; pointer-events: none; }
.ibg-spark { fill: #fff; opacity: 0.9; pointer-events: none; }
.ibg-nopt { pointer-events: none; stroke: none; }

.ibg-t {
    font: 800 22px/1 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    fill: #34205f; text-anchor: middle; dominant-baseline: central;
    stroke: #fff; stroke-width: 5; paint-order: stroke; stroke-linejoin: round;
    pointer-events: none; user-select: none; -webkit-user-select: none;
}
.ibg-t-small { font-size: 19px; }
.ibg-t-lbl { font-size: 24px; }
.ibg-t-cell { font-size: 14px; stroke-width: 4; }
.ibg-t-lvl { font-size: 13px; stroke-width: 4; }
.ibg-t-tick { font-size: 14px; stroke-width: 4; }
.ibg-t-tl { font-size: 15px; stroke-width: 4.5; }
.ibg-t-date { font-size: 13px; stroke-width: 4; fill: #7a4a00; }
.ibg-t-bin { stroke-width: 4.5; }
.ibg-t-dark { fill: #34205f; stroke: #fff; }
.ibg-t-white { fill: #fff; stroke: rgba(60, 38, 120, .60); stroke-width: 5; }

/* lines and arrows: white underlay + coloured core */
.ibg-under { stroke: #fff; stroke-width: 11; stroke-linecap: round; opacity: .9; }
.ibg-seg { fill: none; stroke-width: 6; stroke-linecap: round; }
.ibg-tick { stroke: #34205f; stroke-width: 3; stroke-linecap: round; }
.ibg-arrowline { stroke: #7c4dff; stroke-width: 6; stroke-linecap: round; }
.ibg-arc { fill: none; stroke: #7c4dff; stroke-width: 6; stroke-linecap: round; }
.ibg-divider { stroke: rgba(60, 38, 120, .55); stroke-width: 3; stroke-dasharray: 6 6; stroke-linecap: round; }

/* lift */
.ibg-shaft { fill: #efe6ff; stroke: rgba(60, 38, 120, .55); stroke-width: 2.5; }
.ibg-level { stroke: #b69cff; stroke-width: 2; }
.ibg-ghostbox { fill: none; stroke: #7c4dff; stroke-width: 3; stroke-dasharray: 5 5; opacity: .8; }
.ibg-ground { fill: #35c27a; stroke: rgba(30, 90, 60, .6); stroke-width: 2.5; }
.ibg-door { stroke: rgba(255, 255, 255, .85); stroke-width: 3; stroke-linecap: round; }

/* labels, highlights */
.ibg-pill { fill: rgba(255, 255, 255, .94); stroke: rgba(60, 38, 120, .45); stroke-width: 2; }
.ibg-hilite { fill: none; stroke: #ffb300; stroke-width: 5; }
.ibg-glow { fill: none; stroke: #ffd54a; stroke-width: 6; opacity: .95; }

/* board: ladders have white rungs, snakes have light scales */
.ibg-ladder { fill: none; stroke: #20b46b; stroke-width: 13; stroke-linecap: round; }
.ibg-rungs { fill: none; stroke: #fff; stroke-width: 12; stroke-dasharray: 3 11; }
.ibg-snake { fill: none; stroke: #d6339a; stroke-width: 11; stroke-linecap: round; }
.ibg-scales { fill: none; stroke: rgba(255, 255, 255, .75); stroke-width: 4; stroke-dasharray: 2 9; stroke-linecap: round; }

/* ---------- picture card ---------- */
.quiz-overlay[id^="ibg"] .quiz-modal { --ibg-fig: 250px; }
.quiz-overlay[id^="ibg"] .quiz-question b { color: var(--secondary, #4b3f8f); }
.quiz-overlay[id^="ibg"] .bq-btn,
.quiz-overlay[id^="ibg"] .bq-next-btn { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.quiz-overlay[id^="ibg"] .bq-next-btn { margin-bottom: env(safe-area-inset-bottom, 0px); }
.quiz-overlay[id^="ibg"] .bq-summary-buttons { margin-bottom: env(safe-area-inset-bottom, 0px); }
.quiz-overlay[id^="ibg"] .quiz-modal { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }

.ibg-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 8px auto 0; }
.ibg-stage {
    position: relative;
    width: var(--ibg-fig);
    aspect-ratio: 1 / 1;
    box-sizing: border-box;
    padding: 6px;
    border-radius: 20px;
    background:
        radial-gradient(120% 90% at 25% 10%, rgba(255, 255, 255, .92), rgba(255, 255, 255, 0) 60%),
        linear-gradient(180deg, #f7f2ff 0%, #ece3ff 100%);
    border: 2px solid var(--line, #ddd2fb);
    box-shadow: 0 3px 0 rgba(75, 63, 143, 0.08), inset 0 0 22px rgba(167, 139, 250, .16);
}
.ibg-stage > svg { width: 100%; height: 100%; }
.ibg-stage.ibg-wide { width: min(100%, calc(var(--ibg-fig) * 1.7)); aspect-ratio: 2 / 1; }
/* parchment stage for the history pictures */
.ibg-stage.ibg-paper {
    background:
        radial-gradient(120% 90% at 25% 10%, rgba(255, 255, 255, .85), rgba(255, 255, 255, 0) 60%),
        linear-gradient(180deg, #fff8e4 0%, #ffecc2 100%);
    border-color: #f2d9a0;
    box-shadow: 0 3px 0 rgba(150, 100, 20, 0.10), inset 0 0 22px rgba(255, 190, 80, .20);
}
.ibg-hint { margin: 0; text-align: center; font-size: 13px; font-weight: 700; color: #7a71a8; line-height: 1.35; max-width: 360px; }
.ibg-hint b { color: var(--secondary, #4b3f8f); }
.ibg-replay {
    min-height: 44px; padding: 8px 20px; border: 2px solid var(--primary, #6c5ce7); border-radius: 999px;
    background: #fff; color: var(--primary, #6c5ce7); font: inherit; font-weight: 800; font-size: 15px;
    box-shadow: 0 3px 0 rgba(108, 92, 231, 0.20); cursor: pointer;
    touch-action: manipulation; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
    transition: transform .08s ease, box-shadow .15s;
}
.ibg-replay:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(108, 92, 231, 0.20); }

/* ---------- lettered stories / statements (in the question) ---------- */
.ibg-stories {
    display: flex; flex-direction: column; gap: 8px;
    width: 100%; max-width: 480px;      /* same width as the answer chips row */
    margin: 12px auto 0; text-align: left;
}
.ibg-story {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 14px 8px 8px;
    background: #fff;
    border: 2px solid var(--line, #ddd2fb);
    border-radius: 14px;
    box-shadow: 0 2px 0 rgba(75, 63, 143, 0.07);
    font-size: 14.5px; font-weight: 700; line-height: 1.35; color: #34205f;
}
.ibg-let {
    flex: none; display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 50%;
    background: radial-gradient(circle at 34% 28%, #ffd0ec, #e0368a 72%);
    color: #fff; font-size: 14px; font-weight: 800;
    box-shadow: 0 2px 0 rgba(150, 20, 100, .25);
}

/* ================================================================
   Answer chips: ALWAYS a single line (4 chips)
   ================================================================ */
.quiz-number-options.ibg-picker {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 480px;
    margin: 16px auto 4px;
}
.quiz-number-options.ibg-picker:empty { display: none; }
.quiz-number-opt.ibg-opt {
    display: inline-flex;
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: auto !important;
    min-height: 54px !important;
    max-height: none !important;
    box-sizing: border-box !important;
    padding: 10px 5px;
    white-space: normal !important;
    overflow: hidden;
    overflow-wrap: break-word;
    font-weight: 800;
    font-size: 15.5px;
    line-height: 1.2;
    text-align: center;
    color: var(--secondary, #4b3f8f);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    transition: transform .08s ease, box-shadow .15s, border-color .15s, background .15s;
}
.quiz-number-opt.ibg-opt.ibg-sym { font-size: 30px; line-height: 1; }
.quiz-number-opt.ibg-opt.ibg-ex { font-size: 14px; }
/* answer + rule chip (A.4): big value over a small rule name */
.quiz-number-opt.ibg-opt.ibg-two { padding: 8px 4px; gap: 4px; }
.ibg-ov { font-size: 21px; font-weight: 800; line-height: 1; }
.ibg-os { font-size: 11.5px; font-weight: 800; line-height: 1.15; opacity: .85; }
.quiz-number-opt.ibg-opt:active:not(:disabled) { transform: scale(.96); background: rgba(124, 77, 255, 0.10); }
@media (hover: hover) {
    .quiz-number-opt.ibg-opt:hover:not(:disabled) { border-color: var(--primary, #6c5ce7); }
}
.quiz-number-opt.ibg-opt.is-correct { border-color: #10b981; background: rgba(16, 185, 129, 0.08); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18); }
.quiz-number-opt.ibg-opt.is-wrong { border-color: #ef4444; background: rgba(239, 68, 68, 0.08); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18); }

/* ================================================================
   Responsive (phones): shrink the drawings and chips only
   ================================================================ */
@media (max-width: 560px) {
    .quiz-overlay[id^="ibg"] .quiz-modal { --ibg-fig: 232px; }
    .quiz-number-options.ibg-picker { gap: 8px; margin-top: 14px; }
    .quiz-number-opt.ibg-opt { font-size: 12.5px; padding: 8px 3px; min-height: 52px !important; letter-spacing: -0.1px; }
    .quiz-number-opt.ibg-opt.ibg-ex { font-size: 11.5px; }
    .quiz-number-opt.ibg-opt.ibg-sym { font-size: 26px; }
    .ibg-ov { font-size: 18px; }
    .ibg-os { font-size: 10px; }
    .ibg-story { font-size: 13.5px; padding: 7px 10px 7px 7px; }
}
@media (max-width: 380px) {
    .quiz-overlay[id^="ibg"] .quiz-modal { --ibg-fig: 204px; }
    .quiz-number-opt.ibg-opt { font-size: 11.5px; padding: 7px 2px; }
    .quiz-number-opt.ibg-opt.ibg-ex { font-size: 10.5px; }
    .quiz-number-opt.ibg-opt.ibg-sym { font-size: 24px; }
    .ibg-ov { font-size: 16px; }
    .ibg-os { font-size: 9.5px; }
    .quiz-number-options.ibg-picker { gap: 6px; }
    .ibg-hint { font-size: 12.5px; }
    .ibg-story { font-size: 13px; }
    .quiz-overlay[id^="ibg"] .quiz-question { font-size: 15.5px; }
}
@media (pointer: coarse) {
    .quiz-number-opt.ibg-opt { min-height: 56px !important; }
}
@media (max-height: 560px) and (orientation: landscape) {
    .quiz-overlay[id^="ibg"] .quiz-modal { --ibg-fig: 176px; }
}
@media (prefers-reduced-motion: reduce) {
    .quiz-number-opt.ibg-opt, .ibg-replay { transition: none; }
}