/*
 * coordinate-grid — SVG x/y plane. Click a grid square to plot a
 * point; drag to move; click again to remove. Supports first quadrant
 * only (Stage 3) or all four quadrants (Stage 4 — NCCA outcome).
 * Optional shape connect-the-dots draws lines between points in order.
 */

.maths-activity .cg-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: 1rem;
    align-items: center;
}

.maths-activity .cg-svg {
    width: 100%;
    max-width: 480px;
    height: auto;
    background: #fff;
    border-radius: 10px;
    user-select: none;
    touch-action: none;
}

.maths-activity .cg-grid-line {
    stroke: #1b5e20;
    stroke-width: 1;
    opacity: 0.18;
}

.maths-activity .cg-axis {
    stroke: #1b5e20;
    stroke-width: 2.5;
    stroke-linecap: round;
}

.maths-activity .cg-axis-arrow { fill: #1b5e20; }

.maths-activity .cg-axis-label {
    fill: var(--maths-primary-dark, #1b5e20);
    font-family: "Nunito", sans-serif;
    font-weight: 800;
    font-size: 14px;
    text-anchor: middle;
    dominant-baseline: middle;
}

.maths-activity .cg-tick-label {
    fill: #1f2937;
    font-family: "Nunito", sans-serif;
    font-weight: 700;
    font-size: 11px;
    text-anchor: middle;
    dominant-baseline: middle;
}

.maths-activity .cg-grid-hover {
    fill: #ffe9c4;
    stroke: #c48a3a;
    stroke-width: 1;
    opacity: 0;
    pointer-events: none;
    transition: opacity 100ms ease-out;
}

.maths-activity .cg-grid-hover.cg-show { opacity: 0.7; }

.maths-activity .cg-shape-line {
    stroke: #d84315;
    stroke-width: 2;
    fill: none;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.maths-activity .cg-shape-fill {
    fill: rgba(216, 67, 21, 0.15);
    stroke: none;
}

.maths-activity .cg-point {
    cursor: grab;
    transition: filter 120ms ease-out;
}

.maths-activity .cg-point:active,
.maths-activity .cg-point.cg-dragging { cursor: grabbing; }

.maths-activity .cg-point-circle {
    fill: #d84315;
    stroke: #fff;
    stroke-width: 2;
}

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

.maths-activity .cg-point-coord {
    fill: #1f2937;
    font-family: "Nunito", sans-serif;
    font-weight: 700;
    font-size: 11px;
    text-anchor: middle;
    pointer-events: none;
}

.maths-activity .cg-grid-clickable {
    fill: transparent;
    cursor: crosshair;
}

.maths-activity .cg-readouts {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.875rem;
}

.maths-activity .cg-readout {
    background: #fff;
    border: 1px solid var(--maths-border, #e0e7ef);
    border-radius: 14px;
    padding: 0.75rem 1.125rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    box-shadow: 0 2px 8px rgba(20, 40, 80, 0.04);
}

.maths-activity .cg-readout-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--maths-text-muted, #6b7280);
}

.maths-activity .cg-readout-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--maths-primary-dark, #1b5e20);
    font-variant-numeric: tabular-nums;
    line-height: 1.4;
}

.maths-activity .cg-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 .cg-target-label {
    font-weight: 800;
    color: #8d4e0b;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

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

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

.maths-activity .cg-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 .cg-your-turn-list { margin: 0; padding-left: 1.25rem; color: #1f2937; font-weight: 600; }
.maths-activity .cg-your-turn-list li { margin-bottom: 0.25rem; }

/* Display mode — hide controls and lock points */
/* Display mode — read-only grid with preset points. Target panel,
 * callout and challenge runner hidden; points and grid locked. Cap the
 * SVG so the grid doesn't dominate the lesson page. Your-turn prompts
 * stay — those are display-only discussion prompts.
 */
body.display-mode .cg-target-panel,
body.display-mode .cg-callout,
body.display-mode #challengeRunner { display: none !important; }

body.display-mode .cg-point { cursor: default !important; pointer-events: none; }
body.display-mode .cg-grid-clickable { pointer-events: none; }

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

body.display-mode .cg-svg {
    max-width: 320px;
}
