/* =========================================================
   Multiplication Practice
   Page-specific styles for /multiplication-practice/
   ========================================================= */

.multiplication-practice-page {
    background: #f7fafc;
    color: #1f2933;
}

.multiplication-practice-page main {
    overflow: hidden;
}

/* =========================================================
   Practice section
   ========================================================= */

.mp-section {
    padding: 5rem 1.5rem 4rem;
    background:
        radial-gradient(circle at top left, rgba(41, 181, 179, 0.10), transparent 34rem),
        linear-gradient(180deg, #ffffff 0%, #f6f9fb 100%);
}

.mp-app {
    width: min(100%, 720px);
    margin: 0 auto;
}

/* =========================================================
   Progress
   ========================================================= */

.mp-progress-area {
    margin-bottom: 1.25rem;
}

.mp-progress-text {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.65rem;
    color: #4b5563;
    font-size: 0.95rem;
    font-weight: 700;
}

.mp-progress-track {
    width: 100%;
    height: 0.8rem;
    overflow: hidden;
    border-radius: 999px;
    background: #dfe7ec;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
}

.mp-progress-bar {
    width: 5%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #159a98, #29b5b3);
    transition: width 300ms ease;
}

/* =========================================================
   Main card
   ========================================================= */

.mp-card,
.mp-results {
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 1.5rem;
    box-shadow:
        0 1.5rem 3.5rem rgba(15, 23, 42, 0.10),
        0 0.4rem 1rem rgba(15, 23, 42, 0.05);
}

.mp-card {
    min-height: 430px;
    padding: 3.25rem 3rem 2.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.mp-card-label,
.mp-results-label {
    margin: 0 0 1rem;
    color: #718096;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.mp-problem {
    margin: 0 0 2rem;
    color: #17212b;
    font-size: clamp(4.5rem, 12vw, 7.25rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.055em;
    font-variant-numeric: tabular-nums;
}

/* =========================================================
   Answer form
   ========================================================= */

.mp-answer-form {
    width: min(100%, 360px);
    margin: 0 auto;
    display: grid;
    gap: 1rem;
}

.mp-answer-input {
    width: 100%;
    min-height: 5rem;
    padding: 0.5rem 1rem;
    border: 3px solid #d7e1e7;
    border-radius: 1rem;
    background: #ffffff;
    color: #17212b;
    font-family: inherit;
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
    text-align: center;
    caret-color: #159a98;
    transition:
        border-color 160ms ease,
        box-shadow 160ms ease,
        transform 160ms ease;
    -moz-appearance: textfield;
}

.mp-answer-input::-webkit-outer-spin-button,
.mp-answer-input::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.mp-answer-input::placeholder {
    color: #aebbc4;
    opacity: 1;
}

.mp-answer-input:hover {
    border-color: #b9c8d1;
}

.mp-answer-input:focus {
    outline: none;
    border-color: #159a98;
    box-shadow: 0 0 0 0.3rem rgba(21, 154, 152, 0.15);
    transform: translateY(-1px);
}

.mp-submit-button {
    width: 100%;
    min-height: 3.65rem;
    padding: 0.85rem 1.25rem;
    border: 0;
    border-radius: 0.85rem;
    background: linear-gradient(135deg, #159a98, #22aaa7);
    color: #ffffff;
    font: inherit;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 0.75rem 1.5rem rgba(21, 154, 152, 0.22);
    transition:
        transform 160ms ease,
        box-shadow 160ms ease,
        filter 160ms ease;
}

.mp-submit-button:hover {
    filter: brightness(1.03);
    transform: translateY(-2px);
    box-shadow: 0 1rem 1.75rem rgba(21, 154, 152, 0.27);
}

.mp-submit-button:active {
    transform: translateY(0);
    box-shadow: 0 0.5rem 1rem rgba(21, 154, 152, 0.18);
}

.mp-submit-button:focus-visible {
    outline: 3px solid rgba(21, 154, 152, 0.28);
    outline-offset: 3px;
}

.mp-submit-button:disabled {
    cursor: not-allowed;
    filter: grayscale(0.35);
    opacity: 0.7;
    transform: none;
    box-shadow: none;
}

/* =========================================================
   Feedback and attempts
   ========================================================= */

.mp-feedback {
    min-height: 2rem;
    margin-top: 1.35rem;
    color: #52616b;
    font-size: 1rem;
    font-weight: 700;
}

.mp-feedback.is-correct {
    color: #14804a;
}

.mp-feedback.is-incorrect {
    color: #c0392b;
}

.mp-feedback.is-reveal {
    color: #a33d14;
}

.mp-attempts {
    margin-top: 0.35rem;
    color: #7b8790;
    font-size: 0.9rem;
    font-weight: 600;
}

.mp-attempts strong {
    color: #26323c;
}

/* These classes can be applied by JavaScript. */
.mp-card.is-correct {
    border-color: rgba(20, 128, 74, 0.35);
    box-shadow:
        0 1.5rem 3.5rem rgba(20, 128, 74, 0.11),
        0 0 0 0.28rem rgba(20, 128, 74, 0.06);
}

.mp-card.is-incorrect {
    border-color: rgba(192, 57, 43, 0.28);
    animation: mp-shake 320ms ease;
}

.mp-card.is-transitioning {
    pointer-events: none;
}

@keyframes mp-shake {
    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-6px);
    }

    75% {
        transform: translateX(6px);
    }
}

/* =========================================================
   Current-round stats
   ========================================================= */

.mp-stats {
    margin-top: 1.25rem;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
}

.mp-stat {
    min-width: 0;
    padding: 1.15rem 0.85rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.88);
    text-align: center;
    box-shadow: 0 0.5rem 1.25rem rgba(15, 23, 42, 0.05);
}

.mp-stat span {
    display: block;
    min-height: 2.5rem;
    margin-bottom: 0.4rem;
    color: #66737d;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.25;
}

.mp-stat strong {
    display: block;
    color: #17212b;
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1;
}

/* =========================================================
   Results screen
   ========================================================= */

.mp-results {
    padding: 3rem;
    text-align: center;
}

.mp-results[hidden] {
    display: none;
}

.mp-results h2 {
    margin: 0 0 2rem;
    color: #17212b;
    font-size: clamp(2rem, 7vw, 3rem);
    font-weight: 800;
}

.mp-results-grid {
    margin-bottom: 2rem;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.mp-result-item {
    padding: 1.25rem 0.8rem;
    border-radius: 1rem;
    background: #f2f7f8;
}

.mp-result-item span {
    display: block;
    min-height: 2.5rem;
    margin-bottom: 0.5rem;
    color: #64727c;
    font-size: 0.83rem;
    font-weight: 700;
    line-height: 1.25;
}

.mp-result-item strong {
    display: block;
    color: #17212b;
    font-size: 2rem;
    font-weight: 800;
}

.mp-result-accuracy {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(21, 154, 152, 0.12), rgba(41, 181, 179, 0.18));
}

.mp-result-accuracy span {
    min-height: auto;
}

.mp-result-accuracy strong {
    color: #0e7472;
    font-size: 2.5rem;
}

.mp-results .mp-submit-button {
    width: min(100%, 360px);
}

/* =========================================================
   Information section
   ========================================================= */

.mp-info {
    padding-top: 4rem;
    padding-bottom: 4rem;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
}

.mp-info article {
    padding: 1.75rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 1rem;
    background: #ffffff;
    box-shadow: 0 0.6rem 1.5rem rgba(15, 23, 42, 0.05);
}

.mp-info h2 {
    margin-bottom: 0.85rem;
    color: #17212b;
    font-size: 1.2rem;
    font-weight: 800;
}

.mp-info p {
    margin: 0;
    color: #5f6d76;
    line-height: 1.75;
}

/* =========================================================
   SEO section
   ========================================================= */

.mp-seo-section {
    padding: 5rem 0;
    background: #eef5f6;
}

.mp-seo-content {
    width: min(100%, 880px);
    margin: 0 auto;
}

.mp-seo-content h2 {
    margin-bottom: 1.25rem;
    color: #17212b;
    font-size: clamp(2rem, 5vw, 2.8rem);
    font-weight: 800;
}

.mp-seo-content h3 {
    margin-top: 2.25rem;
    margin-bottom: 0.85rem;
    color: #20303b;
    font-size: 1.4rem;
    font-weight: 800;
}

.mp-seo-content p {
    color: #56646e;
    font-size: 1.03rem;
    line-height: 1.8;
}

.mp-seo-links {
    margin-top: 2rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.25rem;
}

.mp-resource-link {
    color: #0f7f7d;
    font-weight: 700;
    text-decoration: none;
}

.mp-resource-link:hover {
    color: #0b6664;
    text-decoration: underline;
}

/* =========================================================
   Responsive design
   ========================================================= */

@media (max-width: 991.98px) {
    .mp-section {
        padding-top: 4rem;
    }

    .mp-info {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767.98px) {
    .mp-section {
        padding: 3.5rem 1rem 3rem;
    }

    .mp-card {
        min-height: 390px;
        padding: 2.5rem 1.35rem 2rem;
        border-radius: 1.25rem;
    }

    .mp-problem {
        margin-bottom: 1.75rem;
        font-size: clamp(4rem, 20vw, 5.5rem);
    }

    .mp-answer-input {
        min-height: 4.75rem;
        font-size: 2.25rem;
    }

    .mp-stats {
        grid-template-columns: 1fr;
        gap: 0.65rem;
    }

    .mp-stat {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        padding: 1rem 1.1rem;
        text-align: left;
    }

    .mp-stat span {
        min-height: auto;
        margin: 0;
        font-size: 0.88rem;
    }

    .mp-stat strong {
        flex: 0 0 auto;
        font-size: 1.5rem;
    }

    .mp-results {
        padding: 2.25rem 1.25rem;
        border-radius: 1.25rem;
    }

    .mp-results-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .mp-result-item,
    .mp-result-accuracy {
        grid-column: auto;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        text-align: left;
    }

    .mp-result-item span {
        min-height: auto;
        margin: 0;
    }

    .mp-result-item strong,
    .mp-result-accuracy strong {
        flex: 0 0 auto;
        font-size: 1.8rem;
    }

    .mp-info {
        padding-top: 3rem;
        padding-bottom: 3rem;
    }

    .mp-seo-section {
        padding: 4rem 0;
    }

    .mp-seo-links {
        align-items: stretch;
        flex-direction: column;
    }

    .mp-seo-links .btn,
    .mp-resource-link {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 420px) {
    .mp-progress-text {
        font-size: 0.86rem;
    }

    .mp-card {
        min-height: 360px;
        padding-right: 1rem;
        padding-left: 1rem;
    }

    .mp-problem {
        font-size: 4rem;
    }

    .mp-answer-input {
        font-size: 2rem;
    }

    .mp-submit-button {
        min-height: 3.5rem;
    }
}

/* =========================================================
   Accessibility and reduced motion
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
    .mp-progress-bar,
    .mp-answer-input,
    .mp-submit-button {
        transition: none;
    }

    .mp-card.is-incorrect {
        animation: none;
    }
}