/* =========================================================
   DAT CUBE COUNTING PRACTICE
   ========================================================= */

.cube-counting-page {
    --cc-teal: #008c95;
    --cc-teal-dark: #00747c;
    --cc-teal-light: rgba(0, 140, 149, 0.1);
    --cc-navy: #17233c;
    --cc-text: #343b47;
    --cc-muted: #667085;
    --cc-border: #dce3ea;
    --cc-background: #f5f7fa;
    --cc-card: #ffffff;
    --cc-success: #16834b;
    --cc-success-light: #eaf8f0;
    --cc-error: #bd3039;
    --cc-error-light: #fff0f1;
}


/* =========================================================
   PRACTICE SECTION
   ========================================================= */

.cube-counting-page .cc-section {
    padding: 5rem 1.5rem;
    background: var(--cc-background);
}

.cube-counting-page .cc-app {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
}


/* =========================================================
   PROGRESS
   ========================================================= */

.cube-counting-page .cc-progress-area {
    max-width: 920px;
    margin: 0 auto 1.25rem;
}

.cube-counting-page .cc-progress-text {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.6rem;
    color: var(--cc-muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.cube-counting-page .cc-progress-track {
    width: 100%;
    height: 0.7rem;
    overflow: hidden;
    border-radius: 999px;
    background: #dfe5eb;
}

.cube-counting-page .cc-progress-bar {
    width: 5%;
    height: 100%;
    border-radius: inherit;
    background: var(--cc-teal);
    transition: width 0.35s ease;
}


/* =========================================================
   PRACTICE CARD
   ========================================================= */

.cube-counting-page .cc-card {
    max-width: 920px;
    margin: 0 auto;
    padding: 2.25rem;
    border: 1px solid var(--cc-border);
    border-radius: 1.25rem;
    background: var(--cc-card);
    box-shadow: 0 1rem 2.75rem rgba(23, 35, 60, 0.1);
}

.cube-counting-page .cc-card-heading {
    max-width: 760px;
    margin: 0 auto 1.75rem;
    text-align: center;
}

.cube-counting-page .cc-card-label {
    margin-bottom: 0.6rem;
    color: var(--cc-teal);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.cube-counting-page .cc-card-heading h2 {
    margin-bottom: 0.75rem;
    color: var(--cc-navy);
    font-size: clamp(1.45rem, 3vw, 2rem);
    font-weight: 800;
    line-height: 1.25;
}

.cube-counting-page .cc-card-instructions {
    margin-bottom: 0;
    color: var(--cc-muted);
    line-height: 1.65;
}


/* =========================================================
   CUBE VISUAL
   ========================================================= */

.cube-counting-page .cc-visual-area {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 440px;
    padding: 1rem;
    overflow: hidden;
    border: 1px solid var(--cc-border);
    border-radius: 1rem;
    background:
        linear-gradient(
            to bottom,
            rgba(248, 250, 252, 0.85),
            rgba(255, 255, 255, 0.98)
        );
}

.cube-counting-page .cc-cube-svg {
    display: block;
    width: 100%;
    max-width: 760px;
    height: auto;
    overflow: visible;
}

.cube-counting-page .cc-cube-svg polygon,
.cube-counting-page .cc-cube-svg path,
.cube-counting-page .cc-cube-svg line {
    vector-effect: non-scaling-stroke;
}

.cube-counting-page .cc-cube-svg .cc-cube-top {
    fill: #f8fafc;
    stroke: var(--cc-navy);
    stroke-width: 2;
    stroke-linejoin: round;
}

.cube-counting-page .cc-cube-svg .cc-cube-left {
    fill: #e9eef3;
    stroke: var(--cc-navy);
    stroke-width: 2;
    stroke-linejoin: round;
}

.cube-counting-page .cc-cube-svg .cc-cube-right {
    fill: #ffffff;
    stroke: var(--cc-navy);
    stroke-width: 2;
    stroke-linejoin: round;
}

.cube-counting-page .cc-cube-svg .cc-cube-edge {
    fill: none;
    stroke: var(--cc-navy);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}


/* =========================================================
   ANSWER CHOICES
   ========================================================= */

.cube-counting-page .cc-answer-fieldset {
    margin: 1.75rem 0 0;
    padding: 0;
    border: 0;
}

.cube-counting-page .cc-answer-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
}

.cube-counting-page .cc-answer-choice {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    min-height: 74px;
    padding: 0.85rem 1rem;
    border: 2px solid var(--cc-border);
    border-radius: 0.85rem;
    background: #ffffff;
    color: var(--cc-text);
    cursor: pointer;
    transition:
        border-color 0.2s ease,
        background 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.cube-counting-page .cc-answer-choice:hover {
    border-color: rgba(0, 140, 149, 0.55);
    background: #fbfefe;
    box-shadow: 0 0.55rem 1.25rem rgba(23, 35, 60, 0.08);
    transform: translateY(-2px);
}

.cube-counting-page .cc-answer-choice:focus-within {
    outline: 3px solid rgba(0, 140, 149, 0.2);
    outline-offset: 3px;
    border-color: var(--cc-teal);
}

.cube-counting-page .cc-answer-choice input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.cube-counting-page .cc-answer-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.2rem;
    height: 2.2rem;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--cc-navy);
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 800;
    line-height: 1;
}

.cube-counting-page .cc-answer-value {
    color: var(--cc-navy);
    font-size: 1.3rem;
    font-weight: 800;
}

.cube-counting-page .cc-answer-choice:has(input:checked) {
    border-color: var(--cc-teal);
    background: var(--cc-teal-light);
    box-shadow: 0 0 0 3px rgba(0, 140, 149, 0.08);
}

.cube-counting-page
.cc-answer-choice:has(input:checked)
.cc-answer-letter {
    background: var(--cc-teal);
}

.cube-counting-page .cc-answer-choice.is-correct {
    border-color: var(--cc-success);
    background: var(--cc-success-light);
}

.cube-counting-page .cc-answer-choice.is-correct .cc-answer-letter {
    background: var(--cc-success);
}

.cube-counting-page .cc-answer-choice.is-incorrect {
    border-color: var(--cc-error);
    background: var(--cc-error-light);
}

.cube-counting-page .cc-answer-choice.is-incorrect .cc-answer-letter {
    background: var(--cc-error);
}

.cube-counting-page .cc-answer-choice.is-disabled {
    cursor: default;
}

.cube-counting-page .cc-answer-choice.is-disabled:hover {
    transform: none;
}


/* =========================================================
   CONTROLS
   ========================================================= */

.cube-counting-page .cc-controls {
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
}

.cube-counting-page .cc-submit-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 220px;
    min-height: 3.2rem;
    padding: 0.8rem 1.25rem;
    border: 2px solid var(--cc-teal);
    border-radius: 0.75rem;
    background: var(--cc-teal);
    color: #ffffff;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.cube-counting-page .cc-submit-button:hover:not(:disabled) {
    border-color: var(--cc-teal-dark);
    background: var(--cc-teal-dark);
    transform: translateY(-1px);
}

