.aiwe-research {
    --research-ink: #162842;
    --research-muted: #4c5f7b;
    --research-blue: #284bc0;
    --research-rule: #dce4f1;
    --research-wash: #f7f9fd;
    --research-gap: 14px;
}

.aiwe-research .aiwe-article-header h1 {
    font-size: clamp(22px, 2.7vw, 34px);
    line-height: 1.65;
}

.aiwe-research-lead {
    color: var(--research-ink);
    font-size: clamp(15px, 1.5vw, 18px);
    line-height: 1.9;
    margin: 18px 0 24px;
}

.aiwe-research .aiwe-research-toc summary {
    cursor: pointer;
    margin: 0;
    width: fit-content;
}

.aiwe-research .aiwe-research-toc ol {
    column-count: 2;
    column-gap: 34px;
    margin-top: 14px;
}

.aiwe-research .aiwe-research-toc li {
    break-inside: avoid;
}

.aiws .visual {
    margin: 25px 0;
    min-width: 0;
}

.aiws .visual > figcaption,
.aiws caption,
.aiws small {
    color: var(--research-muted);
    font-size: .87rem;
    line-height: 1.65;
}

.aiws .visual > figcaption {
    margin-top: 12px;
}

.aiws .reader-paths,
.aiws .stat-grid,
.aiws .compare-grid,
.aiws .total {
    display: grid;
    gap: var(--research-gap);
}

.aiws .reader-paths,
.aiws .compare-grid,
.aiws .total {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-block: 20px;
}

.aiws .reader-paths > p,
.aiws .stat,
.aiws .panel,
.aiws .chart,
.aiws .formula {
    min-width: 0;
    padding: 17px 18px;
    border: 1px solid var(--research-rule);
    border-radius: 4px;
}

.aiws .reader-paths > p,
.aiws .stat,
.aiws .formula,
.aiws .total {
    background: var(--research-wash);
}

.aiws .reader-paths > p {
    margin: 0;
    white-space: normal;
}

.aiws .reader-paths a {
    display: block;
    margin-top: 5px;
}

.aiws .stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 158px), 1fr));
}

.aiws .stat {
    display: grid;
    align-content: start;
    gap: 7px;
    line-height: 1.55;
}

.aiws .stat > span,
.aiws .total span {
    color: var(--research-ink);
    font-size: .88rem;
    font-weight: 650;
}

.aiws .stat > strong,
.aiws .total strong {
    font-size: clamp(25px, 3.1vw, 36px);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.025em;
    line-height: 1.12;
    color: var(--research-blue);
}

.aiws strong.negative {
    color: #a33249;
}

.aiws .pair {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 9px;
    padding-top: 8px;
    border-top: 1px solid var(--research-rule);
    font-size: .86rem;
}

.aiws .pair strong,
.aiws .bar-label strong {
    white-space: nowrap;
    color: var(--research-blue);
    font-variant-numeric: tabular-nums;
}

.aiws .pair strong.negative {
    color: #a33249;
}

.aiws .figure-title {
    color: var(--research-ink);
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 9px;
    line-height: 1.55;
}

.aiws .axis,
.aiws .bar-label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}

.aiws .axis {
    color: var(--research-muted);
    font-size: .79rem;
}

.aiws .bar-row {
    margin: 12px 0 14px;
}

.aiws .bar-label {
    font-size: .91rem;
    line-height: 1.6;
}

.aiws .track {
    height: 12px;
    margin-top: 5px;
    background: #edf2ff;
    border: 1px solid var(--research-rule);
    border-radius: 2px;
    overflow: hidden;
}

.aiws .track span {
    display: block;
    height: 100%;
    background: #3159db;
}

.aiws .note {
    margin: 26px 0;
    padding: 14px 17px;
    border-inline-start: 3px solid #6d87df;
    background: var(--research-wash);
}

.aiws .note p {
    margin: 4px 0 0;
}

.aiws .table-wrap {
    margin: 22px 0;
    max-width: 100%;
    overflow-x: auto;
    border: 1px solid var(--research-rule);
    border-radius: 4px;
}

.aiws .table-wrap table {
    display: table;
    table-layout: fixed;
    margin: 0;
    line-height: 1.65;
}

.aiws caption {
    text-align: start;
    padding: 10px 11px;
}

.aiws .table-wrap :is(th, td) {
    min-width: 0;
    padding: 10px 11px;
    border: 0;
    border-top: 1px solid var(--research-rule);
}

.aiws .table-wrap thead th {
    background: #eef2ff;
}

.aiws .table-wrap tbody th {
    background: var(--research-wash);
    font-weight: 600;
}

.aiws .flow {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 18px;
}

.aiws .flow li {
    position: relative;
    display: flex;
    align-items: start;
    gap: 12px;
    min-width: 0;
    margin: 0;
    padding: 11px 13px;
    border: 1px solid var(--research-rule);
    border-inline-start: 3px solid #a0b3f4;
    border-radius: 4px;
    background: var(--research-wash);
    line-height: 1.65;
}

