/* CPU 是怎么工作的？ */

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

.cpu-story * {
    box-sizing: border-box;
}

.cpu-story img {
    display: block;
    max-width: 100%;
}

.cpu-story p {
    margin: 0 0 12px;
}

.cpu-story strong {
    color: var(--article-heading-color);
}

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

.cpu-story .cpu-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-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 负责什么 */

.cpu-role {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 11px;
    margin-top: 14px;
}

.cpu-role article {
    min-width: 0;
    padding: 15px 10px 13px;
    border: 1px solid #e1ecff;
    border-radius: 15px;
    background: #f9fbff;
    text-align: center;
}

.cpu-role article > img,
.cpu-role__icon {
    width: 76px;
    height: 76px;
    object-fit: contain;
    margin: 0 auto 7px;
}

.cpu-role__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 21px;
    background: #eaf3ff;
    color: #0752ff;
    font-size: 31px;
}

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

.cpu-role p {
    margin: 0;
    color: #607296;
    font-size: 12px;
}

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

.cpu-key {
    background: #eaf5ff;
}

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

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

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

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

/* 指令循环 */

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

.cpu-cycle__step {
    position: relative;
    min-width: 0;
    min-height: 190px;
    padding: 15px 10px 12px;
    border-radius: 15px;
    text-align: center;
}

.cpu-cycle__step--fetch {
    background: #eef5ff;
}

.cpu-cycle__step--decode {
    background: #fff6df;
}

.cpu-cycle__step--execute {
    background: #ecfaef;
}

.cpu-cycle__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-cycle__icon {
    display: inline-flex;
    width: 68px;
    height: 68px;
    align-items: center;
    justify-content: center;
    margin: 10px auto 7px;
    border-radius: 19px;
    background: #fff;
    color: #0752ff;
    font-size: 28px;
}

.cpu-cycle__step--decode .cpu-cycle__icon {
    color: #d58d00;
}

.cpu-cycle__step--execute .cpu-cycle__icon {
    color: #25924d;
}

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

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

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

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

.cpu-repeat > span {
    display: inline-flex;
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #fff;
    color: #7654d6;
    font-size: 24px;
}

.cpu-story .cpu-repeat h3 {
    margin: 0 0 3px;
    color: #644ab9;
    font-size: 15px;
}

.cpu-repeat p {
    margin: 0;
}

.cpu-small-note {
    margin-top: 8px !important;
    color: #7382a0;
    font-size: 12px;
}

/* CPU 与内存 */

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

.cpu-memory__memory,
.cpu-memory__cpu {
    display: flex;
    min-height: 180px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 14px;
    border-radius: 16px;
    text-align: center;
}

.cpu-memory__memory {
    background: #f3efff;
}

.cpu-memory__cpu {
    background: #eef5ff;
}

.cpu-memory__memory > span {
    color: #7654d6;
    font-size: 62px;
}

.cpu-memory__cpu img {
    width: 82px;
    height: 82px;
    object-fit: contain;
}

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

.cpu-memory p {
    margin: 0;
    color: #617296;
    font-size: 12px;
}

.cpu-memory__exchange {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: #4f82ff;
    text-align: center;
}

.cpu-memory__exchange span {
    color: #6b7d9e;
    font-size: 11px;
}

.cpu-memory__exchange strong {
    color: #4f82ff;
    font-size: 34px;
}

.cpu-note {
    background: #fff8e5;
}

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

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

/* 小例子 */

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

.cpu-example article {
    position: relative;
    min-width: 0;
    min-height: 145px;
    padding: 15px 9px;
    border: 1px solid #e2ebff;
    border-radius: 14px;
    background: #f9fbff;
    text-align: center;
}

.cpu-example__badge {
    display: inline-flex;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    border-radius: 50%;
    background: #0752ff;
    color: #fff;
    font-size: 13px;
    font-weight: 800;
}

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

.cpu-example p {
    margin: 0;
    color: #627396;
    font-size: 11px;
}

.cpu-example__arrow {
    color: #4f82ff;
    font-size: 22px;
    font-weight: 900;
    text-align: center;
}