.cube-counting-page .cc-submit-button:focus-visible {
    outline: 3px solid rgba(0, 140, 149, 0.22);
    outline-offset: 3px;
}

.cube-counting-page .cc-submit-button:disabled {
    border-color: #d9dfe5;
    background: #e6eaee;
    color: #8b939d;
    cursor: not-allowed;
    transform: none;
}


/* =========================================================
   FEEDBACK
   ========================================================= */

.cube-counting-page .cc-feedback {
    min-height: 3.2rem;
    margin-top: 1.25rem;
    padding: 0.9rem 1rem;
    border-radius: 0.75rem;
    background: #f2f4f7;
    color: var(--cc-muted);
    font-weight: 700;
    line-height: 1.45;
    text-align: center;
}

.cube-counting-page .cc-feedback.is-correct {
    background: var(--cc-success-light);
    color: var(--cc-success);
}

.cube-counting-page .cc-feedback.is-incorrect {
    background: var(--cc-error-light);
    color: var(--cc-error);
}


/* =========================================================
   CURRENT STATISTICS
   ========================================================= */

.cube-counting-page .cc-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
    max-width: 920px;
    margin: 1.25rem auto 0;
}

.cube-counting-page .cc-stat {
    padding: 1.15rem 0.8rem;
    border: 1px solid var(--cc-border);
    border-radius: 0.85rem;
    background: #ffffff;
    text-align: center;
    box-shadow: 0 0.45rem 1.2rem rgba(23, 35, 60, 0.05);
}

