/* =========================================================
   Rounding Decimals
   Page-specific styles for:
   /interactive-learning-tools/rounding-decimals/
   ========================================================= */

.rounding-decimals-page {
    background: #f7f9fc;
    color: #1f2933;
    font-family: "Inter", sans-serif;
}

.rounding-decimals-page main {
    overflow-x: clip;
    overflow-y: visible;
}

.rounding-decimals-page *,
.rounding-decimals-page *::before,
.rounding-decimals-page *::after {
    box-sizing: border-box;
}

.rounding-decimals-page [hidden] {
    display: none !important;
}


/* =========================================================
   Shared sections
   ========================================================= */

.rounding-decimals-overview,
.rounding-decimals-practice-section,
.rounding-decimals-reminders,
.rounding-decimals-final-cta {
    padding: 5rem 0;
}

.rounding-decimals-overview,
.rounding-decimals-reminders {
    background: #ffffff;
}

.rounding-decimals-practice-section {
    background:
        radial-gradient(
            circle at top left,
            rgba(20, 184, 166, 0.09),
            transparent 34rem
        ),
        linear-gradient(
            180deg,
            #f7fafc 0%,
            #edf3f7 100%
        );
}

.rounding-decimals-final-cta {
    background: #f3f7fa;
}

.rounding-decimals-section-heading {
    max-width: 760px;
    margin: 0 auto 2.5rem;
    text-align: center;
}

.rounding-decimals-section-heading h2,
.rounding-decimals-tool-header h2,
.rounding-decimals-final-cta-card h2 {
    margin-bottom: 1rem;
    color: #101827;
    font-size: clamp(1.8rem, 4vw, 2.55rem);
    font-weight: 800;
    letter-spacing: -0.035em;
}

.rounding-decimals-section-heading > p:last-child {
    margin: 0;
    color: #5f6c7b;
    font-size: 1.05rem;
    line-height: 1.75;
}

.rounding-decimals-eyebrow {
    margin-bottom: 0.6rem;
    color: #137f79;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}


/* =========================================================
   Overview
   ========================================================= */

.rounding-decimals-overview-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    max-width: 1180px;
    margin: 0 auto;
}

.rounding-decimals-overview-card {
    position: relative;
    min-height: 100%;
    border: 1px solid #dce5eb;
    border-radius: 1.15rem;
    background: #ffffff;
    padding: 1.55rem;
    box-shadow: 0 0.5rem 1.4rem rgba(15, 23, 42, 0.05);
}

.rounding-decimals-overview-card h3 {
    margin-bottom: 0.7rem;
    color: #17212b;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.35;
}

.rounding-decimals-overview-card p {
    margin: 0;
    color: #667384;
    font-size: 0.92rem;
    line-height: 1.65;
}

.rounding-decimals-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.6rem;
    height: 2.6rem;
    margin-bottom: 1rem;
    border-radius: 0.8rem;
    background: #e8f8f5;
    color: #137f79;
    font-size: 1rem;
    font-weight: 800;
}


/* =========================================================
   Main tool shell
   ========================================================= */

.rounding-decimals-tool {
    max-width: 1180px;
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid #d8e2e9;
    border-radius: 1.5rem;
    background: #ffffff;
    box-shadow:
        0 1.7rem 4rem rgba(15, 23, 42, 0.12),
        0 0.4rem 1rem rgba(15, 23, 42, 0.05);
}

.rounding-decimals-tool-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    background: #101827;
    color: #ffffff;
    padding: 2rem 2.4rem;
}

.rounding-decimals-tool-header h2 {
    margin: 0;
    color: #ffffff;
}

.rounding-decimals-tool-header .rounding-decimals-eyebrow {
    color: #5eead4;
}


/* =========================================================
   Scoreboard
   ========================================================= */

.rounding-decimals-scoreboard {
    display: grid;
    grid-template-columns: repeat(3, minmax(90px, 1fr));
    gap: 0.75rem;
    flex-shrink: 0;
}

.rounding-decimals-score-item {
    min-width: 96px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 0.9rem;
    background: rgba(255, 255, 255, 0.07);
    padding: 0.8rem 1rem;
    text-align: center;
}

