/*
 * Coding Ireland proprietary interactive activity
 * Copyright (c) 2017-2026 Coding Ireland. All rights reserved.
 *
 * Part of the Coding Ireland online learning platform. Licensed for use only
 * as delivered on the platform. Copying, redistributing, or adapting this
 * file, in whole or in part, for use in any other product or service is not
 * permitted. Ref: CI-maths-balance-scales
 */
/*
 * balance-scales — two-pan SVG balance. Each pan holds number / variable
 * blocks; the beam tilts based on which side is heavier, and the
 * equation reads out the current values. Teaches equality as balance
 * (not "the answer goes here") and missing-value algebra.
 */

.maths-activity .bs-stage {
    background: #fffaf0;
    border: 1px solid var(--maths-border, #e0e7ef);
    border-radius: 14px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 10px rgba(20, 40, 80, 0.05);
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    align-items: center;
}

.maths-activity .bs-svg {
    width: 100%;
    max-width: 600px;
    height: auto;
    user-select: none;
}

.maths-activity .bs-stand {
    fill: #8d6e63;
    stroke: #4e342e;
    stroke-width: 2;
}

.maths-activity .bs-stand-base {
    fill: #5d4037;
    stroke: #4e342e;
    stroke-width: 2;
}

.maths-activity .bs-pivot {
    fill: #4e342e;
    stroke: #fffaf0;
    stroke-width: 2;
}

.maths-activity .bs-beam {
    stroke: #4e342e;
    stroke-width: 6;
    stroke-linecap: round;
}

.maths-activity .bs-rope {
    stroke: #4e342e;
    stroke-width: 2;
    stroke-linecap: round;
}

.maths-activity .bs-pan-arc {
    fill: #cfd8dc;
    stroke: #455a64;
    stroke-width: 2;
}

.maths-activity .bs-block {
    fill: #f9b900;
    stroke: #8b6300;
    stroke-width: 1.5;
}

.maths-activity .bs-block-variable {
    fill: #1565c0;
    stroke: #0b3a73;
}

.maths-activity .bs-block-text {
    fill: #1f2937;
    font-family: "Nunito", sans-serif;
    font-weight: 800;
    font-size: 16px;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
}

.maths-activity .bs-block-variable + .bs-block-text { fill: #fff; }

.maths-activity .bs-pan-total {
    fill: var(--maths-primary-dark, #1b5e20);
    font-family: "Nunito", sans-serif;
    font-weight: 800;
    font-size: 18px;
    text-anchor: middle;
}

.maths-activity .bs-equation {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--maths-primary-dark, #1b5e20);
    text-align: center;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    background: #fff;
    border: 1px solid var(--maths-border, #e0e7ef);
    border-radius: 12px;
    padding: 0.625rem 1rem;
    width: 100%;
    max-width: 420px;
}

.maths-activity .bs-status {
    background: #fff;
    border: 1px solid var(--maths-border, #e0e7ef);
    border-radius: 12px;
    padding: 0.625rem 1rem;
    width: 100%;
    max-width: 420px;
    text-align: center;
    font-weight: 800;
    transition: background-color 220ms ease-out, border-color 220ms ease-out, color 220ms ease-out;
}

.maths-activity .bs-status.bs-balanced {
    background: #e8f5e9;
    border-color: #66bb6a;
    color: #1b5e20;
}

.maths-activity .bs-status.bs-tilted-left,
.maths-activity .bs-status.bs-tilted-right {
    background: #fff8e1;
    border-color: #f0c14b;
    color: #8d4e0b;
}

.maths-activity .bs-controls {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border: 1px solid var(--maths-border, #e0e7ef);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.maths-activity .bs-slider-label {
    font-weight: 700;
    color: var(--maths-text, #1f2937);
    font-size: 1rem;
}

.maths-activity .bs-slider-label strong {
    color: var(--maths-primary-dark, #1b5e20);
    font-size: 1.15rem;
    font-variant-numeric: tabular-nums;
}

.maths-activity .bs-controls input[type="range"] {
    width: 100%;
    accent-color: var(--maths-primary, #2E7D32);
    cursor: pointer;
}

.maths-activity .bs-mode-chip {
    display: inline-block;
    background: var(--maths-primary, #2E7D32);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    margin-top: 0.25rem;
}

.maths-activity .bs-target-label {
    font-weight: 800;
    color: #8d4e0b;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.maths-activity .bs-target-prompt { flex: 1; font-weight: 700; color: #1f2937; }

.maths-activity .bs-your-turn {
    margin-top: 1.25rem;
    background: #f1f8e9;
    border: 1px solid #aed581;
    border-radius: 14px;
    padding: 1rem 1.25rem;
}

.maths-activity .bs-your-turn-label {
    font-weight: 800;
    color: #33691e;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.maths-activity .bs-your-turn-list { margin: 0; padding-left: 1.25rem; color: #1f2937; font-weight: 600; }
.maths-activity .bs-your-turn-list li { margin-bottom: 0.25rem; }

/* Display mode — show only the SVG balance. The shared maths-activity.css
 * hides the activity-header. Auxiliary readout panels (equation line,
 * status text, result callout) duplicate in prose what the tilted beam
 * already shows visually, so they're hidden too — the snapshot is the
 * diagram, full stop. */
/* Display mode — read-only snapshot. Show the scales SVG plus the
 * equation line and balance status (context for the worked example).
 * Hide the slider, target panel, transient callout, and challenge
 * runner. Cap the SVG so the scales don't dominate. Your-turn prompts
 * stay — those are display-only discussion prompts.
 */
body.display-mode .bs-target-panel,
body.display-mode .bs-controls,
body.display-mode .bs-callout,
body.display-mode #challengeRunner { display: none !important; }

body.display-mode .bs-stage {
    padding: 0.75rem;
    gap: 0.55rem;
    margin-bottom: 0.75rem;
}

body.display-mode .bs-svg {
    max-width: 420px;
    max-height: 260px;
}

body.display-mode .bs-equation {
    font-size: 1.1rem;
}

/* ---------- Competition sizing ----------
 * Capped at 600px on a lesson page; on a board the scales are the whole point of looking. */
html.mcr-compete .maths-activity .bs-svg { max-width: min(1000px, 78vh); }

/* ---------- Competition layout (board) ----------
 * Side by side on a board: the scales on the left, the sum, the tilt and the slider stacked on the
 * right. As a column the scales had to share the height with three boxes under them and came out
 * at half the size the board had room for.
 */
html.mcr-compete .maths-activity .bs-stage {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
    align-items: center;
    align-content: center;
    gap: 0.9rem 2.5rem;
}
html.mcr-compete .maths-activity .bs-svg { grid-column: 1; grid-row: 1 / span 3; width: 40rem; max-width: 100%; justify-self: center; }
html.mcr-compete .maths-activity .bs-stage > :not(.bs-svg) { grid-column: 2; max-width: none; box-sizing: border-box; }
html.mcr-compete .maths-activity .bs-equation { font-size: 1.6rem; }
html.mcr-compete .maths-activity .bs-status { font-size: 1.15rem; }
html.mcr-compete .maths-activity .bs-slider-label { font-size: 1.3rem; }
html.mcr-compete .maths-activity .bs-slider-label strong { font-size: 1.5rem; }
/* ---------- end competition layout ---------- */
