/*
 * pattern-blocks — coloured geometric shapes (triangle / square /
 * circle / hexagon / diamond / star / rhombus / trapezoid) placed
 * onto a canvas. Two layouts: `sequence` (continue-the-pattern
 * horizontal strip) and `grid` (fill cells, used for tessellation
 * and sort-by-property). Both share the same shape palette and
 * the standard explore / challenge / display modes.
 */

/* Honor the [hidden] HTML attribute even on elements whose later rules
 * set an explicit display: value (mode chip, target panel, callout). */
.maths-activity [hidden] { display: none !important; }

.maths-activity .pb-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 .pb-canvas {
    width: 100%;
    display: flex;
    justify-content: center;
}

/* ----- Sequence layout ----- */

.maths-activity .pb-sequence {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.maths-activity .pb-slot {
    width: 64px;
    height: 64px;
    background: #fff;
    border: 2px dashed #b0bec5;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 120ms ease-out, border-color 120ms ease-out;
}

.maths-activity .pb-slot.pb-filled {
    border-style: solid;
    border-color: #455a64;
    background: #fff;
}

.maths-activity .pb-slot.pb-empty:hover { background: #fff8e1; border-color: #f0c14b; }
.maths-activity .pb-slot.pb-target-correct { border-color: #2E7D32; background: #e8f5e9; }
.maths-activity .pb-slot.pb-target-incorrect { border-color: #c62828; background: #ffebee; }

.maths-activity .pb-slot-q {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 28px;
    color: #6b7280;
}

/* ----- Grid layout ----- */

.maths-activity .pb-grid {
    display: grid;
    gap: 4px;
    background: #455a64;
    padding: 4px;
    border-radius: 10px;
}

.maths-activity .pb-cell {
    width: 56px;
    height: 56px;
    background: #fff;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    transition: background-color 120ms ease-out;
}

.maths-activity .pb-cell:hover { background: #fff8e1; }
.maths-activity .pb-cell.pb-prefilled { background: #f5f5f5; cursor: default; }
.maths-activity .pb-cell.pb-target-correct { background: #e8f5e9; }
.maths-activity .pb-cell.pb-target-incorrect { background: #ffebee; }

/* Honeycomb (tessellate: true) — hexagons in offset rows, edge-to-edge */
.maths-activity .pb-honeycomb { position: relative; padding: 8px; }
.maths-activity .pb-hex { position: absolute; line-height: 0; }
.maths-activity .pb-hex svg { display: block; }

/* ----- Palette ----- */

.maths-activity .pb-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--maths-border, #e0e7ef);
    border-radius: 12px;
    padding: 0.625rem 0.875rem;
    box-shadow: 0 2px 8px rgba(20, 40, 80, 0.04);
}

.maths-activity .pb-palette-btn {
    width: 56px;
    height: 56px;
    background: #fff;
    border: 2px solid #cfd8dc;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: border-color 120ms ease-out, box-shadow 120ms ease-out;
}

.maths-activity .pb-palette-btn:hover { border-color: #6b7280; }

.maths-activity .pb-palette-btn.pb-active {
    border-color: var(--maths-primary, #2E7D32);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.25);
}

.maths-activity .pb-palette-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--maths-text-muted, #6b7280);
    align-self: center;
    margin-right: 0.4rem;
}

/* ----- Mode + chrome ----- */

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

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

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

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

/* Display mode — read-only pattern. Hide the palette (no shape picking),
 * target panel, callout and challenge runner; lock slots and cells.
 * Tighten stage padding. Your-turn prompts stay — those are
 * display-only discussion prompts.
 */
body.display-mode .pb-target-panel,
body.display-mode .pb-callout,
body.display-mode .pb-palette,
body.display-mode #challengeRunner { display: none !important; }

body.display-mode .pb-slot,
body.display-mode .pb-cell { cursor: default !important; pointer-events: none; }

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