.rounding-decimals-score-label {
    display: block;
    margin-bottom: 0.25rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.rounding-decimals-score-item strong {
    color: #ffffff;
    font-size: 1.45rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}


/* =========================================================
   Settings
   ========================================================= */

.rounding-decimals-settings {
    display: grid;
    grid-template-columns:
        minmax(220px, 1.15fr)
        minmax(210px, 1fr)
        auto
        auto;
    gap: 1rem;
    align-items: end;
    border-bottom: 1px solid #dce5eb;
    background: #f6f8fb;
    padding: 1.5rem 2.4rem;
}

.rounding-decimals-setting-group label {
    display: block;
    margin-bottom: 0.45rem;
    color: #263448;
    font-size: 0.84rem;
    font-weight: 800;
}

.rounding-decimals-settings .form-select {
    min-height: 3.15rem;
    border: 1px solid #cbd8df;
    border-radius: 0.8rem;
    background-color: #ffffff;
    color: #354154;
    padding-left: 0.9rem;
    font-size: 0.92rem;
    font-weight: 600;
}

.rounding-decimals-settings .form-select:focus {
    border-color: #13857f;
    box-shadow: 0 0 0 0.22rem rgba(19, 133, 127, 0.13);
}

.rounding-decimals-settings .btn {
    min-height: 3.15rem;
    white-space: nowrap;
}


/* =========================================================
   Problem display
   ========================================================= */

.rounding-decimals-problem-area {
    border-bottom: 1px solid #dce5eb;
    background:
        linear-gradient(
            135deg,
            #f0fcf9 0%,
            #ffffff 72%
        );
    padding: 2.5rem 2.4rem;
    text-align: center;
}

.rounding-decimals-problem-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.rounding-decimals-problem-label {
    margin: 0;
    color: #137f79;
    font-size: 0.83rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.rounding-decimals-difficulty-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #dbeafe;
    color: #1e40af;
    padding: 0.35rem 0.7rem;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.rounding-decimals-difficulty-badge.easy {
    background: #dcfce7;
    color: #166534;
}

.rounding-decimals-difficulty-badge.medium {
    background: #dbeafe;
    color: #1e40af;
}

.rounding-decimals-difficulty-badge.hard {
    background: #ffedd5;
    color: #9a3412;
}

.rounding-decimals-problem-number {
    margin-bottom: 1rem;
    color: #101827;
    font-size: clamp(4rem, 11vw, 7.25rem);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.055em;
    line-height: 1;
}

.rounding-decimals-problem-instruction {
    margin: 0;
    color: #5f6c7b;
    font-size: 1.05rem;
    font-weight: 600;
}


/* =========================================================
   Workspace
   ========================================================= */

.rounding-decimals-workspace {
    display: grid;
    gap: 1.25rem;
    padding: 2rem 2.4rem 2.5rem;
}

.rounding-decimals-place-value-card,
.rounding-decimals-number-line-card,
.rounding-decimals-decision-card,
.rounding-decimals-answer-card {
    border: 1px solid #d9e4ea;
    border-radius: 1.1rem;
    background: #ffffff;
    padding: 1.6rem;
}

.rounding-decimals-place-value-card {
    background:
        linear-gradient(
            135deg,
            rgba(232, 248, 245, 0.7),
            #ffffff 68%
        );
}

.rounding-decimals-card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.35rem;
}

.rounding-decimals-card-heading h3 {
    margin: 0;
    color: #17212b;
    font-size: 1.25rem;
    font-weight: 800;
}

.rounding-decimals-card-label {
    margin: 0 0 0.35rem;
    color: #137f79;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}


/* =========================================================
   Place-value visual
   ========================================================= */

.rounding-decimals-digit-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.85rem;
}

.rounding-decimals-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #5f6c7b;
    font-size: 0.75rem;
    font-weight: 700;
}

.rounding-decimals-legend-swatch {
    display: inline-block;
    width: 0.9rem;
    height: 0.9rem;
    border-radius: 0.25rem;
}

.rounding-decimals-legend-swatch.target {
    background: #137f79;
}

.rounding-decimals-legend-swatch.deciding {
    background: #f59e0b;
}

.rounding-decimals-place-value-grid {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0.55rem;
    width: 100%;
    overflow-x: auto;
    padding: 0.5rem 0 0.8rem;
}

.rounding-decimals-digit-cell {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    min-width: 90px;
    min-height: 108px;
    border: 2px solid #d5e1e7;
    border-radius: 0.9rem;
    background: #ffffff;
    padding: 0.75rem 0.65rem;
    transition:
        border-color 180ms ease,
        background-color 180ms ease,
        transform 180ms ease,
        box-shadow 180ms ease;
}

