.history-workspace {
  --map-bg: var(--paper);
  --map-panel: var(--white);
  --map-ink: var(--ink);
  --map-muted: #60635e;
  --map-line: var(--line);
  --map-grid: color-mix(in srgb, var(--map-ink) 12%, transparent);
  --core: #4a485e;
  --parallel: #47746e;
  --mbti: #765c89;
  --soc: #476e90;
  --psy: #946348;
  --ennea: #9d5154;
  --context: #626d78;
  height: 100%;
  position: relative;
  overflow: hidden;
  color: var(--map-ink);
  background: var(--map-bg);
}
.history-map, .history-canvas, .history-article { position: relative; width: 100%; height: 100%; }
.history-canvas { overflow: clip; touch-action: none; user-select: none; cursor: grab; }
.history-canvas.is-dragging, .history-canvas.is-dragging button { cursor: grabbing; }
.history-world {
  position: absolute;
  inset: 0 auto auto 0;
  width: 2380px;
  height: 1595px;
  transform-origin: 0 0;
}
.map-band {
  position: absolute;
  inset-inline: 20px;
  border-block: 1px solid var(--map-grid);
  background: color-mix(in srgb, var(--route) 4%, transparent);
  pointer-events: none;
}
.band-parallel { top: 20px; height: 425px; --route: var(--parallel); }
.band-mbti { top: 470px; height: 270px; --route: var(--mbti); }
.band-russian {
  top: 765px;
  height: 600px;
  --route: var(--soc);
  background: linear-gradient(to bottom, color-mix(in srgb, var(--soc) 4%, transparent) 52%, color-mix(in srgb, var(--psy) 4%, transparent) 52%);
}
.band-ennea { top: 1390px; height: 190px; --route: var(--ennea); }
.map-band span { position: absolute; left: 18px; top: 14px; color: var(--route); font-size: 12px; font-weight: 700; }
.map-era { position: absolute; inset-block: 20px 25px; width: 1px; background: var(--map-grid); pointer-events: none; }
.history-ruler {
  position: absolute;
  inset: 0 0 auto;
  height: 1.6rem;
  overflow: hidden;
  pointer-events: none;
  background: var(--map-bg);
  border-bottom: 1px solid var(--map-line);
  color: var(--map-muted);
  font-size: .7rem;
}
.history-ruler > div {
  position: absolute;
  inset-block: 0;
  left: calc(var(--era-x) * var(--map-scale, 1) + var(--map-x, 0px));
  right: 0;
  display: flex;
  align-items: center;
  border-left: 1px solid var(--map-grid);
}
.history-ruler > div:not(:last-child) { width: calc(var(--era-width) * var(--map-scale, 1)); }
.history-ruler span {
  position: sticky;
  left: 0;
  padding-inline: 4px;
  white-space: nowrap;
  overflow: hidden;
}
.history-world svg { width: 100%; height: 100%; position: absolute; inset: 0; overflow: visible; pointer-events: none; }
.map-edge {
  fill: none;
  stroke: var(--route);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .54;
  vector-effect: non-scaling-stroke;
  marker-end: url(#history-arrow);
}
.edge-influence { stroke-dasharray: 7 6; }
.edge-compare { stroke-dasharray: 2 6; }
.edge-rework { stroke-width: 3; stroke-dasharray: 10 3 2 3; }
.map-edge.dimmed { opacity: .055; }
.map-edge.focused { opacity: 1; stroke-width: 3.2; }
.history-workspace .map-node {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 176px;
  min-height: 58px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 9px 12px;
  color: var(--map-ink);
  border: 1.5px solid var(--route);
  background: color-mix(in srgb, var(--map-panel) 94%, var(--route));
}
.map-node strong { font-size: 11px; line-height: 1.25; overflow-wrap: anywhere; }
.map-node small { font-size: 8.5px; line-height: 1.2; color: var(--map-muted); }
.history-workspace .map-node.core { width: 214px; min-height: 88px; border-width: 2px; }
.map-node.core strong { font-size: 15px; }
.map-node.core small { font-size: 10px; }
.history-workspace .map-node.side { border-style: dashed; }
.map-node.dimmed { opacity: .12; }
.map-node.related { outline: 3px solid color-mix(in srgb, var(--route) 26%, transparent); }
.history-workspace .map-node[aria-pressed="true"] { color: var(--map-panel); background: var(--route); border-color: var(--route); }
.map-node[aria-pressed="true"] small { color: inherit; }
.history-detail {
  position: absolute; right: .75rem; bottom: .75rem; z-index: 2;
  width: min(32rem, 47%); max-height: min(44rem, calc(100% - 3.1rem));
  border: 1px solid var(--map-line); border-left: 3px solid var(--route); background: var(--map-panel);
}
.history-detail:not([hidden]) { display: flex; flex-direction: column; }
.history-detail > header { position: relative; padding: 1rem 1.25rem .8rem; border-bottom: 1px solid var(--map-line); }
.history-detail-body { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 1rem 1.25rem; }
.history-detail-body .d-panel { padding: 0; margin: 0 0 1.25rem; background: transparent; }
.history-detail-body .d-panel:last-child { margin-bottom: 0; }
.history-detail-body .d-panel h3 { font-size: .95rem; margin: 0 0 .45rem; }
.history-workspace :is(.history-detail, .history-article) button {
  background: var(--map-panel); border-color: var(--map-line); color: var(--map-ink);
}
.history-detail h2 { margin: 0 2rem .25rem 0; font-size: 1.1rem; letter-spacing: normal; }
.history-detail small, .history-article small { color: var(--map-muted); }
.history-detail p { margin: .65rem 0; font-size: .85rem; }
.history-detail .history-close { position: absolute; right: .35rem; top: .35rem; padding: 0; width: 2rem; height: 2rem; border: 0; font-size: 1.2rem; }
.history-workspace .history-detail .history-read { display: none; background: var(--route); color: var(--map-panel); border-color: var(--route); font-weight: 600; }
.history-sources { display: flex; flex-wrap: wrap; gap: .4rem 1rem; }
.history-detail .history-sources:not(:empty) { margin-top: .8rem; font-size: .78rem; }
.history-sources a { text-decoration: underline; text-underline-offset: .2em; overflow-wrap: anywhere; }
.history-article { overflow-y: auto; overscroll-behavior: contain; }
.history-article-nav {
  position: sticky; top: 0; z-index: 1;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .55rem clamp(.75rem,2vw,2rem);
  border-bottom: 1px solid var(--map-line);
  background: var(--map-bg); font-size: .85rem;
}
.history-article article { max-width: 58rem; padding: clamp(1rem,3vw,2.25rem) 1rem; margin: 0 auto; }
.history-article article > header { border-left: 4px solid var(--route); padding: .5rem 1rem; margin-bottom: 1.5rem; }
.history-article article > header h2 { margin-bottom: .65rem; font-size: clamp(1.6rem,3.2vw,3rem); }
.history-article .d-panel { background: var(--map-panel); }
.history-article .d-panel h3 { font-size: clamp(1.2rem,2vw,1.65rem); margin: 0 0 .85rem; }
@media (max-width: 700px) {
  .history-detail { bottom: .75rem; left: .75rem; width: auto; padding: 0; border: 0; }
  .history-detail > :not(.history-read) { display: none; }
  .history-workspace .history-detail .history-read { display: block; width: 100%; min-height: 44px; }
}
