.cosmos[hidden] { display: none !important; }
.cosmos-fallback {
  container-type: size;
  overflow: hidden;
  pointer-events: none;
  background: #080611 url("star-field.png") 0 0 / 512px auto repeat;
}
.fallback-core {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 112cqh;
  aspect-ratio: 1;
  transform: translate(-50%, -50%) scale(1.35);
  background: url("singularity-core.webp") center / contain no-repeat;
}
.fallback-core img {
  display: none;
  width: 100%;
  height: 100%;
}
.cosmos-fallback:not(.still) .loop-ready { background-image: none; }
.cosmos-fallback:not(.still) .loop-ready img { display: block; }
@media (prefers-reduced-motion: no-preference) {
  .cosmos-fallback { animation: fallback-stars 100s linear infinite; }
  @keyframes fallback-stars { to { background-position: 512px -512px; } }
}

html:not(.compact-experience) .scene-0::before {
  content: '';
  position: absolute;
  z-index: -1;
  top: 50%;
  left: 50%;
  width: min(76vw, 910px);
  height: min(62vh, 590px);
  background: radial-gradient(ellipse, #100819b8 14%, #0f08158f 34%, transparent 70%);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.scene-0 h1 span { color: #c19bff; }
.scene-0 p { color: #e0d8ec; }

.compact-experience :is(.scene-0, .os-chapter) {
  isolation: isolate;
  overflow: clip;
}

.compact-experience :is(.scene-0, .os-chapter)::after {
  content: '';
  position: absolute;
  inset: -64px;
  z-index: -2;
  background: url("star-field.png") 0 0 / 512px auto;
  opacity: .79;
  pointer-events: none;
  animation: drift-stars 24s ease-in-out infinite alternate;
}

.compact-experience .scene-0::before {
  top: 51%;
  width: min(133vw, 550px);
  border: 0;
  box-shadow: none;
  border-radius: 0;
  background: url("singularity-core.webp") center / contain no-repeat;
  mix-blend-mode: screen;
  opacity: .63;
}

.compact-experience .scene-0::after {
  mask-image: radial-gradient(ellipse at 50% 47%, transparent 13%, #000 37%);
}

.compact-experience .scene-0.live-core::before { background: none; }
.compact-experience .scene-0 > .cosmos.compact-core {
  display: block;
  z-index: -1;
  opacity: .7;
  pointer-events: none;
}

@keyframes drift-stars {
  to { transform: translate3d(-42px, 27px, 0); }
}

dialog.os-catalog::backdrop {
  background: #090613ad;
}

.os-blueprint {
  --focus-y: 51dvh;
  --node-width: clamp(230px, 23vw, 314px);
  --rule: color-mix(in srgb, var(--os-color) 76%, #bc9df7);
  --panel-shift: 48px;
  --panel-line: color-mix(in srgb, var(--os-color) 39%, #332943);
}

.os-blueprint::before {
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 51%, #190d2f36, transparent 64%),
    url("star-field.png") 0 0 / 512px auto;
  mask-image: radial-gradient(ellipse at center, #000 18%, transparent 81%);
}

.os-focus-guide {
  border-style: solid;
  border-color: color-mix(in srgb, var(--rule) 42%, transparent);
  box-shadow: 0 0 36px color-mix(in srgb, var(--rule) 16%, transparent);
}

.catalog-connectors {
  position: absolute;
  z-index: -1;
  top: calc(var(--focus-y) - 80px);
  left: calc(var(--sheet-gutter) + var(--node-width) - 3px);
  width: calc(100% - (var(--sheet-gutter) + var(--node-width) - 3px) * 2);
  height: 160px;
  color: var(--rule);
  pointer-events: none;
  overflow: visible;
}

.catalog-connectors path {
  fill: none;
  stroke: currentColor;
  vector-effect: non-scaling-stroke;
}

.catalog-line {
  stroke-width: 1.2;
  opacity: .47;
}

.catalog-signal {
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 17 100;
  stroke-dashoffset: 17;
  filter: drop-shadow(0 0 5px currentColor);
  animation: catalog-signal 3.8s .2s ease-out infinite;
}

.catalog-signal:last-child { animation-delay: .52s; }

@keyframes catalog-signal {
  0% { stroke-dashoffset: 17; opacity: 0; }
  16% { opacity: .96; }
  52%, 100% { stroke-dashoffset: -100; opacity: 0; }
}

.os-node.catalog-context,
.os-node.catalog-recommendation {
  padding: 20px;
  border: 1px solid var(--panel-line);
  border-radius: 15px;
  background:
    radial-gradient(ellipse at 0 0, color-mix(in srgb, var(--os-color) 9%, transparent), transparent 64%),
    linear-gradient(155deg, #16111e, #0b0911 78%);
  box-shadow: 0 16px 42px #050309aa, inset 0 1px #eee0ff16;
}

.os-node.catalog-context { top: calc(var(--focus-y) - var(--panel-shift)); }
.os-node.catalog-recommendation { top: calc(var(--focus-y) + var(--panel-shift)); }

.os-node.catalog-context::after,
.os-node.catalog-recommendation::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--rule);
  box-shadow: 0 0 11px var(--rule);
  transform: translate(50%, -50%);
  opacity: .93;
  pointer-events: none;
}

.os-node.catalog-context::after { inset: 50% 0 auto auto; }
.os-node.catalog-recommendation::after {
  inset: 50% auto auto 0;
  transform: translate(-50%, -50%);
}

.catalog-context h4,
.catalog-recommendation h4 {
  margin-bottom: 14px;
}

.catalog-context > .catalog-workload {
  padding: 0;
  margin: 0;
  border-radius: 0;
  background: none;
  color: #d9d0e2;
  font-size: 13px;
  line-height: 1.55;
}

.catalog-image-label:not([hidden]) {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: #e6dfed;
  font-size: 12px;
  font-weight: 570;
}

.catalog-image {
  width: 100%;
  min-height: 40px;
  padding: 6px 9px;
  border: 1px solid #c1a9dc54;
  border-radius: 7px;
  background: #120e1a;
  color: #faf5ff;
  color-scheme: dark;
  font: 550 14px/1.25 Inter, Arial, sans-serif;
}

.catalog-source:not([hidden]) {
  display: inline-flex;
  align-items: center;
  min-height: 29px;
  gap: 8px;
  margin-top: 10px;
  color: color-mix(in srgb, var(--os-color) 55%, #fff);
  font-size: 12px;
  font-weight: 610;
  text-decoration: none;
}

.catalog-source:hover { text-decoration: underline; }

.catalog-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin: 0;
}

.catalog-metrics > div {
  padding: 8px 10px;
  border: 1px solid #e4cdf217;
  border-radius: 8px;
  background: #e4cdf208;
}

.catalog-metrics dt {
  color: #d3c6de;
  font-size: 11px;
}

.catalog-metrics dd {
  margin: 4px 0 0;
  color: #faf5ff;
  font-size: 17px;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
}

.catalog-deploy {
  position: absolute;
  bottom: max(32px, 6dvh);
  left: 50%;
  z-index: 3;
  width: max-content;
  transform: translateX(-50%);
  text-align: center;
}

.catalog-deploy .catalog-deploy-button {
  min-width: 144px;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--rule), #fff 38%);
  color: #160d22;
  background: color-mix(in srgb, var(--rule) 84%, #fff);
  font-size: 14px;
  font-weight: 750;
}

.catalog-deploy .catalog-deploy-button:hover {
  background: color-mix(in srgb, var(--rule) 61%, #fff);
}

.catalog-deploy p {
  margin: 8px 0 0;
  color: #ded2eb;
  font-size: 12px;
}

@media (max-width: 880px), (max-height: 620px), (max-width: 1100px) and (pointer: coarse) {
  html dialog.os-catalog {
    inset: 0;
    width: min(calc(100% - 24px), 525px);
    height: fit-content;
    max-height: calc(100dvh - 28px);
    margin: auto;
    border: 1px solid #c797f458;
    border-radius: 17px;
    background: #130e1c;
  }

  html .os-blueprint {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 12px;
    min-height: 0;
    padding: 15px;
  }

  html :is(.os-blueprint::before, .os-focus-guide, .catalog-connectors) { display: none; }
  html .os-blueprint-nav { position: static; grid-column: 1 / -1; }
  html .os-focus-visual {
    position: relative;
    inset: auto;
    grid-area: 2 / 1;
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--os-color) 12%, #1a1226);
  }

  html .os-focus-model {
    --glyph-size: 52px;
    inset: 0;
    width: 100%;
    height: 100%;
  }

  html .os-focus-model .os-glyph { inset: 6px; }
  html .os-focus-model .os-solid { transform: rotateX(-10deg) rotateY(-18deg) rotateZ(-5deg); }
  html .os-focus-model .os-layer { display: grid; }

  html .os-detail:not([hidden]) {
    display: grid;
    grid-area: 2 / 1 / auto / -1;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 0;
    animation: none;
  }

  html .os-detail-heading {
    position: static;
    width: auto;
    max-width: none;
    min-height: 52px;
    padding-left: 64px;
    transform: none;
    text-align: left;
  }

  html .os-detail-heading h3 { font-size: 24px; }
  html .os-detail-heading p { margin-top: 3px; }
  html .os-node:is(.catalog-context, .catalog-recommendation) {
    position: relative;
    inset: auto;
    width: auto;
    padding: 14px;
    transform: none;
  }

  html .os-node.catalog-context::after {
    inset: 100% auto auto 27px;
    width: 1px;
    height: 11px;
    border-radius: 0;
    transform: none;
    animation: catalog-mobile-signal 3.8s ease-in-out infinite;
  }

  html .os-node.catalog-recommendation::after { display: none; }
  .catalog-deploy { position: static; width: 100%; margin-top: 1px; transform: none; }
  .catalog-deploy .catalog-deploy-button { width: 100%; }
}

@keyframes catalog-mobile-signal {
  0%, 52%, 100% { opacity: .40; }
  34% { opacity: .98; }
}

@media (prefers-reduced-motion: reduce) {
  .compact-experience :is(.scene-0, .os-chapter)::after,
  .catalog-signal,
  html .os-node.catalog-context::after { animation: none; }
  .catalog-signal { opacity: 0; }
  .os-reduced-motion .os-orbit {
    background: url("singularity-core.webp") center 56% / min(104vh, 126vw) auto no-repeat;
  }
}