.rounding-decimals-place-label {
    display: block;
    margin-bottom: 0.45rem;
    color: #6b7787;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.rounding-decimals-digit-cell strong {
    color: #101827;
    font-size: 2.25rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.rounding-decimals-digit-cell.target {
    border-color: #137f79;
    background: #e8f8f5;
    box-shadow: 0 0 0 0.25rem rgba(19, 127, 121, 0.11);
    transform: translateY(-4px);
}

.rounding-decimals-digit-cell.target .rounding-decimals-place-label,
.rounding-decimals-digit-cell.target strong {
    color: #116b66;
}

.rounding-decimals-digit-cell.deciding {
    border-color: #f59e0b;
    background: #fffbeb;
    box-shadow: 0 0 0 0.25rem rgba(245, 158, 11, 0.1);
    transform: translateY(-4px);
}

.rounding-decimals-digit-cell.deciding .rounding-decimals-place-label,
.rounding-decimals-digit-cell.deciding strong {
    color: #a65308;
}

.rounding-decimals-decimal-point {
    flex: 0 0 24px;
    padding-bottom: 0.65rem;
    color: #101827;
    font-size: 2.65rem;
    font-weight: 800;
    line-height: 1;
    text-align: center;
}

.rounding-decimals-place-value-instruction {
    margin: 0.7rem 0 0;
    color: #536172;
    font-size: 0.94rem;
    font-weight: 600;
    line-height: 1.6;
    text-align: center;
}


/* =========================================================
   Number-line visual
   ========================================================= */

.rounding-decimals-number-line-card {
    background: #fbfcfe;
}

.rounding-decimals-number-line-instruction {
    max-width: 360px;
    margin: 0;
    color: #637083;
    font-size: 0.88rem;
    line-height: 1.55;
    text-align: right;
}

.rounding-decimals-number-line {
    border: 1px solid #dce5eb;
    border-radius: 1rem;
    background:
        linear-gradient(
            180deg,
            #ffffff 0%,
            #f7fafc 100%
        );
    padding: 4.4rem 2.2rem 1.4rem;
}

.rounding-decimals-number-line-track {
    position: relative;
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: #334155;
}

.rounding-decimals-number-line-tick {
    position: absolute;
    top: 50%;
    width: 3px;
    height: 1.55rem;
    border-radius: 999px;
    background: #334155;
    transform: translate(-50%, -50%);
}

.rounding-decimals-number-line-tick.start {
    left: 0;
}

.rounding-decimals-number-line-tick.midpoint {
    left: 50%;
    height: 1.8rem;
    background: #d97706;
}

.rounding-decimals-number-line-tick.end {
    left: 100%;
}

.rounding-decimals-number-line-marker {
    position: absolute;
    top: 50%;
    left: var(--marker-position, 50%);
    width: 1.2rem;
    height: 1.2rem;
    border: 3px solid #ffffff;
    border-radius: 50%;
    background: #13857f;
    box-shadow:
        0 0 0 3px rgba(19, 133, 127, 0.19),
        0 0.3rem 0.8rem rgba(15, 23, 42, 0.18);
    transform: translate(-50%, -50%);
    transition: left 300ms ease;
}

.rounding-decimals-number-line-marker::after {
    position: absolute;
    bottom: 100%;
    left: 50%;
    width: 2px;
    height: 1.45rem;
    background: #13857f;
    content: "";
    transform: translateX(-50%);
}

.rounding-decimals-number-line-marker span {
    position: absolute;
    bottom: calc(100% + 1.8rem);
    left: 50%;
    border-radius: 0.55rem;
    background: #101827;
    color: #ffffff;
    padding: 0.38rem 0.55rem;
    font-size: 0.76rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    transform: translateX(-50%);
}

.rounding-decimals-number-line-labels {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin-top: 1rem;
    color: #344054;
    font-size: 0.87rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.rounding-decimals-number-line-labels span:first-child {
    text-align: left;
}

.rounding-decimals-number-line-labels span:nth-child(2) {
    color: #a65308;
    text-align: center;
}

.rounding-decimals-number-line-labels span:last-child {
    text-align: right;
}


/* =========================================================
   Rounding decision
   ========================================================= */

.rounding-decimals-decision-instruction {
    margin: 0 0 1.15rem;
    color: #5f6c7b;
    line-height: 1.65;
}

.rounding-decimals-decision-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.rounding-decimals-decision-button {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 88px;
    border: 2px solid #d6e1e7;
    border-radius: 1rem;
    background: #ffffff;
    color: #263448;
    padding: 1rem 1.15rem;
    text-align: left;
    transition:
        border-color 180ms ease,
        background-color 180ms ease,
        color 180ms ease,
        transform 180ms ease,
        box-shadow 180ms ease;
}

.rounding-decimals-decision-button:hover {
    border-color: #13857f;
    background: #f1fbf9;
    transform: translateY(-2px);
}

.rounding-decimals-decision-button:active {
    transform: translateY(0);
}

.rounding-decimals-decision-button > span:last-child {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    color: #667384;
    font-size: 0.82rem;
    font-weight: 600;
}

.rounding-decimals-decision-button strong {
    color: #17212b;
    font-size: 1rem;
    font-weight: 800;
}

.rounding-decimals-decision-icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 3.4rem;
    height: 3.4rem;
    border-radius: 0.85rem;
    background: #e8f8f5;
    color: #137f79;
    font-size: 0.92rem;
    font-weight: 800;
}

.rounding-decimals-decision-button.is-selected {
    border-color: #13857f;
    background: #edf9f7;
    box-shadow: 0 0 0 0.25rem rgba(19, 133, 127, 0.1);
}

.rounding-decimals-decision-button.is-selected .rounding-decimals-decision-icon {
    background: #13857f;
    color: #ffffff;
}

.rounding-decimals-decision-button.is-correct {
    border-color: #16a34a;
    background: #f0fdf4;
}

.rounding-decimals-decision-button.is-incorrect {
    border-color: #dc2626;
    background: #fef2f2;
}

.rounding-decimals-decision-button:disabled {
    cursor: not-allowed;
    opacity: 0.72;
    transform: none;
}

.rounding-decimals-decision-feedback {
    margin-top: 1rem;
    border-radius: 0.8rem;
    padding: 0.9rem 1rem;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.55;
}

.rounding-decimals-decision-feedback.success {
    background: #f0fdf4;
    color: #166534;
}

.rounding-decimals-decision-feedback.error {
    background: #fef2f2;
    color: #991b1b;
}

.rounding-decimals-decision-feedback.info {
    background: #eff6ff;
    color: #1e40af;
}


/* =========================================================
   Answer area
   ========================================================= */

.rounding-decimals-answer-card {
    background:
        linear-gradient(
            135deg,
            #f8fafc,
            #ffffff 72%
        );
}

.rounding-decimals-answer-form > label {
    display: block;
    margin-bottom: 0.5rem;
    color: #263448;
    font-size: 0.84rem;
    font-weight: 800;
}

.rounding-decimals-answer-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.85rem;
    align-items: stretch;
}