.aiws .flow li:not(:last-child)::after {
    content: '↓';
    position: absolute;
    inset: 100% auto auto 15px;
    line-height: 18px;
    color: var(--research-blue);
}

.aiws .step-no {
    color: var(--research-blue);
    font-size: .81rem;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
    flex: none;
}

.aiws .flow :is(strong, small),
.aiws .layer small {
    display: block;
}

.aiws .formula p {
    margin: 5px 0;
    font-size: .91rem;
    line-height: 1.7;
}

.aiws .cycle {
    display: grid;
    grid-template-areas: 'step1 step2' 'step4 step3';
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px 26px;
}

.aiws .cycle > div {
    position: relative;
    padding: 11px 14px;
    border: 1px solid var(--research-rule);
    border-radius: 4px;
    background: var(--research-wash);
}

.aiws .cycle > div > * {
    display: block;
}

.aiws .cycle > div:nth-of-type(1) { grid-area: step1; }
.aiws .cycle > div:nth-of-type(2) { grid-area: step2; }
.aiws .cycle > div:nth-of-type(3) { grid-area: step3; }
.aiws .cycle > div:nth-of-type(4) { grid-area: step4; }

.aiws .cycle > div::after {
    position: absolute;
    color: var(--research-blue);
    line-height: 1;
}

.aiws .cycle > div:nth-of-type(1)::after { content: '→'; inset: 45% -21px auto auto; }
.aiws .cycle > div:nth-of-type(2)::after { content: '↓'; inset: auto auto -21px 46%; }
.aiws .cycle > div:nth-of-type(3)::after { content: '←'; inset: 45% auto auto -21px; }
.aiws .cycle > div:nth-of-type(4)::after { content: '↑'; inset: -21px auto auto 46%; }

.aiws .layers {
    display: grid;
    gap: 10px;
}

.aiws .layer {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(0, 160px);
    align-items: start;
    gap: 9px 14px;
    padding: 13px 15px;
    border: 1px solid var(--research-rule);
    border-radius: 4px;
}

.aiws .layer p {
    margin: 0;
}

.aiws .layer > strong {
    color: var(--research-blue);
    line-height: 1.65;
}

.aiws .total {
    padding: 12px 16px;
}

.aiws .total span,
.aiws .total strong {
    display: block;
}

.aiws .stack {
    display: flex;
    height: 16px;
    border-radius: 2px;
    overflow: hidden;
}

.aiws .stack span:nth-child(1), .aiws .legend span:nth-child(1)::before { background: #264fc9; }
.aiws .stack span:nth-child(2), .aiws .legend span:nth-child(2)::before { background: #6380dd; }
.aiws .stack span:nth-child(3), .aiws .legend span:nth-child(3)::before { background: #28456a; }
.aiws .stack span:nth-child(4), .aiws .legend span:nth-child(4)::before { background: #a8b9f4; }

.aiws .legend {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 15px;
    margin: 10px 0;
    font-size: .88rem;
}

.aiws .legend span::before {
    content: '';
    display: inline-block;
    height: 10px;
    width: 10px;
    margin-inline-end: 5px;
    border-radius: 2px;
}

.aiws .ratio {
    font-weight: 700;
    color: var(--research-ink);
}

.aiws .ref {
    margin-inline-start: 3px;
    font-size: .7em;
    line-height: 0;
}

.aiws .references li {
    scroll-margin-top: 115px;
    margin-block: 11px;
}

.aiws details {
    border-bottom: 1px solid var(--research-rule);
    padding: 12px 0;
}

.aiws summary {
    cursor: pointer;
    font-weight: 700;
    line-height: 1.7;
}

.aiws details p {
    margin: 9px 0 0;
}

.aiws :is(a, summary, [tabindex]):focus-visible,
.aiwe-research-toc summary:focus-visible {
    outline: 2px solid #3159db;
    outline-offset: 3px;
}

@media (max-width: 580px) {
    .aiwe-research .aiwe-research-toc ol {
        column-count: 1;
    }

    .aiws :is(.reader-paths, .compare-grid, .stat-grid) {
        grid-template-columns: 1fr;
    }

    .aiws :is(.reader-paths > p, .stat, .panel, .chart, .formula) {
        padding: 13px 14px;
    }

    .aiws .table-wrap :is(th, td) {
        padding-inline: 7px;
    }

    .aiws .cycle {
        grid-template-areas: 'step1' 'step2' 'step3' 'step4';
        grid-template-columns: minmax(0, 1fr);
        gap: 19px;
    }

    .aiws .cycle > div:nth-of-type(n)::after {
        content: '↓';
        inset: auto auto -17px 16px;
    }

    .aiws .cycle > div:nth-of-type(4)::after {
        content: none;
    }

    .aiws .layer {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .aiws .layer > strong {
        grid-column: 2;
    }
}