.cpu-example-code {
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: 12px;
    margin-top: 13px;
}

.cpu-example-code__left,
.cpu-example-code__right {
    min-width: 0;
    padding: 14px;
    border-radius: 14px;
}

.cpu-example-code__left {
    display: flex;
    gap: 9px;
    align-items: center;
    background: #eef5ff;
}

.cpu-example-code__left > span {
    color: #0752ff;
    font-size: 28px;
}

.cpu-example-code__right {
    background: #f7f8fc;
}

.cpu-example-code__right code {
    display: block;
    margin-bottom: 5px;
    color: #19376d;
    font-size: 15px;
    font-weight: 800;
}

.cpu-example-code__right span {
    color: #6e7d99;
    font-size: 11px;
}

/* 为什么这么快 */

.cpu-speed {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 13px;
}

.cpu-speed article {
    min-width: 0;
    padding: 15px 10px;
    border: 1px solid #e2ebff;
    border-radius: 14px;
    background: #f9fbff;
    text-align: center;
}

.cpu-speed article > span {
    display: inline-flex;
    width: 66px;
    height: 66px;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
    border-radius: 20px;
    background: #eaf3ff;
    color: #0752ff;
    font-size: 28px;
}

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

.cpu-speed p {
    margin: 0;
    color: #617296;
    font-size: 12px;
}

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

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

/* 大脑比喻 */

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

.cpu-brain > div {
    min-width: 0;
    padding: 16px;
    border-radius: 15px;
}

.cpu-brain__okay {
    background: #effaf2;
}

.cpu-brain__careful {
    background: #fff5e8;
}

.cpu-story .cpu-brain h3 {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 0 0 8px;
    color: var(--article-heading-color);
    font-size: 15px;
}

.cpu-brain__okay h3 i {
    color: #28a65a;
}

.cpu-brain__careful h3 i {
    color: #d99400;
}

.cpu-brain ul {
    margin: 0;
    padding-left: 20px;
    line-height: 1.8;
}

.cpu-conclusion {
    display: flex;
    gap: 13px;
    align-items: center;
    margin-top: 13px;
    padding: 14px 16px;
    border-radius: 14px;
    background: #eef5ff;
}

.cpu-conclusion img {
    width: 68px;
    height: 68px;
    flex: 0 0 68px;
    object-fit: contain;
}

.cpu-conclusion p {
    margin: 0;
}

/* 总结 */

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

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

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

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

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

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

/* 上一篇 / 下一篇 */

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

.cpu-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-pagination a:last-child {
    text-align: right;
}

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

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

.cpu-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-pagination a:hover {
    background: #edf4ff;
}

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

/* 平板 */

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

    .cpu-example > .cpu-example__arrow {
        display: none;
    }
}

/* 手机 */

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

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

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

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

    .cpu-role,
    .cpu-speed,
    .cpu-brain {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
    }

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

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

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

    .cpu-cycle__arrow {
        transform: rotate(90deg);
        line-height: 1;
    }

    .cpu-cycle__step {
        min-height: auto;
        padding: 12px 10px;
    }

    .cpu-cycle__icon {
        width: 56px;
        height: 56px;
        font-size: 23px;
    }

    .cpu-memory {
        grid-template-columns: minmax(0, 1fr);
        gap: 7px;
    }

    .cpu-memory__memory,
    .cpu-memory__cpu {
        min-height: auto;
        padding: 13px;
    }

    .cpu-memory__exchange strong {
        transform: rotate(90deg);
        line-height: 1;
    }

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

    .cpu-example > .cpu-example__arrow {
        display: block;
        transform: rotate(90deg);
        line-height: 1;
    }

    .cpu-example article {
        min-height: auto;
    }

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

    .cpu-conclusion {
        gap: 9px;
        padding: 11px 12px;
    }

    .cpu-conclusion img {
        width: 50px;
        height: 50px;
        flex-basis: 50px;
    }

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

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

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

    .cpu-pagination {
        gap: 9px;
    }

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

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

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

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