/* ================================================================
   integers-tokens.css
   ----------------------------------------------------------------
   Styles for "The Token Model" (Tier 9) in Topic 8, "The Other Side
   of Zero (Integers)", on the Class 6 Math page:

     - A.1  The Lift Attendant's Pocket       (pocket of tokens)
     - A.2  Zero Pairs                        (green + red cancel)
     - A.3  Add with Tokens
     - A.4  Read the Pile
     - A.5  Subtract by Take-Away
     - A.6  Not Enough Tokens? Add a Zero Pair
     - A.7  How Many Zero Pairs?
     - A.8  Token Subtraction Practice
     - A.9  Check with Another Method

   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 "tk-" and every
   popup id starts with "tk". Site colour variables (--primary,
   --secondary, --line, --sun) are read with fallbacks.

   Finish (kid-friendly, matt + shine): glossy LIME-GREEN tokens (+1)
   and CORAL-RED tokens (-1) lying on a matt cream "pocket", on a
   pastel lavender stage. The sign is printed on every token so colour
   is never the only clue. Gold = zero, violet / sky / magenta for the
   buttons and lift.

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

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

.tk-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;
}
.tk-t-lbl { font-size: 24px; }
.tk-t-small { font-size: 19px; }
.tk-t-tiny { font-size: 14px; stroke-width: 4; }
.tk-t-dark { fill: #34205f; stroke: #fff; }
.tk-t-white { fill: #fff; stroke: rgba(60, 38, 120, .55); stroke-width: 5; }
.tk-faint { opacity: .45; }

/* lines */
.tk-under { stroke: #fff; stroke-width: 11; stroke-linecap: round; opacity: .9; }
.tk-seg { fill: none; stroke-width: 6; stroke-linecap: round; }
.tk-tick { stroke: #34205f; stroke-width: 3; stroke-linecap: round; }
.tk-door { stroke: rgba(255, 255, 255, .85); stroke-width: 3; stroke-linecap: round; }
.tk-arc-u { fill: none; stroke: #fff; stroke-width: 11; stroke-linecap: round; opacity: .9; }
.tk-arc { fill: none; stroke-width: 6; stroke-linecap: round; }

/* the pocket (matt cream cloth with stitching) */
.tk-tray { fill: #fff6e0; stroke: rgba(150, 100, 30, .45); stroke-width: 2.5; }
.tk-stitch { fill: none; stroke: #e2b866; stroke-width: 2.5; stroke-dasharray: 7 7; stroke-linecap: round; }
.tk-div { stroke: #e2b866; stroke-width: 2.5; stroke-dasharray: 3 9; stroke-linecap: round; }
.tk-cap { fill: #fff0b8; stroke: rgba(200, 140, 0, .6); stroke-width: 2.5; }
.tk-glow { fill: none; stroke: #ffc400; stroke-width: 4.5; }
.tk-x { stroke: #34205f; stroke-width: 5; stroke-linecap: round; opacity: .9; }
.tk-empty { fill: rgba(255, 255, 255, .55); stroke: #7c4dff; stroke-width: 3.5; stroke-dasharray: 6 7; }
.tk-empty-rect { fill: rgba(255, 255, 255, .6); stroke: #7c4dff; stroke-width: 3.5; stroke-dasharray: 7 8; }
.tk-ghostbox { fill: none; stroke: #7c4dff; stroke-width: 3; stroke-dasharray: 5 5; opacity: .85; }
.tk-pill { fill: rgba(255, 255, 255, .92); stroke: rgba(60, 38, 120, .45); stroke-width: 2; }
.tk-shaft { fill: #efe6ff; stroke: rgba(60, 38, 120, .55); stroke-width: 2.5; }
.tk-bubble { fill: #fff; stroke: rgba(60, 38, 120, .55); stroke-width: 3; }

/* calculator-style display */
.tk-calc { fill: #2a1b5c; stroke: #7c4dff; stroke-width: 4; }
.tk-calc-t { font: 800 38px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; fill: #c8f7ff; text-anchor: middle; dominant-baseline: central; stroke: none; }

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

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

/* ================================================================
   Answer chips: ALWAYS a single line (4 chips)
   ================================================================ */
.quiz-number-options.tk-picker {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 520px;
    margin: 16px auto 4px;
}
.quiz-number-options.tk-picker:empty { display: none; }
.quiz-number-opt.tk-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: anywhere;
    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.tk-opt.tk-sm { font-size: 13px; letter-spacing: -0.1px; }
.quiz-number-opt.tk-opt:active:not(:disabled) { transform: scale(.96); background: rgba(124, 77, 255, 0.10); }
@media (hover: hover) {
    .quiz-number-opt.tk-opt:hover:not(:disabled) { border-color: var(--primary, #6c5ce7); }
}
.quiz-number-opt.tk-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.tk-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.tk-opt.has-thumb { padding: 6px 4px 8px; }
.tk-opt-thumb { display: block; width: 100%; max-width: 84px; aspect-ratio: 1 / 1; }
.tk-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^="tk"] .quiz-modal { --tk-fig: 232px; }
    .quiz-number-options.tk-picker { gap: 6px; margin-top: 14px; }
    .quiz-number-opt.tk-opt { font-size: 12.5px; padding: 8px 3px; min-height: 52px !important; letter-spacing: -0.1px; }
    .quiz-number-opt.tk-opt.tk-sm { font-size: 11px; padding: 8px 2px; letter-spacing: -0.2px; }
    .tk-opt-thumb { max-width: 70px; }
}
@media (max-width: 380px) {
    .quiz-overlay[id^="tk"] .quiz-modal { --tk-fig: 204px; }
    .quiz-number-opt.tk-opt { font-size: 11.5px; padding: 7px 2px; }
    .quiz-number-opt.tk-opt.tk-sm { font-size: 10px; }
    .quiz-number-opt.tk-opt.has-thumb { padding: 5px 2px 6px; }
    .quiz-number-options.tk-picker { gap: 4px; }
    .tk-opt-thumb { max-width: 60px; }
    .tk-hint { font-size: 12.5px; }
    .quiz-overlay[id^="tk"] .quiz-question { font-size: 15.5px; }
}
@media (pointer: coarse) {
    .quiz-number-opt.tk-opt { min-height: 56px !important; }
}
@media (max-height: 560px) and (orientation: landscape) {
    .quiz-overlay[id^="tk"] .quiz-modal { --tk-fig: 176px; }
}
@media (prefers-reduced-motion: reduce) {
    .quiz-number-opt.tk-opt, .tk-replay { transition: none; }
}