.tx-arch-reference { margin: .85rem 0 1.1rem; }
.tx-attention-patterns { max-width: 520px; margin: 1rem auto; padding: .4rem; }
.tx-attention-patterns .tx-mask-legend { display: flex; gap: 1rem; margin: 0 0 .6rem; font-size: .73rem; }
.tx-mask-legend span { display: inline-flex; align-items: center; gap: .3rem; }
.tx-mask-legend i { width: .8rem; height: .8rem; border-radius: 2px; }
.tx-attention-patterns .is-allowed { fill: #25866e; background: #25866e; }
.tx-attention-patterns .is-masked { fill: #d6dce5; background: #d6dce5; }
.tx-mask-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.tx-mask-panel { min-width: 0; padding: .5rem; border: 1px solid var(--study-line); border-radius: 7px; background: var(--study-panel); }
.tx-mask-panel > strong { display: block; color: var(--study-ink); font-size: .76rem; line-height: 1.35; }
.tx-mask-panel svg { display: block; width: 100%; height: auto; margin-top: .35rem; }
.tx-mask-axis-labels { fill: var(--study-ink); font: 11px sans-serif; }
.tx-mask-ticks { fill: var(--study-ink); font: 10px sans-serif; }
.tx-mask-boundary { fill: none; stroke: #b68643; stroke-width: 1.5; stroke-dasharray: 3 2; }
.tx-attention-patterns .tx-mask-panel > p { margin: .4rem 0 0; color: var(--study-muted); font-size: .7rem; line-height: 1.4; }
[data-theme="dark"] .tx-attention-patterns .is-masked { fill: #334155; background: #334155; }
@media (max-width: 480px) {
  .tx-mask-panel { padding: .35rem; }
  .tx-mask-panel > strong { font-size: .68rem; }
  .tx-attention-patterns .tx-mask-legend { gap: .6rem; font-size: .65rem; }
}
.tx-arch-reference .study-table-wrap { margin: 0; }
.tx-arch-reference table { table-layout: fixed; }
.tx-arch-reference th, .tx-arch-reference td { padding: .45rem .6rem; font-size: .82rem; }
.tx-arch-reference th:nth-child(odd) { width: 4rem; white-space: nowrap; }
.tx-arch-charts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 1rem; margin: 1rem 0 1.5rem; }
.tx-arch-original { margin: 0; padding: .6rem; border: 1px solid var(--study-line); border-radius: 7px; background: #fff; }
.tx-arch-original img { display: block; width: 100%; object-fit: contain; height: auto; }

.tx-moe-diagram { margin: 1rem 0 1.3rem; }
.tx-moe-panels { display: grid; grid-template-columns: minmax(0, 360fr) minmax(0, 500fr); gap: .75rem; }
.tx-moe-panels img { display: block; width: 100%; height: auto; border-radius: 12px; }
.tx-moe-diagram .moe-summary { margin: .75rem 0 0; }
@media (max-width: 1050px) {
  .tx-moe-panels { grid-template-columns: minmax(0, 1fr); }
  .tx-moe-panels img { max-width: 500px; margin-inline: auto; }
  .tx-moe-panels img:first-child { max-width: 360px; }
}
.tx-arch-full { min-width: 0; margin: 0; padding: 1rem; }
.tx-arch-full .tx-stack > .tx-node { width: min(100%, 390px); }
.tx-arch-full .tx-arrow { max-width: 100%; overflow-wrap: anywhere; }
.tx-arch-code { margin: .7rem 0 1rem; border: 1px solid var(--study-line); border-radius: 7px; background: var(--study-card); }
.tx-arch-code > summary { padding: .65rem .8rem; color: var(--study-accent); font-size: .85rem; font-weight: 650; cursor: pointer; }
.tx-arch-code > summary:focus-visible { outline: 2px solid var(--study-accent); outline-offset: 2px; }
.tx-arch-code pre { margin: 0; border-width: 1px 0 0; border-radius: 0 0 7px 7px; }
.tx-arch-text { margin: .7rem 0 1rem; border: 1px solid var(--study-line); border-radius: 7px; background: var(--study-card); }
.tx-arch-text > summary { padding: .65rem .8rem; color: var(--study-accent); font-size: .85rem; font-weight: 650; cursor: pointer; }
.tx-arch-text > summary:focus-visible { outline: 2px solid var(--study-accent); outline-offset: 2px; }
.tx-arch-text-body { padding: 0 .8rem .5rem; }
.tx-further-read > li { margin-bottom: .6rem; }
.tx-further-read .tx-positional-reading { margin: 0; }
.tx-positional-reading h4 { margin: 1.5rem 0 .6rem; font-size: 1.05rem; }
.tx-positional-reading h5, .tx-positional-reading h6 { margin: 1rem 0 .45rem; font-size: .95rem; }
.tx-arch-demo { margin: .7rem 0 1rem; border: 1px solid var(--study-line); border-radius: 7px; background: var(--study-card); }
.tx-arch-demo > summary { padding: .65rem .8rem; color: var(--study-accent); font-size: .85rem; font-weight: 650; cursor: pointer; }
.tx-arch-demo > summary:focus-visible { outline: 2px solid var(--study-accent); outline-offset: 2px; }
.tx-ffn-shape { max-width: 520px; margin: 0 auto; padding: .75rem; }
.tx-ffn-shape-node { display: flex; flex-direction: column; gap: .2rem; align-items: center; border: 1px solid var(--study-line); border-radius: 6px; background: var(--study-panel); padding: .45rem; text-align: center; }
.tx-ffn-shape-node code { border: 0; background: transparent; padding: 0; }
.tx-ffn-shape-branches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.tx-ffn-shape-arrow { margin: .2rem 0; color: var(--study-accent); font-size: .8rem; text-align: center; }
.tx-ffn-shape .tx-ffn-shape-variants { margin: .45rem 0 0; color: var(--study-muted); text-align: center; }
.tx-ffn-activations { max-width: 520px; margin: 0 auto; padding: .75rem; }
.tx-ffn-activations > figcaption { margin-bottom: .6rem; font-size: .8rem; text-align: center; }
.tx-ffn-activation-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.tx-ffn-activation { min-width: 0; border: 1px solid var(--study-line); border-radius: 6px; background: var(--study-panel); padding: .5rem; }
.tx-ffn-activation > div { display: flex; justify-content: space-between; align-items: center; gap: .4rem; font-size: .76rem; }
.tx-ffn-activation span { color: var(--study-muted); font-size: .7rem; }
.tx-ffn-activation svg { display: block; width: 100%; max-width: 260px; margin: .3rem auto 0; overflow: visible; }
.tx-ffn-grid-line { fill: none; stroke: var(--study-line); stroke-dasharray: 3 3; }
.tx-ffn-axis { fill: none; stroke: var(--study-muted); stroke-width: 1; }
.tx-ffn-curve { fill: none; stroke: var(--study-accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.tx-ffn-ticks { fill: var(--study-muted); font: 11px sans-serif; }
@media (max-width: 480px) {
  .tx-ffn-activation-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .tx-arch-reference th, .tx-arch-reference td { padding: .35rem; font-size: .72rem; overflow-wrap: anywhere; }
  .tx-arch-charts { grid-template-columns: 1fr; }
  .tx-arch-original { max-width: 290px; margin-inline: auto; }
  .tx-arch-full { padding: .75rem; }
}
