@font-face {
  font-family: "Minecraft";
  src: url("../assets/fonts/minecraft/Minecraft-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* The stage sky: a quiet near-black with a trace of the brand pink in dark,
   a light grey in light, so the model and its pink selection carry the
   colour. Axis colours follow the X red, Y green, Z blue convention and use
   the theme's semantic red and green; each passes 3:1 on its sky. */
html.dark {
  --animus-stage-sky: linear-gradient(180deg, #2b2429 0%, #1a171b 70%, #141215 100%);
  --animus-axis-x: var(--animus-error, #f0616a);
  --animus-axis-y: var(--animus-ok, #5dbf6e);
  --animus-axis-z: #7b9cf5;
}

html.light {
  --animus-stage-sky: linear-gradient(180deg, #ecebec 0%, #dcd9db 100%);
  --animus-axis-x: var(--animus-error, #b42a32);
  --animus-axis-y: var(--animus-ok, #2a7a38);
  --animus-axis-z: #2f4fc4;
}

.animus-npc-preview {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
}

.animus-npc-preview-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.animus-npc-skin-url {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  flex: 1 1 14rem;
  min-width: 0;
}

.animus-npc-skin-url > :first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.animus-mc-stage-frame {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.animus-mc-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  min-height: 16rem;
  max-height: 72vh;
  overflow: hidden;
  border: 1px solid var(--animus-border);
  background: var(--animus-stage-sky, #1a171b);
  /* Vertical swipes scroll the page; a horizontal drag orbits. A drag in
     progress takes every direction. */
  touch-action: pan-y;
  cursor: grab;
  user-select: none;
}

.animus-mc-stage.is-orbiting {
  touch-action: none;
  cursor: grabbing;
}

.animus-mc-stage:focus-visible {
  outline: 2px solid var(--ring, #ffb3d6);
  outline-offset: 2px;
}

.animus-mc-gl-host,
.animus-mc-gl-host canvas,
.animus-mc-text-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.animus-mc-gl-host canvas {
  display: block;
  image-rendering: pixelated;
}

.animus-mc-text-layer {
  pointer-events: none;
}

.animus-mc-text {
  position: absolute;
  transform: translate(-50%, -100%);
  font-family: "Minecraft", var(--font-mono);
  line-height: 1.25;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  width: max-content;
  text-align: center;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.25);
  padding: 0 0.125em;
}

.animus-mc-text.is-nameplate {
  white-space: pre;
  max-width: none;
}

.animus-mc-text.is-dim {
  opacity: 0.5;
}

.animus-mc-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

/* Loading: a straight track with a pink segment that runs across it, the
   same line as the boot splash. */
.animus-mc-spinner {
  position: relative;
  display: block;
  width: 6rem;
  height: 2px;
  overflow: hidden;
  background: color-mix(in srgb, var(--animus-muted) 35%, transparent);
}

.animus-mc-spinner::before {
  content: "";
  position: absolute;
  inset: 0;
  width: 40%;
  background: var(--primary, #ff5fa8);
  animation: animus-track 1.1s ease-in-out infinite;
}

@keyframes animus-track {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(250%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .animus-mc-spinner::before {
    animation: none;
    transform: none;
  }
}

/* The stage's accessible description, shown as a quiet line so keyboard
   users find the keys too. */
.animus-mc-keys {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--animus-muted);
}

.animus-mc-status {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.animus-mc-status:empty {
  display: none;
}

.animus-mc-status p {
  margin: 0;
}

.animus-mc-problem {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--animus-error);
  color: var(--animus-error);
}

.animus-npc-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.25rem 0.75rem;
  margin: 0;
}

.animus-npc-facts dt {
  color: var(--animus-muted);
}

.animus-npc-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.animus-npc-notes {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--animus-muted);
}

@media (max-width: 760px) {
  .animus-mc-stage {
    aspect-ratio: 3 / 4;
    max-height: 62vh;
  }
}

@media (max-width: 520px) {
  .animus-npc-preview-bar button,
  .animus-npc-preview-bar .animus-select-trigger,
  .animus-npc-preview-bar input,
  .animus-mc-status button {
    min-height: 44px;
  }
}
