/*
 * 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-grid-reference
 */
/*
 * grid-reference activity skin. Layered on the shared maths-activity.css.
 * A letter-column × number-row grid of tappable squares, a reference readout,
 * and (in challenge) the shared target panel. Display mode disables taps.
 */

.gr-mode-chip {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    background: var(--maths-surface-alt);
    color: var(--maths-primary-dark);
    font-weight: 800;
    font-size: 0.8rem;
}

/* ---- Readout ---- */
.gr-readout {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}

.gr-readout-label {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--maths-ink-muted);
}

.gr-readout-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--maths-primary);
    font-variant-numeric: tabular-nums;
    min-width: 3rem;
    text-align: center;
}

/* ---- Grid ---- */
.gr-stage {
    display: flex;
    justify-content: center;
}

.gr-grid {
    display: grid;
    gap: 4px;
    max-width: 520px;
    width: 100%;
}

.gr-corner { background: transparent; }

.gr-head {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: var(--maths-primary-dark);
    font-size: 1.1rem;
}

.gr-head-row { padding-right: 0.3rem; }

.gr-cell {
    aspect-ratio: 1 / 1;
    border: 2px solid var(--maths-border);
    border-radius: 8px;
    background: var(--maths-surface);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    line-height: 1;
    transition: background-color 120ms ease, border-color 120ms ease;
    padding: 0;
}

.gr-cell:hover { background: var(--maths-surface-alt); border-color: var(--maths-primary); }

.gr-cell.selected {
    background: #d9ecff;
    border-color: var(--maths-primary);
    box-shadow: 0 0 0 3px rgba(31, 111, 178, 0.2);
}

.gr-cell.highlight {
    background: #ffe7b3;
    border-color: var(--maths-warning);
}

.gr-object {
    pointer-events: none;
    user-select: none;
}

/* ---- Target panel ---- */
.gr-target-prompt {
    font-weight: 800;
    color: #6b4500;
    flex: 1 1 220px;
}

.gr-check-btn { white-space: nowrap; }

/* ---- Your turn ---- */
.gr-your-turn {
    max-width: 520px;
    margin: 1rem auto 0;
    background: #fff8e1;
    border: 1px solid #f0c14b;
    border-radius: 12px;
    padding: 0.9rem 1.1rem;
}

.gr-your-turn[hidden] { display: none; }

.gr-your-turn-label { font-weight: 800; color: #8a5a00; margin-bottom: 0.4rem; }
.gr-your-turn-list { margin: 0; padding-left: 1.2rem; color: var(--maths-ink); }
.gr-your-turn-list li { margin: 0.2rem 0; }

/* ---- Display mode ---- */
body.display-mode .gr-cell {
    cursor: default;
    pointer-events: none;
}

body.display-mode .gr-readout {
    margin-bottom: 0.5rem;
}

@media (max-width: 640px) {
    .gr-cell { font-size: 1.3rem; }
    .gr-readout-value { font-size: 1.5rem; }
}
