/* CPU 是怎样一步一步执行程序的？ */

.cpu-step-story {
    color: var(--article-text-color);
    font-size: 14px;
    line-height: 1.6;
}

.cpu-step-story * { box-sizing: border-box; }
.cpu-step-story img { display: block; max-width: 100%; }
.cpu-step-story p { margin: 0 0 12px; }
.cpu-step-story strong { color: var(--article-heading-color); }
.cpu-step-story code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.cpu-step-section {
    margin-top: 22px;
    scroll-margin-top: 110px;
}

.cpu-step-story .cpu-step-section > h2 {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0 0 8px;
    color: var(--article-heading-color);
    font-size: 20px;
    line-height: 1.35;
    font-weight: 900;
}

.cpu-step-number {
    display: inline-flex;
    flex: 0 0 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #0752ff;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
}

/* 指令类型 */

.cpu-step-instructions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 10px;
    margin-top: 14px;
}

.cpu-step-instructions article {
    min-width: 0;
    padding: 14px 9px;
    border: 1px solid #e1ebff;
    border-radius: 14px;
    background: #f9fbff;
    text-align: center;
}

.cpu-step-instructions__icon {
    display: inline-flex;
    width: 64px;
    height: 64px;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
    border-radius: 19px;
    background: #eaf3ff;
    color: #0752ff;
    font-size: 27px;
}

.cpu-step-story .cpu-step-instructions h3 {
    margin: 0 0 4px;
    color: var(--article-heading-color);
    font-size: 14px;
}

.cpu-step-instructions p {
    margin: 0;
    color: #617296;
    font-size: 10px;
}

.cpu-step-key,
.cpu-step-note,
.cpu-step-warning {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 14px;
}