.cube-counting-page .cc-stat span {
    display: block;
    margin-bottom: 0.3rem;
    color: var(--cc-muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.cube-counting-page .cc-stat strong {
    display: block;
    color: var(--cc-navy);
    font-size: 1.55rem;
    font-weight: 800;
    line-height: 1;
}


/* =========================================================
   RESULTS
   ========================================================= */

.cube-counting-page .cc-results {
    max-width: 760px;
    margin: 1.5rem auto 0;
    padding: 2.25rem;
    border: 1px solid var(--cc-border);
    border-radius: 1.25rem;
    background: #ffffff;
    text-align: center;
    box-shadow: 0 1rem 2.75rem rgba(23, 35, 60, 0.1);
}

.cube-counting-page .cc-results[hidden] {
    display: none;
}

.cube-counting-page .cc-results-label {
    margin-bottom: 0.55rem;
    color: var(--cc-teal);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.cube-counting-page .cc-results h2 {
    margin-bottom: 0.65rem;
    color: var(--cc-navy);
    font-size: clamp(1.7rem, 4vw, 2.35rem);
    font-weight: 800;
}

.cube-counting-page .cc-results > p:not(.cc-results-label) {
    color: var(--cc-muted);
}

.cube-counting-page .cc-results-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
    margin: 1.75rem 0;
}

.cube-counting-page .cc-result-item {
    padding: 1.15rem 0.75rem;
    border-radius: 0.8rem;
    background: #f5f7fa;
}

.cube-counting-page .cc-result-item span {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--cc-muted);
    font-size: 0.77rem;
    font-weight: 700;
}

.cube-counting-page .cc-result-item strong {
    display: block;
    color: var(--cc-navy);
    font-size: 1.55rem;
    font-weight: 800;
}

.cube-counting-page .cc-result-accuracy {
    background: var(--cc-teal-light);
}

.cube-counting-page .cc-result-accuracy strong {
    color: var(--cc-teal-dark);
}


/* =========================================================
   INFORMATION CARDS
   ========================================================= */

.cube-counting-page .cc-info {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
    padding-top: 5rem;
    padding-bottom: 5rem;
}

.cube-counting-page .cc-info article {
    padding: 1.75rem;
    border-top: 4px solid var(--cc-teal);
    border-radius: 0.85rem;
    background: #f7f9fb;
}

.cube-counting-page .cc-info h2 {
    margin-bottom: 0.85rem;
    color: var(--cc-navy);
    font-size: 1.28rem;
    font-weight: 800;
    line-height: 1.3;
}

.cube-counting-page .cc-info p {
    margin-bottom: 0;
    color: var(--cc-muted);
    line-height: 1.75;
}


/* =========================================================
   SEO SECTION
   ========================================================= */

.cube-counting-page .cc-seo-section {
    padding: 5rem 0;
    background: var(--cc-background);
}

.cube-counting-page .cc-seo-content {
    max-width: 900px;
    margin: 0 auto;
}

.cube-counting-page .cc-seo-content h2 {
    margin-bottom: 1.25rem;
    color: var(--cc-navy);
    font-size: clamp(1.9rem, 4vw, 2.5rem);
    font-weight: 800;
}

.cube-counting-page .cc-seo-content h3 {
    margin-top: 2rem;
    margin-bottom: 0.8rem;
    color: var(--cc-navy);
    font-size: 1.4rem;
    font-weight: 800;
}

.cube-counting-page .cc-seo-content p {
    color: #555e6b;
    font-size: 1.02rem;
    line-height: 1.8;
}

.cube-counting-page .cc-seo-links {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-top: 2rem;
}

.cube-counting-page .cc-resource-link {
    color: var(--cc-teal-dark);
    font-weight: 700;
    text-decoration: none;
}

.cube-counting-page .cc-resource-link:hover {
    color: #005f65;
    text-decoration: underline;
}


/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 991.98px) {

    .cube-counting-page .cc-section {
        padding: 4rem 1.25rem;
    }

    .cube-counting-page .cc-card {
        padding: 1.75rem;
    }

    .cube-counting-page .cc-visual-area {
        min-height: 380px;
    }

    .cube-counting-page .cc-answer-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cube-counting-page .cc-info {
        grid-template-columns: 1fr;
        max-width: 720px;
    }

    .cube-counting-page .cc-results-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 575.98px) {

    .cube-counting-page .cc-section {
        padding: 2.25rem 0.7rem;
    }

    .cube-counting-page .cc-card {
        padding: 1rem;
        border-radius: 1rem;
    }

    .cube-counting-page .cc-card-heading {
        margin-bottom: 1rem;
    }

    .cube-counting-page .cc-card-heading h2 {
        font-size: 1.25rem;
    }

    .cube-counting-page .cc-card-instructions {
        font-size: 0.9rem;
    }

    .cube-counting-page .cc-visual-area {
        min-height: 240px;
        padding: 0.35rem;
        border-radius: 0.75rem;
    }

    .cube-counting-page .cc-cube-svg {
        max-width: 100%;
    }

    .cube-counting-page .cc-answer-fieldset {
        margin-top: 1rem;
    }

    .cube-counting-page .cc-answer-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.6rem;
    }

    .cube-counting-page .cc-answer-choice {
        min-height: 58px;
        gap: 0.55rem;
        padding: 0.6rem;
        border-radius: 0.7rem;
    }

    .cube-counting-page .cc-answer-letter {
        width: 1.75rem;
        height: 1.75rem;
        font-size: 0.75rem;
    }

    .cube-counting-page .cc-answer-value {
        font-size: 1.05rem;
    }

    .cube-counting-page .cc-controls {
        margin-top: 1rem;
    }

    .cube-counting-page .cc-submit-button {
        width: 100%;
        min-width: 0;
        min-height: 2.9rem;
        font-size: 0.9rem;
    }

    .cube-counting-page .cc-feedback {
        min-height: auto;
        margin-top: 0.85rem;
        padding: 0.7rem;
        font-size: 0.85rem;
    }

    .cube-counting-page .cc-stats {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 0.4rem;
    }

    .cube-counting-page .cc-stat {
        padding: 0.75rem 0.25rem;
    }

    .cube-counting-page .cc-stat span {
        font-size: 0.62rem;
    }

    .cube-counting-page .cc-stat strong {
        font-size: 1.2rem;
    }

    .cube-counting-page .cc-results {
        padding: 1.5rem 1rem;
    }

    .cube-counting-page .cc-results-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cube-counting-page .cc-info {
        padding-top: 3.5rem;
        padding-bottom: 3.5rem;
    }

    .cube-counting-page .cc-info article {
        padding: 1.4rem;
    }

    .cube-counting-page .cc-seo-section {
        padding: 3.5rem 0;
    }

    .cube-counting-page .cc-seo-section .container {
        padding-right: 1.25rem !important;
        padding-left: 1.25rem !important;
    }

    .cube-counting-page .cc-seo-links {
        align-items: stretch;
        flex-direction: column;
    }

    .cube-counting-page .cc-seo-links .btn {
        width: 100%;
    }

    .cube-counting-page .cc-resource-link {
        text-align: center;
    }
}