.rounding-decimals-answer-input {
    min-height: 3.55rem;
    border: 2px solid #c8d7de;
    border-radius: 0.9rem;
    background: #ffffff;
    color: #101827;
    padding: 0.7rem 1rem;
    font-size: 1.2rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.rounding-decimals-answer-input:focus {
    border-color: #13857f;
    box-shadow: 0 0 0 0.25rem rgba(19, 133, 127, 0.13);
}

.rounding-decimals-answer-input.is-correct {
    border-color: #16a34a;
    background: #f0fdf4;
}

.rounding-decimals-answer-input.is-incorrect {
    border-color: #dc2626;
    background: #fef2f2;
}

.rounding-decimals-answer-row .btn {
    min-width: 145px;
}

.rounding-decimals-feedback {
    margin-top: 1rem;
    border-radius: 0.85rem;
    padding: 1rem 1.1rem;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.6;
}

.rounding-decimals-feedback.success {
    border: 1px solid #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.rounding-decimals-feedback.error {
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.rounding-decimals-feedback.info {
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1e40af;
}


/* =========================================================
   Hint
   ========================================================= */

.rounding-decimals-hint-button {
    display: block;
    margin: 1.15rem auto 0;
    border: 0;
    background: transparent;
    color: #137f79;
    padding: 0.35rem;
    font-size: 0.88rem;
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 0.22rem;
}

.rounding-decimals-hint-button:hover,
.rounding-decimals-hint-button:focus-visible {
    color: #0f625e;
}

.rounding-decimals-hint {
    margin-top: 1rem;
    border-left: 4px solid #f59e0b;
    border-radius: 0.8rem;
    background: #fffbeb;
    color: #7c4608;
    padding: 1rem 1.1rem;
    font-size: 0.9rem;
    line-height: 1.65;
}

.rounding-decimals-hint p:last-child {
    margin-bottom: 0;
}


/* =========================================================
   Completion
   ========================================================= */

.rounding-decimals-completion {
    border: 1px solid #bcebd0;
    border-radius: 1.15rem;
    background:
        radial-gradient(
            circle at top center,
            rgba(34, 197, 94, 0.12),
            transparent 20rem
        ),
        #f0fdf4;
    padding: 2rem;
    text-align: center;
}

.rounding-decimals-completion-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.8rem;
    height: 3.8rem;
    margin-bottom: 1rem;
    border-radius: 50%;
    background: #16a34a;
    color: #ffffff;
    font-size: 1.7rem;
    font-weight: 800;
    box-shadow: 0 0.6rem 1.2rem rgba(22, 163, 74, 0.2);
}

.rounding-decimals-completion h3 {
    margin-bottom: 0.45rem;
    color: #14532d;
    font-size: 1.5rem;
    font-weight: 800;
}

.rounding-decimals-completion > p {
    color: #3f6d4d;
}

.rounding-decimals-final-equation {
    max-width: 520px;
    margin: 1.25rem auto;
    border-radius: 0.9rem;
    background: #101827;
    color: #ffffff;
    padding: 1rem 1.25rem;
    font-size: clamp(1.45rem, 4vw, 2rem);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.rounding-decimals-completion-explanation {
    max-width: 680px;
    margin: 0 auto 1.4rem;
    color: #41664b;
    line-height: 1.7;
}


/* =========================================================
   Reminder cards
   ========================================================= */

.rounding-decimals-reminders-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    max-width: 1180px;
    margin: 0 auto;
}

.rounding-decimals-reminder-card {
    border: 1px solid #dce5eb;
    border-top: 4px solid #13857f;
    border-radius: 1.05rem;
    background: #ffffff;
    padding: 1.45rem;
    box-shadow: 0 0.45rem 1.2rem rgba(15, 23, 42, 0.04);
}

.rounding-decimals-reminder-card:nth-child(2) {
    border-top-color: #2563eb;
}

.rounding-decimals-reminder-card:nth-child(3) {
    border-top-color: #f59e0b;
}

.rounding-decimals-reminder-card:nth-child(4) {
    border-top-color: #7c3aed;
}

.rounding-decimals-reminder-card h3 {
    margin-bottom: 0.7rem;
    color: #17212b;
    font-size: 1.02rem;
    font-weight: 800;
    line-height: 1.4;
}

.rounding-decimals-reminder-card p {
    margin-bottom: 1rem;
    color: #667384;
    font-size: 0.9rem;
    line-height: 1.65;
}

.rounding-decimals-example {
    border-radius: 0.7rem;
    background: #f2f6f8;
    color: #263448;
    padding: 0.7rem;
    font-size: 1rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    text-align: center;
}


/* =========================================================
   Final CTA
   ========================================================= */

.rounding-decimals-final-cta-card {
    max-width: 920px;
    margin: 0 auto;
    border-radius: 1.4rem;
    background:
        radial-gradient(
            circle at top right,
            rgba(45, 212, 191, 0.18),
            transparent 22rem
        ),
        #101827;
    color: #ffffff;
    padding: 2.5rem;
    text-align: center;
    box-shadow: 0 1.4rem 3rem rgba(15, 23, 42, 0.14);
}

.rounding-decimals-final-cta-card .rounding-decimals-eyebrow {
    color: #5eead4;
}

.rounding-decimals-final-cta-card h2 {
    color: #ffffff;
}

.rounding-decimals-final-cta-card p:not(.rounding-decimals-eyebrow) {
    max-width: 690px;
    margin: 0 auto 1.5rem;
    color: rgba(255, 255, 255, 0.78);
    line-height: 1.75;
}


/* =========================================================
   Keyboard focus
   ========================================================= */

.rounding-decimals-page button:focus-visible,
.rounding-decimals-page select:focus-visible,
.rounding-decimals-page input:focus-visible,
.rounding-decimals-page a:focus-visible {
    outline: 3px solid rgba(20, 184, 166, 0.34);
    outline-offset: 3px;
}


/* =========================================================
   Tablet
   ========================================================= */

@media (max-width: 991.98px) {
    .rounding-decimals-overview-grid,
    .rounding-decimals-reminders-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .rounding-decimals-tool-header {
        align-items: flex-start;
    }

    .rounding-decimals-settings {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .rounding-decimals-settings .btn {
        width: 100%;
    }

    .rounding-decimals-card-heading {
        flex-direction: column;
        gap: 0.8rem;
    }

    .rounding-decimals-digit-legend {
        justify-content: flex-start;
    }

    .rounding-decimals-number-line-instruction {
        max-width: none;
        text-align: left;
    }
}


/* =========================================================
   Mobile
   ========================================================= */

@media (max-width: 767.98px) {
    .rounding-decimals-overview,
    .rounding-decimals-practice-section,
    .rounding-decimals-reminders,
    .rounding-decimals-final-cta {
        padding: 3.5rem 0;
    }

    .rounding-decimals-tool {
        border-radius: 1.1rem;
    }

    .rounding-decimals-tool-header {
        flex-direction: column;
        gap: 1.4rem;
        padding: 1.6rem;
    }

    .rounding-decimals-scoreboard {
        width: 100%;
    }

    .rounding-decimals-score-item {
        min-width: 0;
        padding: 0.7rem 0.5rem;
    }

    .rounding-decimals-settings {
        padding: 1.25rem 1.4rem;
    }

    .rounding-decimals-problem-area {
        padding: 2rem 1.4rem;
    }

    .rounding-decimals-problem-number {
        font-size: clamp(3.5rem, 18vw, 5.25rem);
    }

    .rounding-decimals-workspace {
        padding: 1.4rem;
    }

    .rounding-decimals-place-value-card,
    .rounding-decimals-number-line-card,
    .rounding-decimals-decision-card,
    .rounding-decimals-answer-card {
        padding: 1.25rem;
    }

    .rounding-decimals-place-value-grid {
        justify-content: flex-start;
    }

    .rounding-decimals-number-line {
        padding-right: 1.4rem;
        padding-left: 1.4rem;
    }

    .rounding-decimals-decision-buttons {
        grid-template-columns: 1fr;
    }

    .rounding-decimals-answer-row {
        grid-template-columns: 1fr;
    }

    .rounding-decimals-answer-row .btn {
        width: 100%;
    }

    .rounding-decimals-final-cta-card {
        padding: 2rem 1.4rem;
    }
}


/* =========================================================
   Small mobile
   ========================================================= */

@media (max-width: 575.98px) {
    .rounding-decimals-overview-grid,
    .rounding-decimals-reminders-grid,
    .rounding-decimals-settings {
        grid-template-columns: 1fr;
    }

    .rounding-decimals-scoreboard {
        gap: 0.45rem;
    }

    .rounding-decimals-score-label {
        font-size: 0.62rem;
    }

    .rounding-decimals-score-item strong {
        font-size: 1.25rem;
    }

    .rounding-decimals-problem-header {
        flex-direction: column;
        gap: 0.5rem;
    }

    .rounding-decimals-digit-cell {
        min-width: 76px;
        min-height: 96px;
    }

    .rounding-decimals-digit-cell strong {
        font-size: 1.9rem;
    }

    .rounding-decimals-place-label {
        font-size: 0.6rem;
    }

    .rounding-decimals-number-line {
        padding-top: 4rem;
    }

    .rounding-decimals-number-line-marker span {
        font-size: 0.68rem;
    }

    .rounding-decimals-number-line-labels {
        font-size: 0.75rem;
    }

    .rounding-decimals-completion {
        padding: 1.5rem 1rem;
    }
}


/* =========================================================
   Reduced motion
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
    .rounding-decimals-digit-cell,
    .rounding-decimals-decision-button,
    .rounding-decimals-number-line-marker {
        transition: none;
    }
}

/* =========================================================
   Final-answer problem reference
   ========================================================= */

.rounding-decimals-answer-reference {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    border: 1px solid #b9e1dc;
    border-radius: 0.95rem;
    background: #effaf8;
    padding: 0.9rem 1.1rem;
}

.rounding-decimals-answer-reference-label {
    color: #137f79;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.rounding-decimals-answer-reference strong {
    color: #101827;
    font-size: 1.75rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.rounding-decimals-answer-reference-target {
    border-left: 1px solid #b9e1dc;
    color: #536172;
    padding-left: 1rem;
    font-size: 0.85rem;
    font-weight: 700;
}

@media (max-width: 575.98px) {
    .rounding-decimals-answer-reference {
        flex-direction: column;
        gap: 0.45rem;
        text-align: center;
    }

    .rounding-decimals-answer-reference-target {
        border-left: 0;
        padding-left: 0;
    }
}