.cpu-step-key { background: #eaf5ff; }

.cpu-step-key img,
.cpu-step-warning img {
    width: 54px;
    height: 54px;
    flex: 0 0 54px;
    object-fit: contain;
}

.cpu-step-story .cpu-step-key h3,
.cpu-step-story .cpu-step-note h3,
.cpu-step-story .cpu-step-warning h3 {
    margin: 0 0 4px;
    font-size: 15px;
}

.cpu-step-story .cpu-step-key h3 { color: #0752ff; }

.cpu-step-key p,
.cpu-step-note p,
.cpu-step-warning p { margin: 0; }

/* PC */

.cpu-step-pc {
    display: grid;
    grid-template-columns: 1.6fr 42px 1fr;
    gap: 10px;
    align-items: center;
    margin-top: 14px;
}

.cpu-step-pc__code,
.cpu-step-pc__register {
    min-width: 0;
    padding: 16px;
    border-radius: 15px;
}

.cpu-step-pc__code { background: #f7f8fc; }
.cpu-step-pc__register {
    background: #eef5ff;
    text-align: center;
}

.cpu-step-story .cpu-step-pc h3 {
    margin: 0 0 9px;
    color: var(--article-heading-color);
    font-size: 15px;
}

.cpu-step-pc__rows {
    display: grid;
    gap: 6px;
}

.cpu-step-pc__rows > div {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 8px;
    align-items: center;
    padding: 8px 10px;
    border-radius: 9px;
    background: #fff;
}

.cpu-step-pc__rows > div.is-current {
    border: 2px solid #4f82ff;
    background: #eef5ff;
}

.cpu-step-pc__rows span {
    color: #71809f;
    font-size: 10px;
}

.cpu-step-pc__rows code {
    color: #1f3f74;
    font-size: 12px;
    font-weight: 800;
}

.cpu-step-pc__register > span {
    display: inline-flex;
    width: 70px;
    height: 70px;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    background: #fff;
    color: #0752ff;
    font-size: 30px;
}

.cpu-step-pc__register strong {
    display: block;
    margin: 5px 0;
    color: #0752ff;
    font-size: 28px;
}

.cpu-step-pc__register p {
    margin: 0;
    color: #617296;
    font-size: 11px;
}

.cpu-step-pc__arrow,
.cpu-step-cycle__arrow,
.cpu-step-example-flow__arrow {
    color: #4f82ff;
    font-size: 24px;
    font-weight: 900;
    text-align: center;
}

.cpu-step-note { background: #fff8e5; }

.cpu-step-note__icon {
    display: inline-flex;
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    align-items: center;
    justify-content: center;
    font-size: 30px;
}

.cpu-step-story .cpu-step-note h3 { color: #9a6800; }

/* Fetch Decode Execute */

.cpu-step-cycle {
    display: grid;
    grid-template-columns: 1fr 24px 1fr 24px 1fr 24px 1fr;
    gap: 5px;
    align-items: center;
    margin-top: 14px;
}

.cpu-step-cycle article {
    position: relative;
    min-width: 0;
    min-height: 205px;
    padding: 14px 8px;
    border: 1px solid #e1ebff;
    border-radius: 14px;
    background: #f9fbff;
    text-align: center;
}

.cpu-step-cycle__badge,
.cpu-step-example-flow__badge {
    position: absolute;
    top: 9px;
    left: 9px;
    display: inline-flex;
    width: 26px;
    height: 26px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #0752ff;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}

.cpu-step-cycle__icon {
    display: flex;
    width: 64px;
    height: 64px;
    align-items: center;
    justify-content: center;
    margin: 12px auto 7px;
    border-radius: 19px;
    background: #eaf3ff;
    color: #0752ff;
    font-size: 27px;
}

.cpu-step-story .cpu-step-cycle h3 {
    margin: 0 0 4px;
    color: var(--article-heading-color);
    font-size: 13px;
}

.cpu-step-cycle p {
    margin: 0;
    color: #607296;
    font-size: 10px;
}

.cpu-step-warning {
    border: 1px solid #ffd0dc;
    background: #fff2f6;
}

.cpu-step-story .cpu-step-warning h3 { color: #d83265; }

/* 存储层次 */

.cpu-step-hierarchy {
    display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: 10px;
    margin-top: 14px;
}

.cpu-step-hierarchy > div {
    min-width: 0;
    padding: 14px 9px;
    border-radius: 14px;
    text-align: center;
}

.cpu-step-hierarchy__register { background: #fff6df; }
.cpu-step-hierarchy__cache { background: #eef9f0; }
.cpu-step-hierarchy__ram { background: #f3efff; }
.cpu-step-hierarchy__storage { background: #eef5ff; }

.cpu-step-hierarchy > div > span,
.cpu-step-hierarchy__storage img {
    width: 64px;
    height: 64px;
    margin: 0 auto 7px;
}

.cpu-step-hierarchy > div > span {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 19px;
    background: #fff;
    font-size: 27px;
}

.cpu-step-hierarchy__register > span { color: #d58d00; }
.cpu-step-hierarchy__cache > span { color: #2a9b55; }
.cpu-step-hierarchy__ram > span { color: #7654d6; }

.cpu-step-hierarchy__storage img { object-fit: contain; }

.cpu-step-story .cpu-step-hierarchy h3 {
    margin: 0 0 4px;
    color: var(--article-heading-color);
    font-size: 14px;
}

.cpu-step-hierarchy p {
    margin: 0;
    color: #617296;
    font-size: 10px;
}

.cpu-step-note--desk { background: #eef9f0; }

/* 分支与循环 */

.cpu-step-branch {
    display: grid;
    grid-template-columns: 1fr 1.7fr;
    gap: 12px;
    align-items: center;
    margin-top: 14px;
}

.cpu-step-branch__condition {
    display: flex;
    min-height: 175px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 13px;
    border-radius: 15px;
    background: #fff6df;
    text-align: center;
}

.cpu-step-branch__condition > span {
    color: #d58d00;
    font-size: 58px;
}

.cpu-step-story .cpu-step-branch__condition h3 {
    margin: 7px 0 4px;
    color: var(--article-heading-color);
    font-size: 15px;
}

.cpu-step-branch__condition p {
    margin: 0;
    color: #617296;
    font-size: 11px;
}

.cpu-step-branch__split {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 10px;
}

.cpu-step-branch__yes,
.cpu-step-branch__no {
    display: flex;
    min-height: 115px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    border-radius: 14px;
    text-align: center;
}

.cpu-step-branch__yes { background: #eef9f0; }
.cpu-step-branch__no { background: #fff2f5; }

.cpu-step-branch__split strong {
    font-size: 18px;
}

.cpu-step-branch__yes strong { color: #24944d; }
.cpu-step-branch__no strong { color: #df4d74; }

.cpu-step-branch__split span {
    margin-top: 4px;
    color: #617296;
    font-size: 11px;
}

.cpu-step-loop {
    display: flex;
    gap: 11px;
    align-items: center;
    margin-top: 12px;
    padding: 13px 15px;
    border-radius: 14px;
    background: #f3efff;
}

.cpu-step-loop > span {
    color: #7654d6;
    font-size: 28px;
}

.cpu-step-loop p { margin: 0; }

.cpu-step-key--branch { background: #eaf5ff; }

/* 现代 CPU */

.cpu-step-modern {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 10px;
    margin-top: 14px;
}

.cpu-step-modern article {
    min-width: 0;
    padding: 15px;
    border: 1px solid #e1ebff;
    border-radius: 14px;
    background: #f9fbff;
}

.cpu-step-modern article > span {
    display: inline-flex;
    width: 56px;
    height: 56px;
    align-items: center;
    justify-content: center;
    margin-bottom: 7px;
    border-radius: 17px;
    background: #eaf3ff;
    color: #0752ff;
    font-size: 24px;
}

.cpu-step-story .cpu-step-modern h3 {
    margin: 0 0 4px;
    color: var(--article-heading-color);
    font-size: 14px;
}

.cpu-step-modern p {
    margin: 0;
    color: #617296;
    font-size: 11px;
}

/* 示例 */

.cpu-step-example-code {
    display: grid;
    gap: 7px;
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 14px;
    background: #f7f8fc;
}

.cpu-step-example-code code {
    padding: 8px 10px;
    border-radius: 8px;
    background: #fff;
    color: #183b72;
    font-size: 13px;
    font-weight: 700;
}

.cpu-step-example-flow {
    display: grid;
    grid-template-columns: 1fr 18px 1fr 18px 1fr 18px 1fr 18px 1fr;
    gap: 4px;
    align-items: center;
    margin-top: 12px;
}

.cpu-step-example-flow article {
    position: relative;
    min-width: 0;
    min-height: 150px;
    padding: 14px 8px;
    border: 1px solid #e1ebff;
    border-radius: 13px;
    background: #f9fbff;
    text-align: center;
}

.cpu-step-story .cpu-step-example-flow h3 {
    margin: 26px 0 4px;
    color: var(--article-heading-color);
    font-size: 12px;
}

.cpu-step-example-flow p {
    margin: 0;
    color: #607296;
    font-size: 9px;
}

.cpu-step-note--example { background: #fff8e5; }

/* 总结 */

.cpu-step-summary {
    display: flex;
    gap: 12px;
    margin-top: 22px;
    padding: 18px;
    border-radius: 16px;
    background: #e9f3ff;
    scroll-margin-top: 110px;
}

.cpu-step-summary__icon {
    width: 54px;
    height: 54px;
    flex: 0 0 54px;
    object-fit: contain;
}

.cpu-step-story .cpu-step-summary h2 {
    margin: 0 0 7px;
    color: #0752ff;
    font-size: 19px;
}

.cpu-step-summary ul {
    margin: 0;
    padding-left: 20px;
    line-height: 1.75;
}

.cpu-step-summary__next {
    margin: 10px 0 0 !important;
    padding-top: 10px;
    border-top: 1px dashed #b8d3f6;
}

.cpu-step-summary__next em {
    color: #0752ff;
    font-style: normal;
    font-weight: 800;
}

/* 翻页 */

.cpu-step-pagination {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-top: 14px;
}

.cpu-step-pagination a {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 49%;
    padding: 10px 13px;
    border: 1px solid #d9e7ff;
    border-radius: 12px;
    background: #ffffffb3;
    text-decoration: none;
    box-shadow: 0 3px 10px #c5dbff30;
}

.cpu-step-pagination a:last-child { text-align: right; }

.cpu-step-pagination strong {
    display: block;
    color: #0752ff;
    font-size: 16px;
}

.cpu-step-pagination small {
    display: block;
    color: #576b9f;
    font-size: 12px;
}

.cpu-step-pagination__arrow {
    display: inline-flex;
    width: 31px;
    height: 31px;
    flex: 0 0 31px;
    align-items: center;
    justify-content: center;
    border: 1px solid #d9e7ff;
    border-radius: 7px;
    color: #0752ff;
    font-size: 22px;
}

.cpu-step-pagination a:hover { background: #edf4ff; }

.cpu-step-pagination a:focus-visible {
    outline: 3px solid #0752ff;
    outline-offset: 3px;
}

@media (max-width: 900px) {
    .cpu-step-cycle {
        grid-template-columns: repeat(2,minmax(0,1fr));
        gap: 9px;
    }

    .cpu-step-cycle > .cpu-step-cycle__arrow { display: none; }

    .cpu-step-example-flow {
        grid-template-columns: repeat(2,minmax(0,1fr));
        gap: 9px;
    }

    .cpu-step-example-flow > .cpu-step-example-flow__arrow { display: none; }
}

@media (max-width: 640px) {
    .cpu-step-story {
        font-size: 12px;
        line-height: 1.6;
    }

    .cpu-step-section { margin-top: 18px; }

    .cpu-step-story .cpu-step-section > h2 {
        gap: 9px;
        margin-bottom: 6px;
        font-size: 16px;
    }

    .cpu-step-number {
        flex-basis: 31px;
        height: 31px;
        font-size: 14px;
    }

    .cpu-step-instructions,
    .cpu-step-hierarchy {
        grid-template-columns: repeat(2,minmax(0,1fr));
        gap: 8px;
    }

    .cpu-step-pc,
    .cpu-step-cycle,
    .cpu-step-branch,
    .cpu-step-example-flow {
        grid-template-columns: minmax(0,1fr);
        gap: 7px;
    }

    .cpu-step-pc__arrow,
    .cpu-step-cycle > .cpu-step-cycle__arrow,
    .cpu-step-example-flow > .cpu-step-example-flow__arrow {
        display: block;
        transform: rotate(90deg);
        line-height: 1;
    }

    .cpu-step-key,
    .cpu-step-note,
    .cpu-step-warning {
        gap: 9px;
        padding: 11px 12px;
    }

    .cpu-step-key img,
    .cpu-step-warning img,
    .cpu-step-note__icon {
        width: 44px;
        height: 44px;
        flex-basis: 44px;
    }

    .cpu-step-cycle article,
    .cpu-step-example-flow article {
        min-height: auto;
        padding: 12px 9px;
    }

    .cpu-step-branch__split,
    .cpu-step-modern {
        grid-template-columns: minmax(0,1fr);
        gap: 8px;
    }

    .cpu-step-summary {
        gap: 8px;
        padding: 14px;
    }

    .cpu-step-summary__icon {
        width: 44px;
        height: 44px;
        flex-basis: 44px;
    }

    .cpu-step-story .cpu-step-summary h2 { font-size: 17px; }

    .cpu-step-pagination { gap: 9px; }

    .cpu-step-pagination a {
        flex: 1;
        min-width: 0;
        gap: 5px;
        padding: 8px 6px;
    }

    .cpu-step-pagination strong { font-size: 13px; }

    .cpu-step-pagination small {
        font-size: 10px;
        line-height: 1.35;
    }

    .cpu-step-pagination__arrow {
        width: 26px;
        height: 27px;
        flex-basis: 26px;
        font-size: 18px;
    }
}