/* =========================================================
   VERY SMALL SCREENS
   ========================================================= */

@media (max-width: 380px) {

    .cube-counting-page .cc-visual-area {
        min-height: 210px;
    }

    .cube-counting-page .cc-answer-choice {
        padding-right: 0.35rem;
        padding-left: 0.35rem;
    }

    .cube-counting-page .cc-stat span {
        font-size: 0.56rem;
    }
}


/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    .cube-counting-page *,
    .cube-counting-page *::before,
    .cube-counting-page *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

.cube-counting-page .cc-answer-choice.is-selected {
    border-color: var(--cc-teal);
    background: var(--cc-teal-light);
    box-shadow: 0 0 0 3px rgba(0, 140, 149, 0.08);
}

.cube-counting-page
.cc-answer-choice.is-selected
.cc-answer-letter {
    background: var(--cc-teal);
}

.cube-counting-page
.cc-cube-top.is-answer-face {
    fill: #bdeee5;
    stroke: #00747c;
    stroke-width: 3;
}

.cube-counting-page
.cc-cube-left.is-answer-face {
    fill: #8ed8cb;
    stroke: #00747c;
    stroke-width: 3;
}

.cube-counting-page
.cc-cube-right.is-answer-face {
    fill: #d7f6f0;
    stroke: #00747c;
    stroke-width: 3;
}

