.constellation-button {
  border-color: color-mix(in srgb, var(--accent), var(--danger) 44%);
  color: var(--text);
}
.constellation-panel {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: clamp(13px, 1.35vw, 26px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--surface);
  background-image: var(--panel-pattern);
  box-shadow: 0 12px 36px var(--shadow);
  outline: none;
  transition: border-color 0.5s, background-color 0.5s, box-shadow 0.5s;
}
.constellation-panel:focus-visible,
.constellation-panel.attention {
  border-color: var(--accent);
}
.constellation-panel.attention {
  box-shadow: 0 12px 42px var(--shadow), 0 0 0 1px color-mix(in srgb, var(--accent), transparent 45%);
}
.constellation-panel.reanchoring .constellation-anchor-node {
  animation: constellation-anchor-pulse 0.5s ease-out;
}
.constellation-accent {
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: radial-gradient(circle at 42% 50%, var(--accent), var(--danger) 22%, transparent 70%);
  opacity: 0.8;
}
.constellation-heading {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(520px, 1.2fr);
  gap: 24px;
  align-items: end;
  padding: 1px 2px 15px;
  border-bottom: 1px solid var(--border);
}
.constellation-heading-copy {
  min-width: 0;
}
.constellation-heading-copy h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(17px, 1.3vw, 24px);
  line-height: 1;
}
.constellation-heading-copy p {
  max-width: 650px;
  margin: 7px 0 0;
  color: var(--quiet);
  font-size: 8px;
  line-height: 1.45;
}
.constellation-controls {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) minmax(260px, 1.3fr);
  gap: 8px;
}
.constellation-anchor-control,
.constellation-mode {
  display: grid;
  gap: 5px;
  min-width: 0;
}
.constellation-anchor-control > span,
.constellation-mode > span {
  color: var(--quiet);
  font-size: 6px;
  font-weight: 900;
  letter-spacing: 0.08em;
}
.constellation-anchor-control select {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 5px 26px 5px 9px;
  border: 1px solid var(--border);
  border-radius: 3px;
  outline: none;
  background: var(--surface-2);
  color: var(--text);
  font-size: 8px;
  font-weight: 800;
  cursor: pointer;
}
.constellation-anchor-control select:focus-visible {
  border-color: var(--accent);
}
.constellation-mode > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.constellation-mode button {
  min-height: 36px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface-2);
  color: var(--quiet);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.035em;
  cursor: pointer;
  transition: color 0.5s, border-color 0.5s, background-color 0.5s, transform 0.5s;
}
.constellation-mode button:first-child {
  border-radius: 3px 0 0 3px;
}
.constellation-mode button:last-child {
  margin-left: -1px;
  border-radius: 0 3px 3px 0;
}
.constellation-mode button:hover,
.constellation-mode button:focus-visible {
  z-index: 1;
  border-color: var(--accent);
  color: var(--text);
}
.constellation-mode button[aria-pressed="true"] {
  z-index: 2;
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent), var(--surface-2) 88%);
  color: var(--text);
  box-shadow: inset 0 -2px var(--accent);
}
.constellation-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 78px;
  padding: 13px 3px 11px;
}
.constellation-summary-copy {
  min-width: 0;
}
.constellation-summary-copy strong {
  color: var(--text);
  font-size: clamp(12px, 1vw, 17px);
}
.constellation-summary-copy p {
  max-width: 920px;
  margin: 5px 0 0;
  color: var(--quiet);
  font-size: 8px;
  line-height: 1.45;
}
.constellation-key {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 7px 12px;
  color: var(--quiet);
}
.constellation-key > span {
  display: flex;
  align-items: center;
  gap: 5px;
}
.constellation-key i {
  display: block;
  width: 14px;
  height: 7px;
  border: 1px solid var(--accent);
  border-radius: 50%;
}
.constellation-key i.outer {
  width: 22px;
  height: 11px;
  border-color: var(--danger);
}
.constellation-key b,
.constellation-key small {
  font-size: 5px;
  font-weight: 900;
  letter-spacing: 0.07em;
}
.constellation-key small {
  color: var(--accent);
}
.constellation-stage {
  position: relative;
  min-height: 520px;
  height: clamp(520px, 34vw, 760px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 3px;
  background-color: color-mix(in srgb, var(--surface-2), transparent 14%);
  background-image: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--accent), transparent 91%), transparent 38%);
  isolation: isolate;
}
#constellation-lines,
.constellation-nodes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.constellation-ring {
  fill: none;
  stroke: var(--grid);
  stroke-width: 1;
  stroke-dasharray: 3 6;
  opacity: 0.66;
}
.constellation-ring.inner {
  stroke: var(--accent);
  opacity: 0.32;
}
.constellation-ring.outer {
  stroke: var(--danger);
  opacity: 0.28;
}
.constellation-link {
  stroke: var(--link-color);
  stroke-width: 1.5;
  stroke-linecap: round;
  opacity: 0.3;
  transition: opacity 0.5s, stroke-width 0.5s, filter 0.5s;
}
.constellation-link.nearest {
  stroke-width: 2;
  opacity: 0.65;
}
.constellation-link.active {
  stroke-width: 3;
  opacity: 1;
  filter: drop-shadow(0 0 5px var(--link-color));
}
.constellation-link-anchor {
  fill: var(--surface);
  stroke: var(--link-color);
  stroke-width: 1.5;
  opacity: 0.9;
}
.constellation-node,
.constellation-anchor-node {
  --car-color: var(--accent);
  position: absolute;
  z-index: 3;
  display: grid;
  justify-items: center;
  align-content: center;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: color-mix(in srgb, var(--surface), transparent 2%);
  color: var(--text);
  text-align: center;
  box-shadow: 0 10px 24px var(--shadow);
}
.constellation-node {
  width: 132px;
  height: 104px;
  padding: 7px;
  cursor: pointer;
  transition: border-color 0.5s, background-color 0.5s, box-shadow 0.5s, opacity 0.5s, transform 0.5s;
}
.constellation-node:hover,
.constellation-node:focus-visible,
.constellation-node.active {
  z-index: 6;
  border-color: var(--car-color);
  background: color-mix(in srgb, var(--car-color), var(--surface) 94%);
  box-shadow: 0 12px 30px var(--shadow), 0 0 0 1px color-mix(in srgb, var(--car-color), transparent 45%);
  transform: translateY(-3px);
}
.constellation-node.nearest {
  border-color: color-mix(in srgb, var(--car-color), transparent 30%);
  box-shadow: 0 10px 26px var(--shadow), inset 0 -2px var(--car-color);
}
.constellation-node img {
  width: 62px;
  height: 48px;
  object-fit: cover;
  border-radius: 3px;
  background: var(--surface-3);
  filter: saturate(0.94) contrast(1.05);
}
.constellation-node-copy {
  min-width: 0;
  width: 100%;
  margin-top: 5px;
}
.constellation-node-copy strong,
.constellation-node-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.constellation-node-copy strong {
  color: var(--car-color);
  font-size: 8px;
}
.constellation-node-copy small {
  margin-top: 2px;
  color: var(--quiet);
  font-size: 5px;
}
.constellation-similarity {
  position: absolute;
  inset: 6px 6px auto auto;
  min-width: 34px;
  padding: 3px 4px;
  border-radius: 2px;
  background: rgba(0,0,0,0.72);
  color: #fff;
  font-size: 7px;
  font-weight: 950;
}
.constellation-anchor-node {
  z-index: 5;
  width: 176px;
  height: 142px;
  padding: 9px;
  border-color: var(--car-color);
  background: color-mix(in srgb, var(--car-color), var(--surface) 94%);
  box-shadow: 0 16px 40px var(--shadow), 0 0 22px color-mix(in srgb, var(--car-color), transparent 75%);
}
.constellation-anchor-node::before {
  content: 'ANCHOR';
  position: absolute;
  inset: 7px auto auto 7px;
  color: var(--accent);
  font-size: 5px;
  font-weight: 950;
  letter-spacing: 0.1em;
}
.constellation-anchor-node img {
  width: 104px;
  height: 72px;
  object-fit: cover;
  border-radius: 3px;
  background: var(--surface-3);
}
.constellation-anchor-node strong,
.constellation-anchor-node small {
  display: block;
}
.constellation-anchor-node strong {
  margin-top: 7px;
  color: var(--car-color);
  font-size: 11px;
}
.constellation-anchor-node small {
  margin-top: 3px;
  color: var(--quiet);
  font-size: 6px;
}
.constellation-empty {
  position: absolute;
  z-index: 9;
  inset: 50% auto auto 50%;
  width: min(320px, calc(100% - 30px));
  padding: 22px;
  border: 1px dashed var(--border);
  background: var(--surface);
  color: var(--quiet);
  font-size: 8px;
  text-align: center;
  transform: translate(-50%, -50%);
}
.constellation-ledger-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 3px 8px;
}
.constellation-ledger-heading > div {
  display: flex;
  align-items: center;
  gap: 8px;
}
.constellation-ledger-heading h3 {
  margin: 0;
  color: var(--text);
  font-size: 11px;
}
.constellation-ledger-heading > span {
  color: var(--quiet);
  font-size: 6px;
  font-weight: 900;
  letter-spacing: 0.07em;
}
.constellation-ledger {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
.constellation-ledger-card {
  --car-color: var(--accent);
  display: grid;
  grid-template-columns: 66px minmax(0, 0.65fr) minmax(160px, 1.35fr) 62px;
  gap: 10px;
  align-items: center;
  min-width: 0;
  min-height: 72px;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface-2);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.5s, background-color 0.5s, transform 0.5s, box-shadow 0.5s;
}
.constellation-ledger-card:hover,
.constellation-ledger-card:focus-visible {
  border-color: var(--car-color);
  background: color-mix(in srgb, var(--car-color), var(--surface-2) 95%);
  transform: translateY(-3px);
  box-shadow: 0 9px 24px var(--shadow);
}
.constellation-ledger-card.nearest {
  border-color: color-mix(in srgb, var(--car-color), transparent 34%);
  box-shadow: inset 3px 0 var(--car-color);
}
.constellation-ledger-card img {
  width: 66px;
  height: 50px;
  object-fit: cover;
  border-radius: 2px;
}
.constellation-ledger-identity,
.constellation-ledger-score {
  min-width: 0;
}
.constellation-ledger-identity strong,
.constellation-ledger-score strong,
.constellation-ledger-identity small,
.constellation-ledger-score small,
.constellation-ledger-identity span,
.constellation-ledger-score span {
  display: block;
}
.constellation-ledger-identity strong {
  overflow: hidden;
  color: var(--car-color);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.constellation-ledger-identity small {
  margin-top: 3px;
  color: var(--quiet);
  font-size: 6px;
}
.constellation-contributions {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.constellation-contribution {
  display: grid;
  grid-template-columns: minmax(72px, 0.6fr) minmax(60px, 1fr) 32px;
  gap: 6px;
  align-items: center;
  min-width: 0;
}
.constellation-contribution span {
  overflow: hidden;
  color: var(--quiet);
  font-size: 5px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.constellation-contribution i {
  height: 3px;
  background: var(--surface-3);
}
.constellation-contribution i b {
  display: block;
  width: var(--share);
  height: 100%;
  background: var(--car-color);
  opacity: 0.8;
}
.constellation-contribution strong {
  color: var(--muted);
  font-size: 6px;
  text-align: right;
}
.constellation-ledger-score {
  text-align: right;
}
.constellation-ledger-score strong {
  color: var(--text);
  font-size: 15px;
}
.constellation-ledger-score span {
  margin-top: 2px;
  color: var(--quiet);
  font-size: 5px;
  font-weight: 900;
  letter-spacing: 0.06em;
}
.constellation-footer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 3px 0;
  color: var(--quiet);
  font-size: 7px;
}
.constellation-footer span:first-child {
  color: var(--muted);
  font-weight: 850;
}
.constellation-tooltip {
  position: fixed;
  z-index: 2000;
  width: min(370px, calc(100vw - 10px));
  max-height: calc(100vh - 10px);
  overflow: hidden auto;
  padding: 9px;
  border: 1px solid var(--border);
  border-top: 3px solid var(--constellation-focus-color, var(--accent));
  border-radius: 3px;
  background: color-mix(in srgb, var(--surface), transparent 2%);
  box-shadow: 0 18px 52px var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(5px);
  transition: opacity 0.5s, transform 0.5s, background-color 0.5s, border-color 0.5s;
}
.constellation-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}
.constellation-tooltip-head {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.constellation-tooltip-head img {
  width: 58px;
  height: 43px;
  object-fit: cover;
  border-radius: 2px;
}
.constellation-tooltip-head strong,
.constellation-tooltip-head small,
.constellation-tooltip-head span {
  display: block;
}
.constellation-tooltip-head strong {
  color: var(--constellation-focus-color);
  font-size: 9px;
}
.constellation-tooltip-head small {
  margin-top: 3px;
  color: var(--quiet);
  font-size: 6px;
}
.constellation-tooltip-head > span {
  color: var(--text);
  font-size: 13px;
  font-weight: 950;
  text-align: right;
}
.constellation-tooltip-head > span small {
  font-size: 5px;
  font-weight: 850;
}
.constellation-tooltip-copy {
  margin: 8px 0 6px;
  color: var(--muted);
  font-size: 7px;
  line-height: 1.4;
}
.constellation-tooltip-row {
  --share: 0%;
  display: grid;
  grid-template-columns: minmax(70px, 0.55fr) minmax(100px, 1fr) 40px;
  gap: 7px;
  align-items: center;
  min-height: 31px;
  border-top: 1px solid var(--border);
}
.constellation-tooltip-row > span {
  color: var(--muted);
  font-size: 6px;
  font-weight: 850;
}
.constellation-tooltip-row > div {
  min-width: 0;
}
.constellation-tooltip-row > div span {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  color: var(--quiet);
  font-size: 5px;
}
.constellation-tooltip-row > div i {
  display: block;
  height: 3px;
  margin-top: 4px;
  background: var(--surface-3);
}
.constellation-tooltip-row > div i b {
  display: block;
  width: var(--share);
  height: 100%;
  background: var(--constellation-focus-color);
}
.constellation-tooltip-row > strong {
  color: var(--text);
  font-size: 6px;
  text-align: right;
}
body.chart-focus .constellation-panel {
  display: none;
}
html[data-theme="retro-terminal"] .constellation-panel,
html[data-theme="retro-terminal"] .constellation-stage,
html[data-theme="retro-terminal"] .constellation-node,
html[data-theme="retro-terminal"] .constellation-anchor-node,
html[data-theme="retro-terminal"] .constellation-ledger-card {
  border-radius: 0;
}
html[data-theme="vaporwave-1996"] .constellation-stage {
  background-image: radial-gradient(circle at 50% 50%, rgba(45,226,230,0.14), rgba(246,1,157,0.04) 40%, transparent 68%);
  box-shadow: inset 0 0 35px rgba(45,226,230,0.05);
}
html[data-theme="manga-ink"] .constellation-panel,
html[data-theme="manga-ink"] .constellation-stage {
  border-width: 2px;
}
html[data-theme="manga-ink"] .constellation-link {
  stroke-width: 2;
}
@media (min-width: 2300px) {
  .constellation-heading {
    grid-template-columns: minmax(430px, 0.8fr) minmax(860px, 1.2fr);
  }
  .constellation-node {
    width: 136px;
    height: 104px;
  }
  .constellation-ledger-card {
    grid-template-columns: 106px minmax(180px, 0.65fr) minmax(280px, 1.35fr) 90px;
    min-height: 94px;
    padding: 10px;
  }
  .constellation-ledger-card img {
    width: 106px;
    height: 72px;
  }
  .constellation-ledger-identity strong {
    font-size: 12px;
  }
}
@media (max-width: 1180px) {
  .constellation-heading {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .constellation-ledger {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 720px) {
  .constellation-heading {
    gap: 14px;
  }
  .constellation-controls {
    grid-template-columns: 1fr;
  }
  .constellation-summary {
    display: grid;
  }
  .constellation-key {
    justify-content: flex-start;
  }
  .constellation-stage {
    min-height: 560px;
    height: 560px;
  }
  .constellation-node {
    width: 70px;
    height: 78px;
    padding: 4px;
    border-radius: 3px;
  }
  .constellation-node img {
    width: 42px;
    height: 34px;
  }
  .constellation-node-copy {
    margin-top: 3px;
  }
  .constellation-node-copy strong {
    font-size: 6px;
  }
  .constellation-node-copy small {
    font-size: 4px;
  }
  .constellation-similarity {
    inset: 3px 3px auto auto;
    min-width: 27px;
    padding: 2px 3px;
    font-size: 5px;
  }
  .constellation-anchor-node {
    width: 80px;
    height: 108px;
    padding: 5px;
  }
  .constellation-anchor-node::before {
    inset: 4px auto auto 4px;
    font-size: 4px;
  }
  .constellation-anchor-node img {
    width: 64px;
    height: 45px;
  }
  .constellation-anchor-node strong {
    margin-top: 5px;
    font-size: 7px;
  }
  .constellation-anchor-node small {
    font-size: 4px;
  }
  .constellation-ledger-heading {
    align-items: flex-start;
  }
  .constellation-ledger-card {
    grid-template-columns: 54px minmax(0, 1fr) 54px;
    gap: 7px;
    min-height: 102px;
  }
  .constellation-ledger-card img {
    width: 54px;
    height: 46px;
  }
  .constellation-contributions {
    grid-column: 1/-1;
  }
  .constellation-ledger-score {
    grid-column: 3;
    grid-row: 1;
  }
  .constellation-footer {
    display: grid;
  }
  .constellation-tooltip-head {
    grid-template-columns: 50px minmax(0, 1fr) auto;
  }
  .constellation-tooltip-head img {
    width: 50px;
    height: 39px;
  }
  .constellation-tooltip-row {
    grid-template-columns: minmax(58px, 0.48fr) minmax(95px, 1fr) 34px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .constellation-panel.reanchoring .constellation-anchor-node {
    animation: none;
  }
}
@-moz-keyframes constellation-anchor-pulse {
  0% {
    transform: scale(0.94);
    filter: brightness(1.45);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}
@-webkit-keyframes constellation-anchor-pulse {
  0% {
    transform: scale(0.94);
    filter: brightness(1.45);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}
@-o-keyframes constellation-anchor-pulse {
  0% {
    transform: scale(0.94);
    filter: brightness(1.45);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}
@keyframes constellation-anchor-pulse {
  0% {
    transform: scale(0.94);
    filter: brightness(1.45);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}
