:root {
  --arwm-memory: #9496ff;
  --arwm-action: #66e6ae;
  --arwm-align: #f1a35b;
  --arwm-ink: #f4f5f7;
  --arwm-muted: #969aa5;
}

arwm-data-figure {
  display: block;
  width: 100%;
  min-width: 0;
  color: var(--arwm-ink);
}

/* Data figures need the full evidence width; the paper copy remains above them. */
.evidence-card:has(arwm-data-figure) {
  grid-template-columns: minmax(0, 1fr);
  gap: 38px;
}

.evidence-card:has(arwm-data-figure) > .evidence-copy {
  max-width: 850px;
}

body.arwm-motion-enhanced .evidence-section:has(.arwm-data-card.is-entered) {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.figure-stack:has(arwm-data-figure) {
  width: 100%;
  min-width: 0;
}

.evaluation-grid:has(arwm-data-figure) {
  grid-template-columns: minmax(0, 1fr);
  gap: 38px;
}

.evaluation-grid:has(arwm-data-figure) > .evaluation-copy {
  grid-row: 1;
  max-width: 850px;
}

.evaluation-grid:has(arwm-data-figure) > :has(arwm-data-figure) {
  grid-row: 2;
  min-width: 0;
}

.arwm-data-card {
  position: relative;
  overflow: hidden;
  min-width: 0;
  border: 1px solid rgba(148, 150, 255, .22);
  border-radius: 22px;
  background:
    radial-gradient(circle at 88% 8%, rgba(148, 150, 255, .09), transparent 33%),
    linear-gradient(145deg, rgba(16, 18, 22, .98), rgba(7, 8, 10, .995));
  box-shadow: 0 26px 80px rgba(0, 0, 0, .25), inset 0 1px rgba(255, 255, 255, .03);
}

.arwm-data-card::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: .16;
  background-image:
    linear-gradient(rgba(148, 150, 255, .09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 150, 255, .09) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, #000, transparent 78%);
}

.arwm-data-card.is-entered .arwm-chart-line {
  animation: arwm-draw-line 1.15s cubic-bezier(.2, .75, .25, 1) both;
}

.arwm-data-card.is-entered .arwm-band {
  animation: arwm-band-in .9s ease-out both;
}

.arwm-data-card.is-entered .arwm-point {
  animation: arwm-point-in .62s cubic-bezier(.2, .85, .32, 1.2) both;
}

@keyframes arwm-draw-line {
  from { stroke-dashoffset: var(--path-length, 1500); }
  to { stroke-dashoffset: 0; }
}

@keyframes arwm-band-in {
  from { opacity: 0; transform: scaleY(.15); }
  to { opacity: var(--band-opacity, .1); transform: scaleY(1); }
}

@keyframes arwm-point-in {
  from { opacity: 0; transform: scale(.3); }
  to { opacity: 1; transform: scale(1); }
}

.arwm-data-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 25px 28px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .075);
}

.arwm-data-eyebrow,
.arwm-subview-tab,
.arwm-legend-btn,
.arwm-data-control {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.arwm-data-eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 8px;
  color: var(--arwm-memory);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.arwm-data-eyebrow::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 13px currentColor;
  content: "";
}

.arwm-data-title {
  margin: 0;
  color: #f6f7fb;
  font-size: clamp(20px, 2vw, 29px);
  font-weight: 560;
  letter-spacing: -.035em;
}

.arwm-data-subtitle {
  max-width: 720px;
  margin: 7px 0 0;
  color: #9296a1;
  font-size: 13px;
  line-height: 1.55;
}

.arwm-subview-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, .085);
  border-radius: 11px;
  background: rgba(255, 255, 255, .025);
}

.arwm-subview-tab {
  border: 0;
  border-radius: 7px;
  color: #8f939e;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 9px 13px;
  transition: color .2s, background .2s, box-shadow .2s;
}

.arwm-subview-tab[aria-selected="true"] {
  color: white;
  background: rgba(148, 150, 255, .16);
  box-shadow: inset 0 0 0 1px rgba(148, 150, 255, .24);
}

