.arrays-area-page {
    padding-bottom: 4rem;
}

.arrays-area-hero {
    padding: 1.5rem 0 0;
}

.arrays-area-sheet-wrap {
    margin-top: 1.5rem;
}

.arrays-area-sheet {
    position: relative;
    padding: 2rem;
    border: 4px solid #1a1a1a;
    border-radius: 26px;
    background:
        radial-gradient(circle at top left, rgba(0, 0, 0, 0.08) 0 2px, transparent 3px 100%),
        radial-gradient(circle at top right, rgba(0, 0, 0, 0.08) 0 2px, transparent 3px 100%),
        #fffdf8;
    box-shadow: 0 18px 40px rgba(23, 38, 60, 0.08);
}

.arrays-area-sheet::before {
    content: '';
    position: absolute;
    inset: -22px;
    border: 4px solid #1a1a1a;
    border-radius: 34px;
    pointer-events: none;
    opacity: 0.12;
}

.arrays-area-header {
    margin-bottom: 1.5rem;
}

.arrays-area-header h2 {
    margin-bottom: 0.55rem;
    font-size: clamp(2rem, 4vw, 3rem);
    font-family: "Trebuchet MS", "Comic Sans MS", Arial, sans-serif;
}

.arrays-area-header p {
    margin: 0;
    font-size: 1.1rem;
    color: #2d2d2d;
}

.example-card,
.steps-card {
    margin-bottom: 1.25rem;
    padding: 1.25rem;
    border-radius: 24px;
}

.example-card {
    border: 3px solid #69bdf0;
    background: linear-gradient(180deg, rgba(235, 248, 255, 0.9), rgba(255, 255, 255, 0.98));
}

.steps-card {
    border: 3px solid #f2b24d;
    background: linear-gradient(180deg, rgba(255, 245, 219, 0.95), rgba(255, 255, 255, 0.98));
}

.example-card h3,
.steps-card h3 {
    margin: 0 0 0.45rem;
    color: #1d3f69;
    font-size: 1.4rem;
}

.example-card p,
.steps-card p {
    margin: 0 0 0.9rem;
    color: #27415d;
}

.example-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    align-items: center;
}

.example-array {
    max-width: 100%;
    padding: 0.75rem;
    border: 2px dashed rgba(36, 56, 82, 0.28);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.8);
    overflow-x: auto;
    overflow-y: visible;
}

.example-work {
    display: grid;
    gap: 0.75rem;
    font-family: "Trebuchet MS", "Comic Sans MS", Arial, sans-serif;
    font-weight: 900;
    color: #1f3e69;
}

.example-equation,
.example-total {
    font-size: clamp(1.1rem, 2.2vw, 1.7rem);
    overflow-wrap: anywhere;
}

.steps-list {
    margin: 0;
    padding-left: 1.25rem;
    color: #2d2d2d;
    display: grid;
    gap: 0.45rem;
}

.worksheet-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.question-list {
    display: grid;
    gap: 1rem;
}

.array-card {
    display: grid;
    gap: 1rem;
    padding: 1.25rem;
    border: 3px solid #1a1a1a;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.97);
}

.array-card.is-correct {
    border-color: #1e7b42;
    box-shadow: inset 0 0 0 3px rgba(46, 168, 95, 0.16);
}

.array-card-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 0.45rem;
    font-family: "Trebuchet MS", "Comic Sans MS", Arial, sans-serif;
    font-size: clamp(1.3rem, 2.6vw, 2rem);
    font-weight: 900;
    color: #1f3e69;
}

.question-number {
    margin-right: 0.45rem;
}

.array-card-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    align-items: start;
}

.array-visual {
    max-width: 100%;
    padding: 0.75rem;
    border: 2px dashed rgba(36, 56, 82, 0.28);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(241, 249, 255, 0.75), rgba(255, 255, 255, 0.98));
    overflow-x: auto;
    overflow-y: visible;
}

.array-grid {
    display: inline-grid;
    gap: 2px;
    justify-content: start;
    max-width: 100%;
}

.array-cell {
    width: var(--cell-size, 18px);
    height: var(--cell-size, 18px);
    border-radius: 3px;
    border: 1px solid rgba(36, 56, 82, 0.2);
}

.array-cell.is-ten {
    background: #72c4f2;
}

.array-cell.is-ones {
    background: #f6c45c;
}

.array-key {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.75rem;
    font-size: 0.95rem;
    color: #35506d;
}

.key-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 700;
}

.key-dot {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    border: 1px solid rgba(36, 56, 82, 0.25);
}

.key-dot.is-ten {
    background: #72c4f2;
}

.key-dot.is-ones {
    background: #f6c45c;
}

.array-work {
    display: grid;
    gap: 0.85rem;
}

.array-work-label {
    font-weight: 800;
    color: #3f5b78;
}

.array-help {
    font-size: 0.98rem;
    color: #516b87;
}

.equation-row,
.subtotals-row,
.total-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-family: "Trebuchet MS", "Comic Sans MS", Arial, sans-serif;
    font-weight: 900;
    color: #1f3e69;
}

.mini-math-grid {
    display: grid;
    gap: 0.75rem;
}

.mini-math-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-family: "Trebuchet MS", "Comic Sans MS", Arial, sans-serif;
    font-weight: 900;
    color: #1f3e69;
}

.factor-display {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 68px;
    min-height: 52px;
    padding: 0 0.75rem;
    border: 3px dashed #8eb8d7;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.9);
}

.factor-display.is-empty {
    color: #89a0b8;
}

.sum-display {
    border-style: solid;
    border-color: #1f3e69;
    min-width: 78px;
}

.equation-row-part {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    padding-top: 2rem;
}

.part-chip {
    position: absolute;
    top: 0;
    left: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0.15rem 0.65rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1;
}

.part-chip.is-ten {
    background: rgba(114, 196, 242, 0.2);
    color: #216693;
}

.part-chip.is-ones {
    background: rgba(246, 196, 92, 0.2);
    color: #8a5d00;
}

.math-input {
    width: 78px;
    min-height: 52px;
    border: 3px solid #1f3e69;
    border-radius: 14px;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 900;
    color: #1f3e69;
    background: #ffffff;
}

.math-input.is-error {
    border-color: #c63d3d;
    box-shadow: 0 0 0 3px rgba(198, 61, 61, 0.12);
}

.math-input.is-correct {
    border-color: #1e7b42;
    box-shadow: 0 0 0 3px rgba(30, 123, 66, 0.12);
}

.times-chip,
.plus-chip,
.equals-chip {
    font-size: clamp(1.25rem, 2.4vw, 1.8rem);
}

.fixed-value {
    min-width: 26px;
    text-align: center;
}

.card-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
}

.card-feedback {
    min-height: 24px;
    font-weight: 800;
    color: #2d2d2d;
    text-align: center;
}

.card-feedback.is-right {
    color: #1e7b42;
}

.card-feedback.is-wrong {
    color: #a11f1f;
}

@media (max-width: 1180px) {
    .example-layout,
    .array-card-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .arrays-area-sheet {
        padding: 1rem;
    }

    .arrays-area-sheet::before {
        display: none;
    }

    .worksheet-actions,
    .card-actions {
        display: grid;
    }

    .worksheet-actions .button,
    .card-actions .button {
        width: 100%;
    }

    .math-input {
        width: 68px;
    }
}
