/* ================================================================
   perp-bisect.css
   ----------------------------------------------------------------
   Styles for "Perpendiculars and Bisectors" (Tier 4) on the Class 6
   Math page (Geometry tools & constructions):

     - A.1  What is Perpendicular?                 (corner / cross figures)
     - A.2  Drawing a Perpendicular, Set Square    (ruler + set square)
     - A.3  Perpendicular Bisector (Compass)       (.pp-arc, .pp-draw)
     - A.4  Find the Midpoint                      (ruler, dots, lines)
     - A.5  Paper Folding Check                    (paper, crease)
     - A.6  Construction Step Sorting              (.pp-list step cards)

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

   Finish (kid-friendly, matt + shine): glossy violet / purple /
   magenta / teal / gold / sky shapes with a soft shine and a sparkle on
   a matt pastel lavender "paper" stage. Warm gold rulers, cool teal set
   squares, bold magenta pencil lines: high contrast but never harsh.

   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/perp-bisect.css}" />
   ================================================================ */

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

.pp-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;
}
.pp-t-lbl { font-size: 24px; }
.pp-t-small { font-size: 19px; }
.pp-t-tick { font-size: 15px; stroke: none; fill: #5a3d00; }
.pp-t-white { fill: #fff; stroke: rgba(60, 38, 120, .55); stroke-width: 5; }
.pp-t-letter { font-size: 170px; stroke-width: 9; }

/* lines: white underlay + coloured core */
.pp-fu { fill: none; stroke: #fff; stroke-width: 15; stroke-linecap: round; stroke-linejoin: round; opacity: .9; }
.pp-fs { stroke-width: 8; stroke-linecap: round; stroke-linejoin: round; }
.pp-dash { stroke-dasharray: 2 14; }
.pp-guide { stroke: #7c4dff; stroke-width: 2; stroke-dasharray: 4 5; opacity: .35; }
.pp-cdot { fill: #34205f; stroke: #fff; stroke-width: 3; }
.pp-pt-red { fill: #ef3b3b; stroke: #fff; stroke-width: 3; }
.pp-pt-gold { fill: #ffd54a; stroke: #34205f; stroke-width: 3; }
.pp-rm { fill: rgba(224, 54, 138, .22); stroke: #e0368a; stroke-width: 3.5; stroke-linejoin: round; }
.pp-brace { fill: none; stroke: #34205f; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.pp-arrow { fill: none; stroke: #7c4dff; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.pp-pane { fill: #e6f6ff; stroke: rgba(60, 38, 120, .45); stroke-width: 2.5; }

/* compass arcs and the perpendicular bisector (animated draw-in) */
.pp-arc { fill: none; stroke: #e0368a; stroke-width: 7; stroke-linecap: round; }
.pp-arc2 { fill: none; stroke: #2a86d8; stroke-width: 7; stroke-linecap: round; }
.pp-bis { fill: none; stroke: #7c4dff; stroke-width: 7; stroke-linecap: round; }
.pp-draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: ppDraw .9s ease forwards; }
@keyframes ppDraw { to { stroke-dashoffset: 0; } }
.pp-pop { opacity: 0; animation: ppPop .4s ease forwards; }
@keyframes ppPop { to { opacity: 1; } }

/* rulers, paper, ground */
.pp-ruler { fill: #ffe9a8; stroke: rgba(90, 61, 0, .55); stroke-width: 2.5; }
.pp-rtick { stroke: #5a3d00; stroke-width: 2.5; stroke-linecap: round; }
.pp-paper { fill: #fff7cf; stroke: rgba(150, 110, 0, .45); stroke-width: 3; }
.pp-crease { stroke: #e0368a; stroke-width: 4; stroke-dasharray: 10 8; stroke-linecap: round; fill: none; }
.pp-ghost { opacity: .45; }

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

.pp-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 8px auto 0; width: 100%; }
.pp-stage {
    position: relative;
    width: var(--pp-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);
}
.pp-stage > svg { width: 100%; height: 100%; }
.pp-stage.pp-wide { width: min(100%, calc(var(--pp-fig) * 1.7)); aspect-ratio: 2 / 1; }
.pp-hint { margin: 0; text-align: center; font-size: 13px; font-weight: 700; color: #7a71a8; line-height: 1.35; max-width: 380px; }
.pp-hint b { color: var(--secondary, #4b3f8f); }
.pp-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;
}
.pp-replay:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(108, 92, 231, 0.20); }

/* ---------- jumbled step cards (A.6) ---------- */
.pp-list { list-style: none; margin: 0; padding: 0; width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: 8px; }
.pp-list li {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; box-sizing: border-box;
    border: 2px solid var(--line, #ddd2fb); border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f4eeff 100%);
    box-shadow: 0 3px 0 rgba(75, 63, 143, 0.08);
    font-weight: 700; font-size: 14.5px; line-height: 1.3; color: #34205f; text-align: left;
}
.pp-k {
    flex: 0 0 32px; height: 32px; border-radius: 50%;
    display: inline-grid; place-items: center;
    font-weight: 800; font-size: 15px; color: #fff;
    background: radial-gradient(circle at 32% 28%, #ffe3f5 0%, #ff7ac8 45%, #c4208a 100%);
    box-shadow: 0 2px 0 rgba(60, 38, 120, .25), inset 0 -2px 3px rgba(60, 38, 120, .18);
    text-shadow: 0 1px 1px rgba(60, 38, 120, .45);
}
.pp-list li:nth-child(4n+2) .pp-k { background: radial-gradient(circle at 32% 28%, #dcfff5 0%, #4fe0c0 45%, #12a08a 100%); }
.pp-list li:nth-child(4n+3) .pp-k { background: radial-gradient(circle at 32% 28%, #f1e9ff 0%, #b69cff 45%, #6b3fd4 100%); }
.pp-list li:nth-child(4n+4) .pp-k { background: radial-gradient(circle at 32% 28%, #fff8d6 0%, #ffd54a 45%, #e09b00 100%); }
.pp-list li.pp-gapcard { border-style: dashed; border-color: #e0368a; background: rgba(255, 227, 245, .55); color: #c4208a; justify-content: center; }

/* ================================================================
   Answer chips: ALWAYS a single line (4 chips)
   ================================================================ */
.quiz-number-options.pp-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.pp-picker:empty { display: none; }
.quiz-number-opt.pp-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.pp-opt.pp-long { font-size: 12.5px; padding: 8px 4px; font-weight: 700; }
.quiz-number-opt.pp-opt:active:not(:disabled) { transform: scale(.96); background: rgba(124, 77, 255, 0.10); }
@media (hover: hover) {
    .quiz-number-opt.pp-opt:hover:not(:disabled) { border-color: var(--primary, #6c5ce7); }
}
.quiz-number-opt.pp-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.pp-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); }
.quiz-number-opt.pp-opt.has-thumb { padding: 6px 4px 8px; }
.pp-opt-thumb { display: block; width: 100%; max-width: 92px; aspect-ratio: 1 / 1; }
.pp-opt-letter { font-size: 13px; font-weight: 800; opacity: .85; }

/* ================================================================
   Responsive (phones): shrink the drawings and chips only
   ================================================================ */
@media (max-width: 560px) {
    .quiz-overlay[id^="perp"] .quiz-modal { --pp-fig: 232px; }
    .quiz-number-options.pp-picker { gap: 8px; margin-top: 14px; }
    .quiz-number-opt.pp-opt { font-size: 12.5px; padding: 8px 3px; min-height: 52px !important; letter-spacing: -0.1px; }
    .quiz-number-opt.pp-opt.pp-long { font-size: 11px; padding: 7px 3px; }
    .pp-opt-thumb { max-width: 68px; }
    .pp-list li { font-size: 13.5px; padding: 8px 10px; }
}
@media (max-width: 380px) {
    .quiz-overlay[id^="perp"] .quiz-modal { --pp-fig: 204px; }
    .quiz-number-opt.pp-opt { font-size: 11.5px; padding: 7px 2px; }
    .quiz-number-opt.pp-opt.pp-long { font-size: 10px; padding: 6px 2px; }
    .quiz-number-opt.pp-opt.has-thumb { padding: 5px 2px 6px; }
    .quiz-number-options.pp-picker { gap: 6px; }
    .pp-opt-thumb { max-width: 58px; }
    .pp-hint { font-size: 12.5px; }
    .pp-list li { font-size: 12.5px; }
}
@media (pointer: coarse) {
    .quiz-number-opt.pp-opt { min-height: 56px !important; }
}
@media (max-height: 560px) and (orientation: landscape) {
    .quiz-overlay[id^="perp"] .quiz-modal { --pp-fig: 176px; }
}
@media (prefers-reduced-motion: reduce) {
    .quiz-number-opt.pp-opt, .pp-replay { transition: none; }
    .pp-draw { animation: none; stroke-dashoffset: 0; }
    .pp-pop { animation: none; opacity: 1; }
}