.arwm-data-tools {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 18px;
  padding: 14px 28px 0;
}

.arwm-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.arwm-legend-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 8px;
  color: #a7aab3;
  background: rgba(255, 255, 255, .018);
  cursor: pointer;
  font-size: 10px;
  transition: opacity .2s, border-color .2s, color .2s, background .2s;
}

.arwm-legend-btn::before {
  width: 13px;
  height: 3px;
  border-radius: 2px;
  background: var(--series-color);
  box-shadow: 0 0 8px color-mix(in srgb, var(--series-color), transparent 35%);
  content: "";
}

.arwm-legend-btn[aria-pressed="false"] { opacity: .34; }
.arwm-legend-btn:hover,
.arwm-legend-btn:focus-visible { color: #fff; border-color: rgba(148, 150, 255, .35); outline: none; }

.arwm-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.arwm-data-control {
  max-width: 210px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 8px;
  color: #d9dbe1;
  background: #101216;
  font-size: 11px;
  padding: 8px 28px 8px 10px;
}

.arwm-chart-wrap {
  position: relative;
  z-index: 1;
  min-height: 390px;
  padding: 10px 16px 20px;
  animation: arwm-view-in .52s cubic-bezier(.2, .75, .25, 1) both;
}

.arwm-chart-svg {
  display: block;
  width: 100%;
  min-height: 390px;
  overflow: visible;
  touch-action: pan-y;
}

.arwm-grid-line { stroke: rgba(189, 192, 210, .11); stroke-width: 1; vector-effect: non-scaling-stroke; }
.arwm-zero-line { stroke: rgba(255, 255, 255, .23); stroke-width: 1; stroke-dasharray: 3 5; }
.arwm-axis-line { stroke: rgba(211, 214, 229, .28); stroke-width: 1; vector-effect: non-scaling-stroke; }
.arwm-axis-text { fill: #858996; font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
.arwm-panel-title { fill: #dfe1e8; font: 600 12px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .035em; }
.arwm-panel-direction { fill: #737784; font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .06em; }
.arwm-chart-line {
  fill: none;
  stroke: var(--series-color);
  stroke-width: var(--line-width, 1.7);
  stroke-linejoin: round;
  stroke-linecap: round;
  stroke-dasharray: var(--path-length, 1500);
  stroke-dashoffset: 0;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 4px color-mix(in srgb, var(--series-color), transparent 38%));
}
.arwm-band { fill: var(--series-color); opacity: var(--band-opacity, .08); transform-box: fill-box; transform-origin: center; }
.arwm-point { fill: var(--series-color); stroke: rgba(7, 8, 10, .8); stroke-width: 1.4; transform-box: fill-box; transform-origin: center; cursor: pointer; }
.arwm-point.is-selected { stroke: white; stroke-width: 2.4; filter: drop-shadow(0 0 6px var(--series-color)); }
.arwm-ours-aura { fill: rgba(169, 170, 255, .12); stroke: rgba(169, 170, 255, .2); stroke-width: 1; filter: drop-shadow(0 0 11px rgba(169, 170, 255, .85)); pointer-events: none; }
.arwm-ours-halo { fill: rgba(169, 170, 255, .15); stroke: rgba(255, 255, 255, .7); stroke-width: 1.5; vector-effect: non-scaling-stroke; pointer-events: none; }
.arwm-point.arwm-ours-point { stroke: #fff; stroke-width: 2.3; filter: drop-shadow(0 0 4px #fff) drop-shadow(0 0 10px rgba(169, 170, 255, .95)); }
.arwm-scatter-label.is-ours { fill: #f3f3ff; font-size: 13px; font-weight: 700; letter-spacing: .08em; filter: drop-shadow(0 0 6px rgba(169, 170, 255, .75)); }
.arwm-legend-btn[data-series="Ours"] { color: #f3f3ff; border-color: rgba(169, 170, 255, .34); background: rgba(169, 170, 255, .09); box-shadow: inset 0 0 18px rgba(169, 170, 255, .05); }
.arwm-crosshair { stroke: rgba(255, 255, 255, .62); stroke-width: 1; stroke-dasharray: 2 4; pointer-events: none; }
.arwm-pareto { fill: none; stroke: #5fffc0; stroke-width: 1.8; stroke-dasharray: 7 6; opacity: .95; filter: drop-shadow(0 0 5px rgba(95,255,192,.65)); }
.arwm-identity { stroke: rgba(255, 255, 255, .32); stroke-width: 1; stroke-dasharray: 4 5; }
.arwm-errorbar { stroke: rgba(148, 150, 255, .6); stroke-width: 1; }

.arwm-tooltip {
  position: absolute;
  z-index: 8;
  width: max-content;
  max-width: min(310px, calc(100% - 24px));
  pointer-events: none;
  transform: translate(12px, -50%);
  border: 1px solid rgba(148, 150, 255, .28);
  border-radius: 11px;
  color: #d9dbe2;
  background: rgba(7, 8, 11, .94);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .46);
  backdrop-filter: blur(12px);
  font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 10px 12px;
}
.arwm-tooltip[hidden] { display: none; }
.arwm-tooltip strong { display: block; margin-bottom: 6px; color: #fff; font-size: 12px; }
.arwm-tip-row { display: grid; grid-template-columns: 8px 1fr auto; gap: 7px; align-items: center; padding: 2px 0; }
.arwm-tip-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--series-color); }
.arwm-tip-value { color: #fff; font-variant-numeric: tabular-nums; }

.arwm-subview-tabs { margin: 14px 28px 0; overflow-x: auto; }
.arwm-stat-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 14px 28px 0; }
.arwm-stat { border: 1px solid rgba(255,255,255,.07); border-radius: 10px; background: rgba(255,255,255,.025); padding: 10px 12px; }
.arwm-stat strong { display: block; color: #f5f6fa; font: 600 19px ui-monospace, SFMono-Regular, Menlo, monospace; }
.arwm-stat span { display: block; margin-top: 3px; color: #777b86; font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .07em; text-transform: uppercase; }

.arwm-matrix-label { fill: #8d919d; font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
.arwm-matrix-count { fill: #fff; font: 650 26px ui-monospace, SFMono-Regular, Menlo, monospace; }
.arwm-matrix-rate { fill: #b2b5bd; font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
.arwm-heat-cell { stroke: #0c0e12; stroke-width: 2; }
.arwm-heat-label { fill: #b1b4be; font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; }
.arwm-na-cell { fill: rgba(255,255,255,.025); stroke: rgba(255,255,255,.09); stroke-dasharray: 3 3; }

.arwm-loading,
.arwm-error {
  position: relative;
  z-index: 2;
  padding: 52px 28px;
  color: #8e929d;
  font: 12px ui-monospace, SFMono-Regular, Menlo, monospace;
}
.arwm-error { color: #f1a35b; }

@keyframes arwm-view-in {
  from { opacity: 0; transform: translateY(14px); filter: blur(4px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

@media (max-width: 736px) {
  .arwm-data-header { padding: 20px 18px 15px; }
  .arwm-data-tools { padding: 12px 18px 0; }
  .arwm-chart-wrap { padding: 8px 5px 17px; min-height: 760px; }
  .arwm-chart-svg { min-height: 760px; }
  .arwm-subview-tabs { margin: 12px 18px 0; }
  .arwm-stat-strip { padding: 12px 18px 0; }
}

@media (max-width: 520px) {
  .arwm-data-header { flex-direction: column; gap: 14px; }
  .arwm-data-card { border-radius: 16px; }
  .arwm-data-tools { align-items: flex-start; }
  .arwm-legend { gap: 5px; }
  .arwm-legend-btn { padding: 6px 7px; }
  .arwm-stat-strip { grid-template-columns: 1fr; }
  .arwm-subview-tab { white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  .arwm-data-card .arwm-chart-line,
  .arwm-data-card .arwm-band,
  .arwm-data-card .arwm-point { animation: none !important; }
  .arwm-legend-btn, .arwm-subview-tab { transition: none; }
}