.cube-counting-page .cc-debug-label {
    fill: #bd3039;
    font-size: 10px;
    font-weight: 800;
    pointer-events: none;
}

.cube-counting-page.debug-cubes .cc-cube-top {
    fill: rgba(255, 225, 80, 0.65);
}

.cube-counting-page.debug-cubes .cc-cube-left {
    fill: rgba(80, 160, 255, 0.55);
}

.cube-counting-page.debug-cubes .cc-cube-right {
    fill: rgba(255, 110, 110, 0.55);
}

.cube-counting-page .cc-cube-face {
    stroke: #17233c;
    stroke-width: 2;
    stroke-linejoin: round;
}

.cube-counting-page .cc-debug-label {
    fill: #111827;
    font-size: 8px;
    font-weight: 800;
    pointer-events: none;
}

.cube-counting-page .cc-rotation-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.cube-counting-page .cc-rotation-controls[hidden] {
    display: none;
}

.cube-counting-page .cc-rotation-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 2.75rem;
    padding: 0.65rem 1rem;
    border: 2px solid var(--cc-teal);
    border-radius: 0.7rem;
    background: #ffffff;
    color: var(--cc-teal-dark);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition:
        background 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}

.cube-counting-page .cc-rotation-button:hover {
    background: var(--cc-teal);
    color: #ffffff;
    transform: translateY(-1px);
}

.cube-counting-page .cc-rotation-button svg {
    width: 1rem;
    height: 1rem;
}

.cube-counting-page .cc-rotation-label {
    min-width: 80px;
    color: var(--cc-muted);
    font-size: 0.85rem;
    font-weight: 800;
    text-align: center;
}

@media (max-width: 575.98px) {

    .cube-counting-page .cc-rotation-controls {
        gap: 0.45rem;
    }

    .cube-counting-page .cc-rotation-button {
        padding: 0.55rem 0.65rem;
        font-size: 0.78rem;
    }

    .cube-counting-page .cc-rotation-label {
        min-width: 65px;
        font-size: 0.72rem;
    }
}

.cube-counting-page .cc-cube-svg {
    touch-action: none;
    user-select: none;
    cursor: default;
    transition: transform 0.15s ease;
}

.cube-counting-page .cc-cube-svg.is-rotatable {
    cursor: grab;
}

.cube-counting-page .cc-cube-svg.is-dragging {
    cursor: grabbing;
    transition: none;
}

/* =========================================================
   THREE.JS INTERACTIVE CUBE VIEW
   ========================================================= */

.cube-counting-page .cc-three-container {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 440px;
    overflow: hidden;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.cube-counting-page .cc-three-container[hidden] {
    display: none;
}

.cube-counting-page .cc-three-container.is-dragging {
    cursor: grabbing;
}

.cube-counting-page .cc-three-container canvas {
    display: block;
    width: 100%;
    height: 100%;
    outline: none;
}

@media (max-width: 767.98px) {
    .cube-counting-page .cc-three-container {
        height: 350px;
    }
}

@media (max-width: 575.98px) {
    .cube-counting-page .cc-three-container {
        height: 300px;
    }
}

.cube-counting-page .cc-cube-svg[hidden] {
    display: none;
}

.cube-counting-page .cc-controls {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.cube-counting-page .cc-secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 160px;
    min-height: 3.2rem;
    padding: 0.8rem 1.25rem;
    border: 2px solid var(--cc-teal);
    border-radius: 0.75rem;
    background: #ffffff;
    color: var(--cc-teal-dark);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition:
        background 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}

.cube-counting-page .cc-secondary-button:hover {
    background: var(--cc-teal);
    color: #ffffff;
    transform: translateY(-1px);
}

.cube-counting-page .cc-secondary-button:focus-visible {
    outline: 3px solid rgba(0, 140, 149, 0.22);
    outline-offset: 3px;
}