/*
 * 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-dice-roller
 */
/*
 * dice-roller — one or two dice, configurable side count (4/6/8/10/12/20).
 * Tap Roll to throw. Optional histogram tracks frequency of outcomes
 * across rolls so pupils see fairness emerge from a larger sample.
 */

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

.maths-activity .dr-dice-row {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    justify-content: center;
}

.maths-activity .dr-die {
    width: 90px;
    height: 90px;
    background: #fff;
    border: 3px solid #1b5e20;
    border-radius: 14px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: 10px;
    gap: 4px;
    box-shadow: 0 4px 12px rgba(20, 40, 80, 0.12), inset -2px -2px 0 rgba(0, 0, 0, 0.08);
    transition: transform 200ms ease-out;
}

.maths-activity .dr-die.dr-rolling { animation: dr-shake 350ms ease-in-out; }

@keyframes dr-shake {
    0% { transform: translate(0, 0) rotate(0); }
    25% { transform: translate(-8px, -4px) rotate(-8deg); }
    50% { transform: translate(8px, 4px) rotate(8deg); }
    75% { transform: translate(-4px, 6px) rotate(-4deg); }
    100% { transform: translate(0, 0) rotate(0); }
}

.maths-activity .dr-pip {
    background: #1b5e20;
    border-radius: 50%;
    width: 14px;
    height: 14px;
    align-self: center;
    justify-self: center;
}

.maths-activity .dr-die-text {
    font-size: 2.5rem;
    font-weight: 800;
    color: #1b5e20;
    grid-column: 1 / -1;
    grid-row: 1 / -1;
    align-self: center;
    justify-self: center;
}

.maths-activity .dr-result {
    text-align: center;
}

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

.maths-activity .dr-result-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--maths-primary-dark, #1b5e20);
    font-variant-numeric: tabular-nums;
}

.maths-activity .dr-result-sum {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--maths-text, #1f2937);
    margin-top: 0.25rem;
}

.maths-activity .dr-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.maths-activity .dr-roll-btn {
    background: var(--maths-primary, #2E7D32);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 0.7rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(46, 125, 50, 0.25);
}

.maths-activity .dr-roll-btn:hover { filter: brightness(1.08); }
.maths-activity .dr-roll-btn:disabled { background: #cbd5e1; cursor: not-allowed; box-shadow: none; }

.maths-activity .dr-roll-counter {
    font-weight: 700;
    color: var(--maths-text-muted, #6b7280);
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
}

.maths-activity .dr-histogram-wrap {
    background: #fff;
    border: 1px solid var(--maths-border, #e0e7ef);
    border-radius: 14px;
    padding: 0.875rem 1.125rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(20, 40, 80, 0.04);
}

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

.maths-activity .dr-histogram-svg {
    width: 100%;
    height: auto;
}

.maths-activity .dr-hist-bar { fill: #d84315; }
.maths-activity .dr-hist-bar-2 { fill: #1565c0; }

.maths-activity .dr-hist-axis {
    stroke: #1b5e20;
    stroke-width: 1.5;
    stroke-linecap: round;
}

.maths-activity .dr-hist-label {
    fill: #1f2937;
    font-family: "Nunito", sans-serif;
    font-weight: 700;
    font-size: 12px;
    text-anchor: middle;
}

.maths-activity .dr-hist-value {
    fill: #1f2937;
    font-family: "Nunito", sans-serif;
    font-weight: 800;
    font-size: 11px;
    text-anchor: middle;
}

.maths-activity .dr-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 .dr-your-turn {
    margin-top: 1.25rem;
    background: #f1f8e9;
    border: 1px solid #aed581;
    border-radius: 14px;
    padding: 1rem 1.25rem;
}

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

/* Display mode — hide controls, lock dice */
/* Display mode — show a fixed roll. Hide the Roll button / counter and
 * tighten the stage; the histogram (when present) stays so frequency
 * read-off works. Your-turn prompts stay — those are display-only
 * discussion prompts.
 */
body.display-mode .dr-controls { display: none !important; }

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

body.display-mode .dr-die {
    width: 72px;
    height: 72px;
}

body.display-mode .dr-histogram-svg {
    max-height: 180px;
}
