:root { --paper: #f4f5f0; --accent: #216b98; --accent-rgb: 33, 107, 152; --encoder: #216b98; --decoder: #a15e27; }
body { overflow: hidden; }
.paper-heading { position: fixed; top: 20px; left: 190px; right: 340px; z-index: 3; pointer-events: none; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 12px; letter-spacing: .06em; font-weight: 600; }
.eyebrow span { color: var(--muted); margin-left: 12px; font-weight: 400; letter-spacing: 0; }
h1 { margin: 0; font-size: clamp(20px, 2vw, 30px); font-weight: 650; letter-spacing: -.035em; }
.paper-heading > p:last-child { margin: 7px 0 0; font-size: 14px; color: var(--muted); }
.paper-tools { position: fixed; right: 22px; top: 20px; z-index: 10; display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
.paper-tools button, .paper-lab button:not(.close-lab):not(.matrix-cell), .paper-lab select { border: 1px solid var(--line); border-radius: 10px; min-height: 44px; padding: 9px 14px; background: #fffffc; cursor: pointer; font-size: 14px; }
.paper-tools button { text-align: left; background: rgba(255,255,252,.9); }
.paper-tools button span { color: var(--accent); margin-right: 12px; font: 12px ui-monospace, monospace; }
.paper-tools button:hover, .paper-lab button:hover:not(:disabled):not(.matrix-cell) { border-color: var(--accent); background: #edf4f8; }
.module { padding: 116px 16px 54px; min-height: 560px; }
.model[data-model="transformer"] { width: min(90vw, 1070px, calc((100svh - 172px) * 10 / 9)); height: auto; aspect-ratio: 10 / 9; }
.paper-footer { position: fixed; bottom: 17px; left: 22px; right: 22px; display: flex; gap: 16px; align-items: center; justify-content: center; z-index: 3; font-size: 13px; color: var(--muted); }
.paper-footer a { color: var(--accent); padding: 6px; }
.tf-node .part-surface { fill: #fffffc; stroke: #87a4b6; stroke-width: 1.4; }
.tf-node.decoder .part-surface { stroke: #bd9b7f; fill: #fffcf7; }
.tf-node text { stroke: none; fill: #234e67; font-size: 25px; text-anchor: middle; pointer-events: none; font-weight: 600; }
.tf-node.decoder text { fill: #865125; }
.tf-node .node-subtitle { font-size: 18px; font-weight: 400; fill: #647681; }
.tf-node .norm-label { font-size: 18px; fill: #677a72; font-weight: 400; }
.tf-node .norm-line { stroke: #ced9d3; stroke-width: 1; vector-effect: non-scaling-stroke; }
.tf-node .residual { stroke: #a0b0a7; stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.tf-node:hover .part-surface, .tf-node.active .part-surface, .tf-node:focus-visible .part-surface { stroke: var(--accent); fill: #e7f1f7; stroke-width: 2.2; }
.tf-node:focus-visible .part-surface { stroke-dasharray: 5 3; }
.tf-edge { fill: none; stroke: #8c9faa; stroke-width: 1.5; vector-effect: non-scaling-stroke; marker-end: url(#tf-arrow); transition: opacity .2s, stroke .2s; }
.tf-edge.cross { stroke: #aa8359; stroke-width: 2; }
.tf-edge.feedback { stroke-dasharray: 5 5; }
.tf-label { stroke: none; fill: #6b7c86; text-anchor: middle; font-size: 19px; }
.tf-title { font-size: 28px; font-weight: 650; fill: #234e67; }
.tf-title.decoder-label { fill: #865125; }
.tf-enclosure { fill: rgba(33,107,152,.025); stroke: #b9cad3; stroke-width: 1; stroke-dasharray: 7 6; vector-effect: non-scaling-stroke; }
.tf-enclosure.decoder-box { fill: rgba(161,94,39,.025); stroke: #d0b9a4; }
.tf-edge.is-related { stroke: var(--accent); stroke-width: 2.2; marker-end: url(#tf-arrow-active); opacity: 1; }
.has-selection .tf-node:not(.is-related) { opacity: .34; }
.has-selection .tf-edge:not(.is-related) { opacity: .17; }
.has-selection .tf-annotations, .has-selection .tf-enclosures { opacity: .35; }
.tf-node { transition: opacity .2s; }
.paper-selected .paper-heading, .paper-selected .paper-footer { opacity: 0; pointer-events: none; }
.paper-selected .paper-tools { display: none; }
.focus-details .research-points p, .focus-brief .summary { font-size: 16px; }
.focus-topics, .focus-expand, .focus-toolbar select { font-size: 14px; }
.focus-report.is-expanded .summary, .focus-report.is-expanded .research-points p, .focus-report.is-expanded .verdict { font-size: 16px; }
.focus-details button { margin-top: 12px; min-height: 44px; border: 1px solid #bad0dd; border-radius: 9px; padding: 8px 12px; color: var(--accent); background: #eff6fa; cursor: pointer; font-size: 14px; }
.formula-inline { display: block; padding: 12px; margin: 10px 0; background: #f0f4f5; border-radius: 8px; color: #234e67; overflow-wrap: anywhere; white-space: pre-line; font-family: ui-monospace, Consolas, monospace; font-size: 14px; }
.paper-lab { width: min(1180px, calc(100vw - 48px)); max-height: calc(100svh - 48px); padding: 0; border: 1px solid #cbd6da; border-radius: 22px; color: var(--ink); background: #fffffc; box-shadow: 0 30px 110px #182a3d33; overflow: hidden; }
.paper-lab[open] { display: flex; flex-direction: column; }
.paper-lab::backdrop { background: rgba(27,42,50,.28); backdrop-filter: blur(5px); }
.lab-header { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 18px; padding: 24px 32px 20px; border-bottom: 1px solid var(--line); }
.lab-header h2 { font-size: 26px; }
.close-lab { width: 44px; height: 44px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--muted); font-size: 28px; cursor: pointer; }
.lab-body { min-height: 0; padding: 24px 32px 32px; overflow: auto; overscroll-behavior: contain; }
.lab-section { margin: 0; padding: 0; border: 0; }
.lab-intro { margin: 0 0 8px; font-size: 18px; line-height: 1.7; }
.demo-note { font-size: 14px; color: var(--muted); line-height: 1.7; margin: 8px 0 18px; }
.lab-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 16px 26px; margin: 24px 0 18px; font-size: 14px; }
.lab-controls select { margin-left: 8px; }
.check-control { display: flex; align-items: center; gap: 8px; cursor: pointer; min-height: 44px; }
input[type="checkbox"] { width: 19px; height: 19px; accent-color: var(--accent); }
.token-row { display: flex; gap: 8px; flex-wrap: wrap; }
.paper-lab .token-row button[aria-pressed="true"], .paper-lab .mode-switch button[aria-pressed="true"], .paper-lab .head-card[aria-pressed="true"] { background: #e5f0f7; border-color: var(--accent); color: #18597f; }
.attention-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(250px, .85fr); gap: 28px; margin: 26px 0 20px; }
.paper-lab h3 { color: #334d5b; font-size: 16px; }
.matrix-scroll, .table-scroll { overflow-x: auto; }
table { border-collapse: separate; border-spacing: 0; font-size: 14px; }
.attention-matrix { width: 100%; table-layout: fixed; border-spacing: 4px; }
caption { caption-side: bottom; padding-top: 12px; text-align: left; color: var(--muted); font-size: 13px; line-height: 1.6; }
.attention-matrix th { height: 32px; font-weight: 500; color: #5b6e79; }
.attention-matrix tbody th { text-align: right; padding-right: 7px; }
.attention-matrix td { padding: 0; height: 44px; }
.paper-lab .matrix-cell { display: block; width: 100%; min-height: 44px; padding: 5px 0; border: 1px solid transparent; border-radius: 6px; background: rgba(33,107,152,var(--weight)); color: #163e57; cursor: pointer; font: 13px ui-monospace, Consolas, monospace; }
.paper-lab .matrix-cell.dark { color: #fff; }
.paper-lab .matrix-cell.masked { background: repeating-linear-gradient(135deg,#f1f3f2,#f1f3f2 4px,#e5e9e7 4px,#e5e9e7 5px); color: #758780; }
.attention-matrix tr.is-query .matrix-cell { border-color: #216b98; }
.attention-matrix tr.is-query > th { color: #216b98; font-weight: 700; }
.heat-legend { display: flex; gap: 8px; align-items: center; margin-top: 12px; color: var(--muted); font-size: 12px; }
.heat-legend i { width: 90px; height: 8px; background: linear-gradient(90deg,#edf3f6,#216b98); border-radius: 3px; }
.mask-key { margin-left: auto; }
.calculation-panel { border-left: 1px solid var(--line); padding-left: 28px; }
.calculation-panel h3 { font-size: 26px; margin: 0 0 8px; }
.vector-value { font-family: ui-monospace, Consolas, monospace; font-size: 14px; color: #415b6b; line-height: 1.7; overflow-wrap: anywhere; }
.calculation-steps { list-style: none; margin: 20px 0; padding: 0; counter-reset: calc; }
.calculation-steps li { position: relative; counter-increment: calc; padding-left: 35px; margin-bottom: 17px; font-size: 14px; line-height: 1.6; }
.calculation-steps li::before { content: counter(calc, decimal-leading-zero); position: absolute; left: 0; top: 0; color: #7994a4; font: 12px/1.8 ui-monospace, monospace; }
.calculation-steps strong { display: block; font-size: 15px; margin-bottom: 3px; }
.output-vector { background: #eaf3f8; padding: 14px; border-radius: 9px; font-size: 15px; line-height: 1.7; color: #17587e; }
.formula-strip { padding: 17px 20px; border: 1px solid #cbdbe5; border-radius: 11px; background: #f5f9fc; color: #234e67; font-family: ui-monospace, Consolas, monospace; font-size: 16px; line-height: 1.8; overflow-wrap: anywhere; }
.lab-explanation { font-size: 16px; line-height: 1.85; color: #51626b; }
.math-details { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 16px; }
summary { min-height: 44px; padding: 10px 0; cursor: pointer; color: var(--accent); font-size: 15px; }
.number-table { width: 100%; white-space: nowrap; }
.number-table th, .number-table td { padding: 12px 9px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; font-variant-numeric: tabular-nums; }
.number-table th { color: var(--muted); font-weight: 500; }
.multihead-block { border-top: 1px solid var(--line); margin-top: 28px; padding-top: 24px; }
.multihead-block > p { font-size: 14px; line-height: 1.7; color: var(--muted); }
.head-cards { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; margin: 18px 0; }
.paper-lab .head-card { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; text-align: left; }
.head-card small { font-size: 12px; color: var(--muted); font-family: ui-monospace, monospace; }
.concat-vector { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; font-size: 14px; color: var(--muted); }
.concat-vector span { padding: 6px; border-bottom: 2px solid #a8c3d3; font: 12px ui-monospace, monospace; color: #35627d; }
.projection-data p { overflow-wrap: anywhere; line-height: 1.8; font: 13px/1.8 ui-monospace, monospace; }
.projection-data { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.source-note { margin: 25px 0 0; font-size: 13px; color: var(--muted); }
.source-note a { color: var(--accent); }
.position-control { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 24px 0; font-size: 16px; }
.position-control output { color: var(--accent); font: 24px ui-monospace, monospace; min-width: 40px; }
.position-control input { width: 100%; accent-color: var(--accent); min-height: 32px; }
.position-visual svg { display: block; width: 100%; height: auto; }
.position-legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; }
.position-legend span::before { content: ""; display: inline-block; width: 16px; height: 3px; margin-right: 6px; background: #216b98; vertical-align: middle; }
.position-legend span:nth-child(2)::before { background: #9b5930; }
.position-legend span:nth-child(3)::before { background: #15806c; }
.position-legend span:nth-child(4)::before { background: #8060b5; }
.position-values { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0; }
.position-values span { padding: 10px 13px; border: 1px solid var(--line); border-radius: 8px; font: 14px ui-monospace, monospace; }
.mode-switch { display: flex; gap: 8px; margin-bottom: 18px; }
.generation-source { padding: 24px; border: 1px solid #bfd3df; border-radius: 14px; background: #f2f8fb; display: flex; flex-direction: column; gap: 12px; margin-top: 26px; }
.generation-source span { color: var(--accent); font-size: 14px; }
.generation-source strong { font-size: 24px; font-weight: 600; }
.generation-source small { font-size: 14px; color: var(--muted); }
.generation-track { display: grid; grid-template-columns: 1fr auto 180px; align-items: center; gap: 26px; margin: 32px 0; }
.generation-track h3 { font-size: 14px; color: var(--muted); }
.known-token { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 12px; border: 1px solid #c5d4dc; border-radius: 8px; font-size: 17px; }
.known-token.special { color: var(--muted); border-style: dashed; font-size: 14px; }
.generation-arrow { font-size: 28px; color: #849cac; }
.next-token { min-height: 70px; padding: 18px; border: 1px solid #c7ae97; border-radius: 13px; background: #fbf3e9; color: #8c552c; font: 27px ui-monospace, monospace; text-align: center; }
.step-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 24px; font-size: 14px; }
.paper-lab .primary-button { background: #216b98 !important; color: #fff; border-color: #216b98 !important; }
.paper-lab button:disabled { opacity: .4; cursor: default; }
.training-table { min-width: 690px; width: 100%; margin-top: 12px; }
.training-table th, .training-table td { padding: 18px 10px; text-align: center; border-bottom: 1px solid var(--line); }
.training-table th { width: 135px; text-align: left; color: var(--muted); font-weight: 500; }
.training-table tr:first-child td { color: var(--accent); }
.training-table tr:last-child td { color: #a15e27; }
.no-script { position: fixed; inset: 40% 20% auto; padding: 25px; border: 1px solid var(--line); background: #fff; z-index: 20; line-height: 1.8; }
@media (max-width: 900px) {
  .paper-heading { top: 24px; left: 172px; right: 20px; }
  .paper-tools { top: auto; bottom: 45px; left: 16px; right: 16px; flex-direction: row; justify-content: center; }
  .module { padding-bottom: 116px; }
  .model[data-model="transformer"] { width: min(92vw, calc((100svh - 224px) * 10 / 9)); }
  .paper-footer { bottom: 10px; font-size: 12px; gap: 8px; }
}
@media (max-width: 700px) {
  .back-home { font-size: 13px; }
  .paper-heading { top: 74px; left: 20px; right: 20px; }
  .paper-heading .eyebrow { display: none; }
  h1 { font-size: 23px; }
  .paper-heading > p:last-child { font-size: 13px; }
  .module { padding: 142px 12px 126px; min-height: 640px; }
  .model[data-model="transformer"] { aspect-ratio: 660 / 1080; width: min(94vw, calc((100svh - 260px) * 660 / 1080)); min-width: min(300px, 92vw); }
  .tf-node text { font-size: 30px; }
  .tf-node .node-subtitle { display: none; }
  .tf-node .norm-label { font-size: 22px; }
  .tf-label { font-size: 24px; }
  .tf-label.tf-title { font-size: 30px; }
  .paper-tools { gap: 6px; bottom: 42px; left: 8px; right: 8px; }
  .paper-tools button { padding: 9px 10px; font-size: 13px; }
  .paper-tools button span { display: none; }
  .paper-footer { left: 6px; right: 6px; justify-content: space-between; gap: 4px; font-size: 12px; }
  .paper-lab { width: calc(100vw - 16px); max-height: calc(100svh - 20px); border-radius: 16px; }
  .lab-header { padding: 16px 18px; }
  .lab-header h2 { font-size: 23px; }
  .lab-body { padding: 20px 16px; }
  .attention-layout { grid-template-columns: 1fr; gap: 22px; }
  .calculation-panel { border-left: 0; border-top: 1px solid var(--line); padding: 22px 0 0; }
  .attention-matrix { min-width: 275px; border-spacing: 2px; }
  .attention-matrix th { font-size: 12px; }
  .paper-lab .matrix-cell { font-size: 11px; }
  .lab-controls { gap: 10px 16px; }
  .head-cards { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .projection-data { grid-template-columns: 1fr; }
  .generation-track { grid-template-columns: 1fr; gap: 12px; }
  .generation-arrow { transform: rotate(90deg); justify-self: center; }
  .next-token { width: 150px; }
  .generation-source strong { font-size: 20px; }
  .formula-strip { padding: 14px; font-size: 14px; }
}
@media (max-height: 680px) {
  body { overflow-y: auto; }
  .module { min-height: 680px; }
  .paper-heading { position: absolute; }
  .model[data-model="transformer"] { min-width: min(420px, 90vw); }
}
@media (prefers-reduced-motion: reduce) {
  .tf-node, .tf-edge, .model-camera { transition: none; }
  .paper-lab::backdrop { backdrop-filter: none; }
}
