/*
 * 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-spinner
 */
/*
 * spinner — circular probability spinner. Configurable segments, each
 * with a label and weight. Equal weights mean equally likely outcomes;
 * unequal weights teach fairness vs unfairness. Optional histogram
 * tracks frequency of outcomes across spins.
 */

.maths-activity .sp-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 .sp-wheel-wrap {
    position: relative;
    width: 280px;
    height: 280px;
}

.maths-activity .sp-wheel {
    width: 280px;
    height: 280px;
    transition: transform 2.5s cubic-bezier(0.18, 0.78, 0.18, 1.0);
    filter: drop-shadow(0 6px 14px rgba(20, 40, 80, 0.15));
}

.maths-activity .sp-segment-path {
    stroke: #1b5e20;
    stroke-width: 1.5;
}

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

.maths-activity .sp-rim {
    fill: none;
    stroke: #1b5e20;
    stroke-width: 4;
}

.maths-activity .sp-hub {
    fill: #1b5e20;
    stroke: #fffaf0;
    stroke-width: 2;
}

.maths-activity .sp-pointer {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    color: #d84315;
    font-size: 2rem;
    line-height: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

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

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

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

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

.maths-activity .sp-spin-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 .sp-spin-btn:hover { filter: brightness(1.08); }
.maths-activity .sp-spin-btn:disabled { background: #cbd5e1; cursor: not-allowed; box-shadow: none; }

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

.maths-activity .sp-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 .sp-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 .sp-histogram-rows {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.maths-activity .sp-hist-row {
    display: grid;
    grid-template-columns: 100px 1fr 50px;
    align-items: center;
    gap: 0.625rem;
    font-weight: 700;
}

.maths-activity .sp-hist-label {
    color: var(--maths-text, #1f2937);
    font-size: 0.95rem;
    text-align: right;
}

.maths-activity .sp-hist-bar-track {
    background: #f1f8e9;
    border-radius: 6px;
    height: 18px;
    position: relative;
    overflow: hidden;
}

.maths-activity .sp-hist-bar {
    background: var(--maths-primary, #2E7D32);
    height: 100%;
    transition: width 220ms ease-out;
}

.maths-activity .sp-hist-count {
    text-align: right;
    color: var(--maths-primary-dark, #1b5e20);
    font-variant-numeric: tabular-nums;
}

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

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

/* Display mode — hide controls, lock spinner */
/* Display mode — show a fixed spin. Hide the Spin button / counter and
 * tighten the stage; histogram (when present) stays. Your-turn prompts
 * stay — those are display-only discussion prompts.
 */
body.display-mode .sp-controls { display: none !important; }

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

body.display-mode .sp-wheel-wrap,
body.display-mode .sp-wheel {
    width: 220px;
    height: 220px;
}
