/*
 * 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-target-number
 */
/*
 * target-number — NRICH-style "reach the target with the four
 * operations" puzzle. Stages 3-4. Tap starter chips and operation
 * chips to build an expression; live evaluator shows the running
 * value; Check confirms equality + reuse rule. Pattern source: NRICH
 * "Got it" / Countdown numbers round / "24 game".
 */

.maths-activity [hidden] { display: none !important; }

.maths-activity .tn-stage {
    background: #fffaf0;
    border: 1px solid var(--maths-border, #e0e7ef);
    border-radius: 14px;
    padding: 1.25rem;
    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 .tn-target-label {
    font-weight: 800;
    color: #8d4e0b;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.maths-activity .tn-target-value {
    font-family: 'Nunito', sans-serif;
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--maths-primary-dark, #155484);
    font-variant-numeric: tabular-nums;
    flex: 1;
    text-align: center;
}

/* Starter + operation chips */
.maths-activity .tn-starters,
.maths-activity .tn-ops {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.maths-activity .tn-chip {
    background: #fff;
    border: 2px solid #cfd8dc;
    border-radius: 12px;
    padding: 0.65rem 1.1rem;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 1.4rem;
    color: var(--maths-primary-dark, #1b5e20);
    cursor: pointer;
    min-width: 60px;
    font-variant-numeric: tabular-nums;
    transition: background-color 120ms ease-out, border-color 120ms ease-out, opacity 120ms ease-out;
}

.maths-activity .tn-chip:hover:not(:disabled) {
    background: #fff8e1;
    border-color: #f0c14b;
}

.maths-activity .tn-chip:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.maths-activity .tn-op-chip {
    background: #fff;
    border: 2px solid #cfd8dc;
    border-radius: 10px;
    padding: 0.55rem 0.95rem;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 1.3rem;
    color: #d84315;
    cursor: pointer;
    min-width: 48px;
}

.maths-activity .tn-op-chip:hover { background: #fff8e1; border-color: #f0c14b; }
.maths-activity .tn-op-chip.tn-op-paren { color: #6b7280; }
.maths-activity .tn-op-chip[hidden] { display: none !important; }

/* Expression strip */
.maths-activity .tn-expression-row {
    width: 100%;
    max-width: 560px;
    background: #fff;
    border: 2px solid var(--maths-border, #e0e7ef);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: baseline;
    gap: 1rem;
    box-shadow: 0 2px 8px rgba(20, 40, 80, 0.04);
}

.maths-activity .tn-expression {
    flex: 1;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--maths-text, #1f2937);
    font-variant-numeric: tabular-nums;
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
}

.maths-activity .tn-eval {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 1.3rem;
    color: var(--maths-primary-dark, #1b5e20);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.maths-activity .tn-eval.tn-eval-error {
    color: #b71c1c;
}

.maths-activity .tn-eval.tn-eval-hit {
    color: #2E7D32;
}

/* Controls row */
.maths-activity .tn-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

/* Mode chip + your-turn + callout — same shape as other widgets */
.maths-activity .tn-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 .tn-your-turn {
    margin-top: 1.25rem;
    background: #f1f8e9;
    border: 1px solid #aed581;
    border-radius: 14px;
    padding: 1rem 1.25rem;
}

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

/* Display mode — pin the worked expression. The operation chips and
 * the backspace/clear/check controls are out of scope (nothing to
 * build in display); the starter chips stay as reference, dimmed and
 * inert. Tighten the stage so the whole snapshot fits compactly.
 * Your-turn prompts stay — those are display-only discussion prompts.
 */
body.display-mode .tn-ops,
body.display-mode .tn-controls,
body.display-mode .tn-callout,
body.display-mode #challengeRunner { display: none !important; }

body.display-mode .tn-chip,
body.display-mode .tn-op-chip {
    pointer-events: none;
    cursor: default;
    opacity: 0.6;
}

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

body.display-mode .tn-chip {
    padding: 0.4rem 0.8rem;
    font-size: 1.15rem;
    min-width: 48px;
}

body.display-mode .tn-target-value {
    font-size: 1.75rem;
}

body.display-mode .tn-expression-row {
    padding: 0.55rem 0.85rem;
}

body.display-mode .tn-expression {
    font-size: 1.2rem;
}

body.display-mode .tn-eval {
    font-size: 1.15rem;
}
